Skip to content

Instantly share code, notes, and snippets.

@kirs
Forked from anonymous/gist:1208029
Created September 10, 2011 06:47
Show Gist options
  • Save kirs/1208036 to your computer and use it in GitHub Desktop.
Save kirs/1208036 to your computer and use it in GitHub Desktop.
public function actionRegistr()
{
$form = new RegistrForm;
if (!Yii::app()->user->isGuest) {
throw new CException('Вы уже зарегистрированны!');
} else {
if (isset($_POST['RegistrForm'])) {
$form->attributes = $_POST['RegistrForm'];
$form->verifyCode = $_POST['RegistrForm']['verifyCode'];
if($form->validate()) {
$model = new User;
$model->attributes = $form->attributes;
// Выводим страницу что "все окей"
$model->save();
$this->render('registr_ok');
}
} else {
$this->render('registr', array('form' => $form));
}
} else {
$this->render('registr', array('form' => $form));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment