-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessUser.php
More file actions
37 lines (30 loc) · 1.27 KB
/
processUser.php
File metadata and controls
37 lines (30 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require("../../databaseAccess.php");
require("createUserClass.php");
/**
* This is php file is just for HTML interaction.
* It requires three arguments from an HTML form (POST method)
* "userEmail", "password", "firstName"
*
*/
// TODO add some regex to strip everything for security
// Information from the form
$userEmail = $_POST['userEmail'];
$firstName = $_POST['firstName'];
$password = $_POST['password'];
$rePassword = $_POST['rePassword'];
//If a valid email address is entered, retyped password is the same as password, password is equal to or greater than 6 characters ,
//nothing is left blank then create the account, and make sure only letters are entered for the name
if ($password == $rePassword && $password != null && strlen($password) >= 6 && preg_match("/[A-Z]/", $password) && $firstName != null && filter_var($userEmail, FILTER_VALIDATE_EMAIL) && preg_match('/^\s*([A-z.?;!0-9+=,"_ ]+(\.[A-z.?;!0-9+=,"_ ]+)?)\s*$/', $firstName)
&& $password != $userEmail && $password != $firstName && $firstName != $userEmail
) {
$user = new createUser($userEmail, $password, $firstName);
header("processLogin.php");
} else {
header("../../createUser.php");
}
/*
//This is just for debug information, we'll remove it when we're done.
print_r($user);
*/
?>