public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $webuser = new WebUser($_POST); if ($webuser->getErrorCount() == 0) { if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) { $webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED'); SignupView::show($webuser); } else { //create a webuser in db $id = WebUserDB::addUser($webuser); if ($id != 0) { $base = array_key_exists('base', $_SESSION) ? $_SESSION['base'] : ""; //find the hockuser related to this dude //$hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName()); header("Location: /" . $base . "/user/show/" . $webuser->getHockName()); UserController::show(); //ProfileView::show($webuser, $hockusers[0]);//HomeView::show(); } else { $webuser->setError('userName', 'DBERROR_ADDWEBUSER'); SignupView::show($webuser); } } } else { SignupView::show($webuser); } } else { // Initial link SignupView::show(null); } }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $webuser = new WebUser($_POST); if ($webuser->getErrorCount() == 0) { if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) { $webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED'); SignupView::show($webuser); } else { //create a webuser in db $id = WebUserDB::addUser($webuser); if ($id != 0) { //find the hockuser related to this dude $hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName()); ProfileView::show($webuser, $hockusers[0]); //HomeView::show(); } else { $webuser->setError('userName', 'DBERROR_ADDWEBUSER'); SignupView::show($webuser); } } } else { SignupView::show($webuser); } } else { // Initial link SignupView::show(null); } }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $userdata = new UserData($_POST); if ($userdata->getErrorCount() == 0) { ProfileView::show($userdata); } else { SignupView::show($userdata); } } else { // Initial link SignupView::show(null); } }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $user = new User($_POST); $userData = new UserData($_POST); if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) { HomeView::show(); } else { SignupView::show($user, $userData); } } else { SignupView::show(null, null); } }
public static function run() { $user = null; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formUser = new User($_POST); $user = UsersDB::addUser($formUser); if ($user->getErrorCount() == 0) { $_POST['user'] = $user; } } if (is_null($user) || $user->getErrorCount() != 0) { SignupView::show($user); } else { ProfileView::show(); } }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { //simpleEcho.php; $user = new User($_POST); $userData = new UserData($_POST); //print_r($_FILES); echo '<br>'; if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) { ProfileView::show($userData); } else { SignupView::show($user, $userData); } } else { // Initial link SignupView::show(null, null); } }
public static function run() { $userData = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { $userData = new User($_POST); if (is_null($userData) || $userData->getErrorCount() != 0) { SignupView::show($userData); } else { $userData = UsersDB::addUser($userData); HomeView::show(); header('Location: /' . $_SESSION['base']); } } else { // Initial link SignupView::show(null); } }
public static function run() { $user = null; $userData = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { $user = new User($_POST); //$dbUser = UsersDB::addUser($user); $userData = new UserData($_POST); //$_POST["userId"] = $user->getUserId(); $dbUserData = UsersDB::addUser($user, $userData); if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) { ProfileView::show($user, $userData); } else { SignupView::show($user, $userData); } } else { SignupView::show(null, null); } }
public static function run() { $userData = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { $userData = new User($_POST); $userData = UsersDB::addUser($userData); } if (is_null($userData) || $userData->getErrorCount() != 0) { //SignupView::show($userData); $_SESSION['user'] = $userData; SignupView::show(); } else { $_SESSION['authenticatedUser'] = $userData; HomeView::show(); header('Location: /' . $_SESSION['base']); } // } else // Initial link // $_SESSION['user'] = null; // SignupView::show(); }
public static function run() { $user = null; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formUser = new User($_POST); if ($formUser->getErrorCount() == 0) { $plaintextPassword = $formUser->getPassword(); $hashedPassword = password_hash($plaintextPassword, PASSWORD_DEFAULT); $formUser->setPassword($hashedPassword); $user = UsersDB::addUser($formUser); if ($user->getErrorCount() == 0) { $_SESSION['user'] = $user; } } else { $user = $formUser; } } if (is_null($user) || $user->getErrorCount() != 0) { SignupView::show($user); } else { ProfileView::show(); } }
public static function run() { $user = null; $userData = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { //print_r($_POST); $formUser = new User($_POST); $user = UsersDB::addUser($formUser); if ($user->getErrorCount() == 0) { $_POST["userId"] = $user->getUserId(); $formUserData = new UserData($_POST); $userData = UserDataDB::addUserData($formUserData); if ($userData->getErrorCount() == 0) { $_SESSION['user'] = $user; $_SESSION['userData'] = $userData; } } } if (is_null($user) || is_null($userData) || $user->getErrorCount() != 0 || $userData->getErrorCount() != 0) { SignupView::show($user, $userData); } else { ProfileView::show(); } }
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Basic tests for SignupView</title> </head> <body> <h1>Home view tests</h1> <?php include_once "../views/SignupView.class.php"; ?> <h2>It should call show without crashing</h2> <?php SignupView::show(null); ?> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic tests for User Registration View</title> </head> <body> <h1>User Registration View Test</h1> <?php include_once "../models/User.class.php"; include_once "../models/UserData.class.php"; include_once "../views/SignupView.class.php"; ?> <h2>It should call show when $user and $userData has an input</h2> <?php $testUser = array("userName" => "Thugnificent", "password" => "12345678"); $testUserData = array("userName" => "Thugnificent", "picture" => "../images/thugnificent.jpg", "firstName" => "Otis", "lastName" => "Jenkins", "address" => "123 Thug Lane", "neighborhood" => "Woodcrest", "dateOfBirth" => "1989-01", "gender" => "male", "comedy" => "checked", "email" => "*****@*****.**", "phone" => "(210) 555 - 5555", "url" => "https://otis_jenkins/facebook.com"); $userTest = new User($testUser); $userDataTest = new UserData($testUserData); SignupView::show($userTest, $userDataTest); ?> </body> </html>