PHP warning

Undefined array key "role"

/home2/sikder/public_html/ambalajobs.com/protected/controllers/SiteController.php(379)

367     public function actionIndex() {
368         $this->pageTitle ="Home";
369         if ($_SERVER['REQUEST_URI'] == '/site' or $_SERVER['REQUEST_URI'] == '/site/') {
370             $this->redirect('https://www.ambalajobs.com');
371             Yii::app()->end();
372         }
373 
374         //$this->pageTitle = 'Afghan Jobs | Kabul Jobs |  Jobs in Afghanistan';
375       //  $this->pageTitle = 'Ambala Job';
376         $this->pageDescription = 'Get the latest job announcements in Bangladesh by UN, Government, International development agencies, Aid Agencies, Private Companies, MNCs';
377         $this->pageKeyword = 'jobs, jobs in Bangladesh, jobs in dhaka, jobs in herat, jobs in nangarhar, jobs in balkh, jobs in kandahar, recruitment, job search, job site, career, employment, recruitment agency, work, careers in Bangladesh, online jobs, jobs website, jobs portal';
378 
379         if ($_POST['role']) {
380             $roleInfo = Roles::model()->findByPk((int) $_POST['role']);
381             Yii::app()->user->roles = $roleInfo->name;
382             Yii::app()->user->roleId = $roleInfo->id;
383 
384             if ($roleInfo->id == '2') {
385                 JsPrivacy::model()->firstTimeActive(Yii::app()->user->userId);
386             }
387 
388             $command = Yii::app()->db->createCommand();
389             $command->update('user', array(
390                 'role' => (int) $roleInfo->id,
391                     ), 'id=:id', array(':id' => Yii::app()->user->userId));

Stack Trace

#7
+
 /home2/sikder/public_html/ambalajobs.com/index.php(22): CApplication->run()
17 // specify how many levels of call stack should be shown in each log message
18 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
19 
20 require_once($yii);
21 
22 Yii::createWebApplication($config)->run();
2024-03-29 18:30:41 Apache Yii Framework/1.1.15