Example #1
0
                break;
            case 'userReview':
                userReview();
                break;
            case 'visitQuery':
                echo json_encode(VisitQueryTools::visitQuery((int) $_GET['jobid']));
                break;
            case 'wdFee':
                wdFee();
                break;
            case 'timeline':
                timeline();
                break;
            case 'newUserNotification':
                Utils::validateAPIKey();
                sendNewUserNotification();
                break;
            case 'sendJobReport':
                Utils::validateAPIKey();
                sendJobReport();
                break;
            default:
                die("Invalid action.");
        }
    }
}
function validateAction()
{
    if (validateRequest()) {
        return true;
    } else {
        //	  // email address not valid
        //	  if (!valid_email($email)) {
        //	    throw new Exception('That is not a valid email address.  Please go back and try again.');
        //	  }
        //
        //	  // passwords not the same
        //	  if ($password1 != $password2) {
        //	    throw new Exception('The passwords you entered do not match - please go back and try again.');
        //	  }
        //
        //	  // Check password length is ok
        //	  // Ok if username truncates, but passwords will get
        //	  // Munged if they are too long.
        //	  if ((strlen($password1) < 6) || (strlen($password1) > 16)) {
        //	    throw new Exception('Your password must be between 6 and 16 characters Please go back and try again.');
        //	  }
        // Attempt to register
        // This function can also throw an exception
        register($email, $password1, $firstName, $lastName);
        $currentUser = new user_info();
        $currentUser->setFirstName($firstName);
        $currentUser->setLastName($lastName);
        $currentUser->setEmail($email);
        sendNewUserNotification($currentUser);
        // Register session variable
        $_SESSION['current_user'] = $currentUser;
        header("Location: /index.php");
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}