Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3401754
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:03:15+00:00 2026-05-18T05:03:15+00:00

Controller function login() { // Don’t show the error message if no data has

  • 0

Controller

function login() {
    // Don't show the error message if no data has been submitted.  
$this->set('error', false);

    // Does not render the view
    $this->autoRender = false;

// If a user has submitted form data: 
if(!empty($this->data)) {
    $someone = $this->Student->findByStudentEmail($this->data['Student']['email']);
    if(!empty($someone['Student']['student_pwd']) && $someone['Student']['student_pwd'] == $this->data['Student']['password']) {

        $this->Session->write('eyeColor', 'Green');
        $this->Session->write('Student', $someone['Student']);

        // session information to remember this user as 'logged-in'. 
        echo "success";

    } else {
        echo "failed";
    }
}
function main(){
    $this->set('students', $this->Student->find('all'));

    $this->set('eyeColor', $this->Session->read('eyeColor'));

    // Render the specified view
    $this->render('/pages/main');
}

view
main.ctp

<?php print $eyeColor; ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:03:15+00:00Added an answer on May 18, 2026 at 5:03 am
    <?php echo $session->read('eyeColor') ?>
    

    It’s in the manual: http://book.cakephp.org/view/1466/Methods

    Admittedly, though, it’s not very clear. Maybe I’ll submit an update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this controller set up for a login: <?php class Login extends Controller
Zend Form is not my friend today! This works :- Controller:- public function indexAction()
I came across a controller in an older set of code (Rails 1.2.3) that
Given a controller method like: def show @model = Model.find(params[:id]) respond_to do |format| format.html
In my view controller's -viewDidLoad method, I call [myTextField becomeFirstResponder]; This works like a
I'm sure this issue can be solved rapidly, but I don't find any answer
I'm sure this issue can be solved rapidly, but I don't find any answer
My Controller class is decorated with an AuthorizeAttribute to protect the actions: [Authorize(Roles =
I want my controller to return the right HTTP response code when the user
So the controller context depends on some asp.net internals. What are some ways to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.