Hi guys ! This is my situation: 
 
1) a simple_php.php file in webroot folder 
2) the users_controller.php in the app/controllers 
3) the follow function in the users_controller.php : 
 
link <http://pastebin.com/N5E1AN3s>

<code>


   <?
   function login_flat($user_id){
    
           $user_data = $this->User->find('first', array('conditions' => 
   array('User.id' => $user_id)));
       
           if($this->Auth->login($user_data)){
       
           $this->Cookie->write('User.id', $this->Auth->user('id'), true, '+2 
   hour');
                                                                   
           $this->Session->setFlash(__('Welcome back !', true), 'default', 
   array('class' => 'success'));
       
           $this->redirect(array('controller' => 'posts', 'action'=>'index')
   );
                                   exit();
       }
       else{
               echo 'ERROR!!';
               exit();
       }
   }  
   ?>
   

</code>
 

 
(simple function to login user. NOTE : I know it's not safe , but it's for 
test only) 
 
Now, If I call via browser the function ( eg. 
www.mysite.com/users/flat_login/13 ) it WORKS ! but ... 
 
I need to call it via an other file, the simple_php.php located in the 
webroot of my domain. 
 
I try with the php "header" function. It "call" (redirect) to the 
flat_login function , but the login not work !!! :( 
 
Have any suggestion ? thx in advance. 
 
 
P.S. 
I'm using cakephp 1.2.6 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to