-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage-account.php
83 lines (63 loc) · 2.58 KB
/
manage-account.php
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
73
74
75
76
77
78
79
80
81
82
83
<!doctype html>
<?php
# Redirect to login page if not logged in
if(!$_COOKIE['loggedIn']){
# Redirect browser
header('Location: unauthorized.html');
exit();
}
require_once('db_setup.php');
$sql = "USE jjaco16;";
if ($conn->query($sql) !== TRUE) die("Error using database: " . $conn->error);
# set up query and post it to database
$stmt = $conn->prepare("SELECT * FROM User WHERE netID = ?;");
if(!$stmt) die("Error: " . $conn->error);
$stmt->bind_param("s", $_COOKIE['loggedIn']);
$stmt->execute();
#store result
$result = $stmt->get_result()->fetch_assoc();
# cleanup
$stmt->close();
$conn->close();
?>
<html lang="en">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="js/updateAccount.js"></script>
<link rel="stylesheet" href="css/styles.css">
<meta charset="utf-8">
<title>Zoom Room - Manage Account</title>
</head>
<body>
<?php include 'inc/nav.php'; ?>
<h2>Manage Your Account</h2>
<form action="updateAccount.php" method="POST">
<h3>Change Your Password:</h3>
<label for="current-pass">Current Password:</label>
<input type="password" name="current-pass" id="current-pass" placeholder="●●●●●●">
<span id="password-error" class="error"></span><br><br>
<label for="new-pass">New Password:</label>
<input type="password" name="new-pass" id="new-pass" placeholder="●●●●●●"><br><br>
<label for="confirm-pass">Confirm New Password:</label>
<input type="password" name="confirm-pass" id="confirm-pass" placeholder="●●●●●●">
<span id="match-error" class="error"></span><br><br>
<h3>Update Your Email:</h3>
<label for="new-email">Email:</label>
<input type="email" name="new-email" id="new-email" placeholder="<?php echo htmlspecialchars($result['email']) ?>"><br><br>
<h3>Update Your Phone Number:</h3>
<label for="new-phone">Phone number:</label>
<input type="tel" name="new-phone" id="new-phone" placeholder="<?php echo htmlspecialchars($result['phone']) ?>" pattern="\(\d{3}\)-\d{3}-\d{4}$"><br><br>
<h3>Update Your Office:</h3>
<label for="office">Office:</label>
<input type="text" name="office" id="office" placeholder="<?php echo htmlspecialchars($result['office']) ?>">
<span id="office-error" class="error"></span><br><br>
<input type="submit" value="Update profile" class="button"><br><br>
</form>
<p id="message"></p>
<p class="error"></p>
<footer>
<p>P1M4 by Johnny Jacobs (8) and Mcvvina Lin (22)</p>
<p>CSC 261 Fall 2017</p>
</footer>
</body>
</html>