public function actionRegister()
 {
     $formModel = new Registration();
     //$this->performAjaxValidation($formModel);
     if (isset($_POST['Registration'])) {
         $formModel->email = $_POST['Registration']['email'];
         $formModel->username = $_POST['Registration']['username'];
         $formModel->password = $_POST['Registration']['password'];
         $formModel->password_repeat = $_POST['Registration']['password_repeat'];
         $formModel->verification_code = $_POST['Registration']['verification_code'];
         if ($formModel->validate()) {
             $model = new User();
             if ($model->insert(CassandraUtil::uuid1(), array('email' => $_POST['Registration']['email'], 'username' => $_POST['Registration']['username'], 'password' => User::encryptPassword($_POST['Registration']['password']), 'active' => false, 'blocked' => false)) === true) {
                 echo 'Model email ' . $formModel->email . ' && username ' . $formModel->username;
                 if (!User::sendRegisterVerification($formModel->email, $formModel->username)) {
                     echo 'failed';
                 } else {
                     echo 'done';
                 }
                 die;
                 //$this->redirect(array('user/profile'));
             }
         }
     }
     $this->render('register', array('model' => $formModel));
 }
    public function actionRegister() {
        $this->layout = '//layouts/login_main';
        if (!isFrontUserLoggedIn()) {
            $model = new Registration;

            if (isset($_POST['Registration'])) {
                $model->attributes = $_POST['Registration'];
                $model->country = "USA";
                if ($model->validate()) {
                    $model->password = md5($model->password);
                    $model->confirm_password = $model->password;
                    $model->save();
                    $this->redirect(base_url() . '/user/default/login');
                }
            }
            $this->render('register', array('model' => $model));
        } else {
            $this->redirect(array("myaccount"));
        }
    }
示例#3
0
 public function store_registrations()
 {
     if ($this->isPostRequest()) {
         $input_data = Input::all();
         // input all data
         $model = new Registration();
         //save data into
         if ($model->validate($input_data)) {
             DB::beginTransaction();
             try {
                 $model->create($input_data);
                 DB::commit();
                 Session::flash('message', 'Successfully Registered ! We will call you back soon.');
             } catch (Exception $e) {
                 //If there are any exceptions, rollback the transaction`
                 DB::rollback();
                 Session::flash('danger', 'Failed !');
             }
         }
     } else {
         Session::flash('danger', 'Invalid Request !');
     }
     return Redirect::back();
 }
示例#4
0
文件: success.php 项目: kapsi44/UMS
<?php

echo "Success";
include_once '../controller/validateRegister.php';
include_once '../model/connect.php';
//include_once 'php/insertion.php';
if (isset($_POST['submit'])) {
    $r = new Registration();
    $r->validate();
    $r->addUser();
}
?>

示例#5
0
<?php

$view = new stdClass();
$view->pageTitle = 'Registration';
require_once 'Models/Registration.php';
if (isset($_POST['email'])) {
    $registration = new Registration();
    $validator = $registration->validate($_POST);
    if ($validator !== true) {
        $view->error = $validator;
    }
}
require_once 'Views/registration.phtml';