Esempio n. 1
0
 if (empty($_POST['User_Password'])) {
     $errors[] = "Password should be filled";
 } else {
     $User_Password = $_POST['User_Password'];
 }
 if (empty($_POST['User_Phone'])) {
     $errors[] = "Phone Number is required";
 } else {
     $User_Phone = $_POST['User_Phone'];
 }
 if (!isset($_POST['User_Type'])) {
     $errors[] = "User type is required";
 } else {
     $User_Type = $_POST['User_Type'];
 }
 if ($admin_controller->User_Name_Exists($User_Name)) {
     admin_redirect_error(Error_Type::SAME_USER_NAME);
 }
 if (empty($errors)) {
     /**
      * instantiate a new user
      */
     $new_user = new User($User_Name, $User_Password, $User_Type, $User_Phone);
     /**
      * add the user to the database
      */
     $added = $admin_controller->Add_User($new_user);
     /**
      * inform the admin about the result
      */
     if ($added) {