public function store()
 {
     $signup = new Signup(Input::all());
     if ($signup->save()) {
         Auth::login($signup->getUser());
         return Redirect::to('/')->withSuccess('Signup completed successfully');
     } else {
         $this->view('create')->withErrors($signup->getErrors());
     }
 }
        $user_id = $login->verify($emial, $password);
        if ($user_id > 0) {
            $_SESSION['user_id'] = $user_id;
            header('Location:add-image.php');
        } else {
            $message = 'Login failed';
        }
    }
}
$signupField = filter_input(INPUT_POST, 'signup');
$signup = new Signup();
if ($util->isPostRequest() && $signupField !== null) {
    if (!$validtor->emailIsValid($email)) {
        $errors[] = 'Email is not valid';
    }
    if (!$validtor->passwordIsValid($password)) {
        $errors[] = 'Password is not valid';
    }
    if ($signup->emailExists($email)) {
        $error[] = 'Email already exists';
    }
    if (count($errors) <= 0) {
        if ($signup->save($email, $password)) {
            $message = 'Signup complete';
        } else {
            $message = 'Signup failed';
        }
    }
}
include './templates/login-form.html.php';
include './templates/signup-form.php';
예제 #3
0
 /**
  * Sign up for an event
  *
  * Route: /events/signup/
  */
 public function signup()
 {
     if (!$this->authorized()) {
         header('Location: /login');
     }
     // Get the POST parameters
     $s = new Signup();
     $s->event_id = $this->input->post('event_id');
     $s->user_id = $this->session->userdata('id');
     $s->save();
     // Return JSON data for approved signup
     echo json_encode(array('success' => true));
 }