-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateAccount.php
More file actions
73 lines (60 loc) · 1.3 KB
/
Copy pathCreateAccount.php
File metadata and controls
73 lines (60 loc) · 1.3 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Created by PhpStorm.
* User: dronca
* Date: 10/20/18
* Time: 8:51 PM
*/
include_once 'lib/DBHelper.php';
include_once 'lib/Cookies.php';
include_once 'lib/User.php';
session_start();
$msg = "hmmm!";
if(isset($_POST['email']) AND isset($_POST['psw'])) {
$user = new User();
$user->fname = $_POST['firstName'];
$user->lname = $_POST['lastName'];
$user->email = $_POST['email'];
$user->password = $_POST['psw'];
$cpwd = $_POST['psw_c'];
$user->address = $_POST['addr'];
$user->apt = $_POST['apt'];
$user->city = $_POST['city'];
$user->state = $_POST['state'];
$user->zipCode = $_POST['zip'];
$user->homePhone = $_POST['phone'];
$user->cellPhone = $_POST['cellPhone'];
$ref = $_SESSION['ref'];
$pathParts = explode("/", $ref);
$page = end($pathParts);
if($user->password == $cpwd)
{
$user->writeUser();
$hdr = "Location: $page";
header($hdr);
}
else if($pwd != $cpwd)
{
$msg = "Passwords do not match";
}
else
{
$msg = "Account already exists";
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
<body >
<?php echo($page); ?>
<?php echo($msg); ?>
</body>
</html>
<?php
//Step 4
$dbh->close();
?>