// take out the value from the $_POST array $username = $_POST["username"]; $password = $_POST["password"]; $repeat_password = $_POST["repeat_password"]; $role = $_POST["role"]; $email = $_POST["email"]; // check if the two password match if ($password === $repeat_password) { // include a global file with all the classes require_once 'Matchup.inc.php'; // create an object of MUUsers $user = new MUUsers(); // check if the username is already in use if (!$user->isUserAlreadyRegistered($username)) { // check if the registration was successful if ($user->registerUser($username, $password, $email, $role)) { // user is correctly registered $register_response_success = "1"; $register_response_message = "Utente%20registrato%20con%20successo"; } else { // something wrong happen $register_response_success = "0"; $register_response_message = "Qualcosa%20di%20inaspettato%20e'%20accaduto"; } } else { // user already register $register_response_success = "0"; $register_response_message = "Utente%20gia'%20registrato"; } } else { // the passwords do not match