I have researched this problem and have already removed any blank
space after the closing php tag.
Here is the controller code:
function beforeFilter() {
if(isset($this->params['admin'])) {
$this->checkAdminSession();
$allowed = array('Sales','Admin');
$role = $this->readSession('role');
if(!in_array($role,$allowed)) {
$this->roleRedirect();
} else {
$this->layout = $role;
}
}
}
Here is the appcontroller code:
function checkAdminSession() {
if (!$this->Session->check('User')) {
$this -> redirect('/users/login', null, true);
exit();
}
}
function readSession($val) {
if ($this->Session->check('User')) {
return $this->Session->read('User.' . $val);
}
}
function roleRedirect() {
switch($this->readSession('role')) {
case 'Admin':
$this->redirect('/admin/users/' .'' , null,
true);
exit();
break;
case 'User':
$this->redirect('/admin/users/', null, true);
exit();
break;
case 'Sales':
$this->redirect('/admin/sales/', null, true);
exit();
break;
}
}
I should also mention that the webroot folder is in a subdirectory of
the public_html (/home/user/public_html/sub/)and I have the cake and
app directories in the root (/home/user/) with the webroots index.php
properly edited to reflect the various directory paths.
If I comment out the beforeFilter in the controller everything is
fine, but if I leave it in then I get the header information error.
Again, I have already removed all the extra whitespace from the end of
all models, controllers, and views.
Any help would be greatl appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---