Hello,
I would like to rephrase my problem.
I have an admin.php in protected folder...
It just shows a different output in the homepage.
My goal is, after I login, I would like to redirect it to admin.php..
I think that I would change this code(BOLDed and colored red) in site/login:
public function actionLogin()
{
$model=new LoginForm;
// if it is ajax validation request
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if(isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if($model->validate() && $model->login())
$this->redirect(Yii::app()->homeUrl);
}
// display the login form
$this->render('login',array('model'=>$model));
}
What do I change their, in order for it to redirect to admin.php?
Chabx
Page 1 of 1
Redirecting to a specific Page
#2
Posted 06 August 2012 - 06:23 AM
$this->redirect(array('controllerName/actionName')); // you must have specified controller to rander admin page
or
$this->redirect(array('folderWhereAdmin.phpFile/admin'));
Thanks,
Kiran Sharma.
Kiran Sharma.
#3
Posted 10 August 2012 - 03:26 AM
you can use
$this->redirect(array("controller/admin"));
this should do it
$this->redirect(array("controller/admin"));
this should do it
#4
Posted 10 August 2012 - 11:31 AM
Greetings Shiran and Alirz
Yup. Thnx to both of you...
That was the code I was looking for. 
Chabx
Yup. Thnx to both of you...
Chabx
Share this topic:
Page 1 of 1

Help













