-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
114 lines (101 loc) · 3.94 KB
/
profile.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
include "include/common.inc.php";
$currUser = getLoginUser();
if($currUser->getValue("id") == -1)
goToUrl("index.php");
if(isset($_POST["update"])){
$city = City::getCity(addslashes($_POST["country"]), addslashes($_POST["state"]));
if($_POST["password"] != "")
$user = new User(array(
"id" => $currUser->getValue("id"),
"type" => $currUser->getValue("type"),
"firstName" => $_POST["firstname"],
"lastName" => $_POST["lastname"],
"gender" => $_POST["gender"],
"password" => password($_POST["newPassword"]),
"birthday" => storeDate($_POST["birthday"]),
"cityId" => $city->getValue("id")
));
else
$user = new User(array(
"id" => $currUser->getValue("id"),
"type" => $currUser->getValue("type"),
"firstName" => $_POST["firstname"],
"lastName" => $_POST["lastname"],
"gender" => $_POST["gender"],
"birthday" => storeDate($_POST["birthday"]),
"cityId" => $city->getValue("id")
));
$user->update();
}
$currUser = getLoginUser();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Qe: Truly Black & White</title>
<link rel="stylesheet" type="text/css" href="main.css">
<link rel="shortcut icon" type="image/x-icon" href="images/icon.ico">
<script type= "text/javascript" src = "js/countries2.js"></script>
</head>
<body>
<div id="header">
<img src="images/logo.png"> Truly Black & White
<form action="search_group.php" method="post">
<input name="name" type="text" value="Search Group" onClick="this.value=''">
<input name="search" type="submit" value="Search">
</form>
</div>
<div id="menu">
<ul>
<li><a href="index.php" onMouseOver="this.style.color='#FFF';" onMouseOut="this.style.color='#CCC';">Home</a></li>
<li><a href="profile.php" id="currLi">My Profile</a></li>
<li><a href="groups.php" onMouseOver="this.style.color='#FFF';" onMouseOut="this.style.color='#CCC';">Groups</a></li>
<li><a href="logout.php" onMouseOver="this.style.color='#FFF';" onMouseOut="this.style.color='#CCC';">Logout</a></li>
</ul>
</div>
<div id="wrapper">
<h2>Please Update Your Profile</h2>
<form action="" method="post" enctype="multipart/form-data" name="register">
<table>
<tr>
<th scope="row" width="40%" align="left" >First Name</th>
<td width="60%"><input type="text" name="firstname" value="<?php echo $currUser->getValue("firstName"); ?>"></td>
</tr>
<tr>
<th scope="row" align="left">Last Name</th>
<td><input type="text" name="lastname" value="<?php echo $currUser->getValue("lastName"); ?>"></td>
</tr>
<tr>
<th scope="row" align="left">Gender</th>
<td><select name="gender">
<option value="M" <?php if($currUser->getValue("gender") == "M") echo 'selected="selected"' ?>>M</option>
<option value="F" <?php if($currUser->getValue("gender") == "F") echo 'selected="selected"' ?>>F</option>
</select></td>
</tr>
<tr>
<th scope="row" align="left">New Password</th>
<td><input type="password" name="password" autocomplete="off"></td>
</tr>
<tr>
<th scope="row" align="left">Birthday</th>
<td><input type="date" name="birthday" value="<?php echo $currUser->getValue("birthday"); ?>"></td>
</tr>
<tr>
<th scope="row" align="left">Select Country</th>
<?php $city = City::getCityById($currUser->getValue("cityId")); ?>
<td><select onchange="print_state('state',this.value);" id="country" name = "country"></select></td>
</tr>
<tr>
<th scope="row" align="left">City/District/State</th>
<td><select name ="state" id = "state"></select>
<script language="javascript">print_state("state",'<?php echo $city->getValue("country"); ?>','<?php echo $city->getValue("name"); ?>');</script>
<script language="javascript">print_country("country",'<?php echo $city->getValue("country"); ?>');</script></td>
</tr>
</table><br>
<center><input type="submit" name="update" value="Update"></center>
</form>
</div>
</body>
</html>