When run this code in my application everything work fine on my local server. On running it on the web server, it displays blank page on redirect. Then when I debug, it displays the error in the screen shots.
Site controller
public function actionIndex()
{
$this->layout = 'homePage';
if (\Yii::$app->user->isGuest)
{
return $this->redirect(['site/login']);
}
else
{
// die('hello');
$isManager = Yii::$app->session->get('building_id');
$isContractor = Yii::$app->session->get('company_id');
$isZonal = Yii::$app->session->get('zonal_id');
if(isset($isManager))
{
return $this->render('manager-dashboard');
}
else if(isset($isContractor))
{
return $this->render('contractor-dashboard');
}
else if(isset($isZonal))
{
return $this->render('zonal-dashboard');
}
else
{
return $this->render('user-dashboard');
}
}
}
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
// die('hello');
return $this->goHome();
}
$model = new LoginForm();
$login = new \app\models\LoginDetails();
if ($model->load(Yii::$app->request->post())) {
$log = \app\models\User::find()->where(['user_login_id' => $_POST['LoginForm']['username'], 'is_block' => 0])->one();
// die(var_dump($log));
if(empty($log)) {
\Yii::$app->session->setFlash('loginError', '<i class="fa fa-warning"></i><b> Incorrect username or password. !</b>');
return $this->render('login', ['model' => $model]);
}
$login->login_user_id = $log['user_id'];
$loginuser = $login->login_user_id;
$contractorlogin = Inspector::find()->andWhere(['contractor_user_id'=>$loginuser])->one();
$managerlogin = Building::find()->andWhere(['building_user_id'=>$loginuser])->one();
$zonallogin = ZonalAdministrator::find()->andWhere(['zonal_administrator_user_id'=>$loginuser])->one();
if($managerlogin)
{
\Yii::$app->session->set('building_id',$managerlogin->building_id);
}
else if($contractorlogin)
{
\Yii::$app->session->set('company_id',$contractorlogin->company_id);
}
else if($zonallogin)
{
\Yii::$app->session->set('zonal_id',$zonallogin->zonal_id);
}
else if(!$contractorlogin && !$managerlogin&& !$zonallogin)
{
\Yii::$app->session->set('admin_user',$loginuser);
}
else {
\Yii::$app->session->setFlash('loginError', '<i class="fa fa-warning"></i><b> These Login credentials are Blocked/Deactive by Admin</b>');
return $this->render('login', ['model' => $model,]);
}
$login->login_status = 1;
$login->login_at = new \yii\db\Expression('NOW()');
$login->user_ip_address=$_SERVER['REMOTE_ADDR'];
$login->save(false);
if($model->login()) {
if(!isset(Yii::$app->request->cookies['language'])) {
return $this->redirect(['language']);
} else
return $this->goBack();
}
else
return $this->render('login', ['model' => $model,]);
} else {
return $this->render('login', [
'model' => $model,
]);
}
}
7165
7166
Why is it so on the web server. Please help me