public function actionDetails() { Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/account-details.css"); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/account-details.js", CClientScript::POS_END); $getPassForm = false; $status = false; $msg = ''; if (Yii::app()->request->isPostRequest) { $getPassForm = (bool) Yii::app()->request->getParam('passForm', false); if ($getPassForm) { $getPassword = Yii::app()->request->getParam('password', false); $getNewPassword = Yii::app()->request->getParam('newPassword', false); if (md5($getPassword) == Yii::app()->user->getInfo('password')) { if ($getNewPassword[0] == $getNewPassword[1]) { $model = Yii::app()->user->getModel(); $model->password = md5($getNewPassword); } else { $msg = "New passwords don't match"; } } else { $msg = 'Current Password is wrong'; } } else { $getIban = Yii::app()->request->getParam('iban', ''); $getBic = Yii::app()->request->getParam('bic', ''); $getCard_number = Yii::app()->request->getParam('card_number', ''); $getCard_name = Yii::app()->request->getParam('card_name', ''); $getCard_exp_month = Yii::app()->request->getParam('card_exp_month', ''); $getCard_exp_year = Yii::app()->request->getParam('card_exp_year', ''); $getBillingAddress = Yii::app()->request->getParam('billing_address', ''); $model = Details::model()->find('created_by = ' . Yii::app()->user->getInfo()); if ($model == null) { $model = new Details(); $model->created_by = Yii::app()->user->getInfo(); } $model->iban = $getIban; $model->bic = $getBic; $model->card_number = $getCard_number; $model->card_name = $getCard_name; $model->card_exp_month = $getCard_exp_month; $model->card_exp_year = $getCard_exp_year; $model->billing_address = $getBillingAddress; } if (isset($model)) { if ($model->save()) { $status = true; $msg = 'Successfully Updated'; } else { foreach ($model->getErrors() as $errors) { foreach ($errors as $error) { $msg .= $error; } } } } } $model = Details::model()->find('created_by = ' . Yii::app()->user->getInfo()); $this->render('details', array('msg' => $msg, 'status' => $status, 'model' => $model, 'getPassForm' => $getPassForm)); }