Esempio n. 1
0
 public function actionSignup()
 {
     if (isset($_POST['register'])) {
         if (trim($_POST['compName']) == "") {
             $_SESSION['compName'] = $_POST['compName'];
             $_SESSION['error'] = "Please provide your company or individual name";
             header("location: {$_SERVER['HTTP_REFERER']}");
             exit;
         }
         if (trim($_POST['password']) == "") {
             $_SESSION['error'] = "Password field cannot be blank!";
             header("location: {$_SERVER['HTTP_REFERER']}");
             exit;
         }
         if ($_POST['location'] == "") {
             $_SESSION['error'] = "Specify your location";
             header("location: {$_SERVER['HTTP_REFERER']}");
             exit;
         }
         if (trim($_POST['email']) == "" || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == false) {
             $_SESSION['email'] = $_POST['email'];
             $_SESSION['error'] = "The email you provided was invalid";
             header("location: {$_SERVER['HTTP_REFERER']}");
             exit;
         }
         if (!ctype_alnum($_POST['location'])) {
             $_SESSION['error'] = "Location is NOT sensible!";
             header("location: {$_SERVER['HTTP_REFERER']}");
             exit;
         }
         if (User::checker($_POST['email']) != 0) {
             $_SESSION['error'] = "Sorry, a user already exists with the email you provided. Forgot your password? <a href='#'>Get a new one</a>";
             header("location: {$_SERVER['HTTP_REFERER']}");
             exit;
         }
         if (trim($_POST['tel']) != "") {
             if (!isPhoneNumber($_POST['tel'])) {
                 $_SESSION['tel'] = $_POST['tel'];
                 $_SESSION['error'] = "Invalid phone number";
                 header("location: {$_SERVER['HTTP_REFERER']}");
                 exit;
             }
         }
         $x = new Employer($_POST);
         $x->utype = $this->user_type;
         if (!$x->create()) {
             //Log the next line and simply show an error message
             $_SESSION['error'] = "Oops! Something went wrong!";
         } else {
             UserController::redirectToLogin("Account has been created. Please login to continue");
             exit;
         }
     }
     $type = $this->user_type;
     //passed to the view for toggling
     include __VIEWPATH__ . "employer/signup.php";
 }
Esempio n. 2
0
 public function actionApplications()
 {
     $user = UserController::getLoggedUser();
     if ($user == null) {
         UserController::redirectToLogin();
     }
     if ($user->utype == "employer") {
         header("location: ?controller=employer&action=index");
         exit;
     }
     $apps = $user->getApplications();
     $page = "applications";
     $me = $user;
     //this file wraps up dashboard for both employer and student
     include __VIEWPATH__ . "user/_dashboard.php";
 }
Esempio n. 3
0
 public function actionLogout()
 {
     setcookie('logged', '', time() - 3600);
     setcookie('_intseid', '', time() - 3600);
     UserController::redirectToLogin("You have been logged out");
 }