$registerForm['password'] = $_REQUEST['password']; $error += 64; } else { $registerForm['password'] = $_REQUEST['password']; } } } if (!isset($_REQUEST['email']) || $_REQUEST['email'] == "") { $registerForm['email'] = $_REQUEST['email']; $error += 128; } else { if (!filter_var($_REQUEST['email'], FILTER_VALIDATE_EMAIL)) { $registerForm['email'] = $_REQUEST['email']; $error += 256; } else { if (!uniqueEmail($_REQUEST['email'])) { $registerForm['email'] = $_REQUEST['email']; $error += 512; } else { $registerForm['email'] = $_REQUEST['email']; } } } if (!isset($_REQUEST['genre']) || $_REQUEST['genre'] == "default") { $registerForm['genre'] = $_REQUEST['genre']; $error += 1024; } else { $genres = ["Masculino", "Femenino"]; if (!in_array($_REQUEST['genre'], $genres)) { $registerForm['genre'] = $_REQUEST['genre']; $error += 2048;
<?php DEFINE('INCLUDE_CHECK', 1); require_once 'lib/connections/db.php'; include 'lib/functions/functions.php'; checkLogin('2'); // we check if everything is filled in and perform checks if ($_POST['phone'] && !validateNumeric($_POST['phone'])) { die(msg(0, "Phone numbers must be of numeric type only.")); } if ($_POST['email'] && validateEmail($_POST['email'])) { die(msg(0, "Invalid Email!")); } if ($_POST['email'] && uniqueEmail($_POST['email'])) { die(msg(0, "Email already in database. Please select another email address.")); } $res = editUser($_SESSION['user_id'], $_POST['email'], $_POST['first_name'], $_POST['last_name'], $_POST['dialing_code'], $_POST['phone'], $_POST['city'], $_POST['country']); if ($res == 4) { die(msg(0, "An internal error has occured. Please contact the site admin!")); } if ($res == 99) { die(msg(1, "Profile updated successfully!")); } function msg($status, $txt) { return '{"status":' . $status . ',"txt":"' . $txt . '"}'; }
//For registration // we check if everything is filled in and perform checks if (!$_POST['username']) { die(msg(0, "<p>Please enter a username.</p>")); } if (strlen($_POST['username']) < 3 || strlen($_POST['username']) > 15) { die(msg(0, "<p>Username must be between 3 and 15 characters.</p>")); } elseif (uniqueUser($_POST['username'])) { die(msg(0, "Username already taken.")); } elseif (!$_POST['password']) { die(msg(0, "<p>Please enter a password.</p>")); } elseif (strlen($_POST['password']) < 5) { die(msg(0, "<p>Usernames must be atleast 5 characters.</p>")); } elseif (!$_POST['email']) { die(msg(0, "<p>Please enter an email address.</p>")); } elseif (uniqueEmail($_POST['email'])) { die(msg(0, "<p>Email taken. Please select another email address.</p>")); } else { $res = addUser($_POST['username'], $_POST['password'], $_POST['email'], $site_url); if ($res == 1) { die(msg(0, "Failed to send activation email. Please contact the site admin.")); } if ($res == 2) { die(msg(0, "There was an error registering your details. Please contact the site admin.")); } if ($res == 99) { die(msg(1, "<p>Registration successful! <a href='login.php'>Click here</a> to login.</p>")); } } function msg($status, $txt) {