Re: Sessions not carying over?

2007-05-02 Thread Enchy



I finally got it working.  Cakephp was deleting my session everytime I
went to login page somehow.
I dont have delete session in the controller

class UsersController extends AppController
{
  var $name = 'Users';
var $scaffold;

 function index() {

  }
function login()
{


   $error = false;

$success = false;

   if (!empty($this->data))
{

 $someone = $this->User->findByUsername($this-
>params['data']['User']['username']);
 if(is_array($someone))
 {

if(md5($this->data['User']['password']) ==
$someone['User']['password'])
{
$success = true;
}

 }
if($success)
{
 $this->Session->write('User', $someone['User']);
$this->redirect('/hunters/index');
return true;
}
else
 {

$this->Session->setFlash("Login Failed");

 }


 }
  $this->set('error', $error);
}

function logout()
{
$this->Session->delete('User');
$this->Session->setFlash('Logged out');
$this->redirect('/');
return true;
}

}


Does Cakephp preload functions or something?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions not carying over?

2007-05-02 Thread Enchy

Ok this is my login page:
/admin/index.php/users/login

When I redirect to:
/admin/index.php/users/index
I can print the session onscreen, so this means its working.

But the moment I goto
/admin/   The root of the site then the session does not appear.

Anybody got a solution for this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions not carying over?

2007-05-01 Thread Enchy

Ok here is my problem.

This is my login controller:

  if($success)
{
 $this->Session->write('User', $someone['User']);

  $test = $this->Session->check('User');
 $this->Session->setFlash("bs $test");

   //$this->redirect('../');
return true;
}


This flash  "bs 1"

Here is where I redirect
  function index() {
$test = $this->Session->check('User');
 $this->Session->setFlash("bs $test");
}

this "bs "

So it does not keep the session when I redirect

I call this in my components
var $components = array
('Pagination','Mailer','PhpGacl','Session'); // Added

Is it maybe cause Im going down a directory? $this->redirect('../');


Im new to cakephp and would just like this simple login form to work.
I can do this in 5 minutes without capkephp.

L


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Sessions not carying over?

2007-05-01 Thread Enchy

Hi

I have created to controllers and they use two different tables each.
These two controllers are basically copies of each other.
I logged in and it goes to the first controller but when I go to
second controller it says im not logged in anymore.

Im using phpgacl:

[code]  var $gacl = array(
'get' => array (
'type' => 'callback',
'value' => '_getUser'
),
'denied' => array (
'type' => 'redirect',
'value' => '/users/login'
)

);

var $name = 'Students'; // for PHP4 installs
var $components = array
('Pagination','Mailer','PhpGacl','Session'); // Added
//var $components = array ('Pagination','Mailer'); // Added

var $helpers = array('Pagination'); // Added


  function _getUser()
{
if ($this->Session->check('User'))
{
return $this->Session->read('User');
}

return false;
} [/code]


I even tried $this->Session->check('User') on second controller but
still doesn't register that session
What could cause this to happen?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---