= ''; if ($_POST['user_name']) { if ($_POST['user_password_new']) { if ($_POST['user_password_new'] === $_POST['user_password_repeat']) { if (strlen($_POST['user_password_new']) > 5) { if (strlen($_POST['user_name']) < 65 && strlen($_POST['user_name']) > 1) { if (preg_match('/^[a-z\d]{2,64}$/i', $_POST['user_name'])) { $user = read_user($_POST['user_name']); if (!isset($user['user_name'])) { if ($_POST['user_email']) { if (strlen($_POST['user_email']) < 65) { if (filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) { create_user(); $_SESSION['msg'] = 'You are now registered so please login'; header('Location: ' . $_SERVER['PHP_SELF']); exit(); } else $msg = 'You must provide a valid email address'; } else $msg = 'Email must be less than 64 characters'; } else $msg = 'Email cannot be empty'; } else $msg = 'Username already exists'; } else $msg = 'Username must be only a-z, A-Z, 0-9'; } else $msg = 'Username must be between 2 and 64 characters'; } else $msg = 'Password must be at least 6 characters'; } else $msg = 'Passwords do not match'; } else $msg = 'Empty Password'; } else $msg = 'Empty Username'; $_SESSION['msg'] = $msg; } return register_form(); }
= ''; if ($_POST['user_name']) { if ($_POST['user_password_new']) { if ($_POST['user_password_new'] === $_POST['user_password_repeat']) { if (strlen($_POST['user_password_new']) > 5) { if (strlen($_POST['user_name']) < 65 && strlen($_POST['user_name']) > 1) { if (preg_match('/^[a-z\d]{2,64}$/i', $_POST['user_name'])) { $user = read_user($_POST['user_name']); if (!isset($user['user_name'])) { if ($_POST['user_email']) { if (strlen($_POST['user_email']) < 65) { if (filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) { create_user(); $_SESSION['msg'] = 'You are now registered so please login'; header('Location: ' . $_SERVER['PHP_SELF']); exit(); } else $msg = 'You must provide a valid email address'; } else $msg = 'Email must be less than 64 characters'; } else $msg = 'Email cannot be empty'; } else $msg = 'Username already exists'; } else $msg = 'Username must be only a-z, A-Z, 0-9'; } else $msg = 'Username must be between 2 and 64 characters'; } else $msg = 'Password must be at least 6 characters'; } else $msg = 'Passwords do not match'; } else $msg = 'Empty Password'; } else $msg = 'Empty Username'; $_SESSION['msg'] = $msg; } return register_form(); }