Monday, April 23, 2012

Re: CakePhp $this->redirect $this->Session doesn't work

This is the code of my AppController class. As you can see there is session in the component

class AppController extends Controller {

    public function beforeFilter() {
        $this->Auth->allow('index', 'view','login','logout','edit');
        //$this->Auth->allow('login','logout');
        
    }
    
    public $components = array(
        'Session',
        'Auth' => array(
            'loginRedirect' => array('controller' => 'richiestas', 'action' => 'index'),
            'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
            'authorize' => array('Controller') // Added this line
        )
    );

    public function isAuthorized($user) {
        // Admin can access every action
        return true;
        
        if (isset($user['role']) && $user['role'] === 'admin') {
            return true;
        }

        // Default deny
        return false;
    }    
}

On Mon, Apr 23, 2012 at 12:16 PM, LITTO CHACKO <litto@axtecindia.com> wrote:
ya, i sometimes these code works perfect in localserver. but it has problem with in main server.
pls do the things i have mention in the previous post.
* check spaces at last of controller/model
*arrange codes proper


On Mon, Apr 23, 2012 at 3:40 PM, Gian Paolo Donnarumma <gpdonnarumma@gmail.com> wrote:
Hi,
thank you for your fast reply.

The problem is that on my local webserver all works well!!

I've only changed webserver from local to a domain.
The application works:
- direct link
- DB

but I have a login form that block all because redirect doesn't works.

Is possible that is a session problem?
I say this because $this->Sessio->setFlash doesn't works too.

Regards

On Mon, Apr 23, 2012 at 12:03 PM, LITTO CHACKO <litto@axtecindia.com> wrote:
@star
first of all make sure that u have added this line in your controller
public $components = array('Session');
redirect issue is sometimes happends in cakephp. to resolve this you have to arrange code in a certain manner. also pls check whether their is any spaces in model, controller files at the end of each file.etc. as these can cause compilation error. once i had this problem, but when i arranged code and removed spaces from controller and model it works well.


On Mon, Apr 23, 2012 at 2:56 PM, stranet <gpdonnarumma@gmail.com> wrote:
Hi,
I have a strange problem.

On my xampp local server cakephp works well.

I've uploaded the project on a webserver online and I think that the
"component" doesn't work.

$this->redirect doesn't work
$this->Session doesn't work

how can I resolve?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Litto Chacko
Axtec Softwares

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Litto Chacko
Axtec Softwares

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: