-
Notifications
You must be signed in to change notification settings - Fork 1
/
user_edit.php
82 lines (74 loc) · 2.53 KB
/
user_edit.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
<?php
$email = $_COOKIE["Email"];
$con = mysql_connect("","schoolhunter_admin","admin123");
if (!$con){
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('schoolhunter_DataBase', $con);
if (!$db_selected) {
die ('Can\'t use schoolhunter_DataBase : ' . mysql_error());
}
$query = sprintf("SELECT `Password`, `Gender`, `GRE_V`, `GRE_Q`, `GRE_AW`, `GPA`, `TOEFL` FROM Users WHERE Email='%s' LIMIT 1;",
mysql_real_escape_string($email));
$result = mysql_query($query, $con);
$row = mysql_fetch_assoc($result);
mysql_close($con);
$password = $row["Password"];
$gender = $row["Gender"];
$gre_v = $row["GRE_V"];
$gre_q = $row["GRE_Q"];
$gre_aw =$row["GRE_AW"];
$gpa = $row["GPA"];
$toefl = $row["TOEFL"];
function is_male($gender) {
if ($gender == "M") {
return "checked";
} else {
return "";
}
}
function is_female($gender) {
if ($gender == "F") {
return "checked";
} else {
return "";
}
}
?>
<html>
<head>
<meta charset= 'utf-8'>
<title> Welcome to schoolHunter</title>
</head>
<body>
<form action="user_form.php" method='POST' enctype='multipart/form-data'>
<div class="container" align ='center'>
<input type="hidden" name="Register" value = "true">
<label><b>Email: </b></label>
<input type="email" value="<?=$email?>" name="Email" readonly="readonly">
<br/>
<label><b>Password: </b></label>
<input type="password" value="<?=$password?>" name="Password">
<br/>
<label><b>Gender: </b></label>
<input type="radio" name="Gender" value="M" <?=is_male($gender)?>/> Male
<input type="radio" name="Gender" value="F" <?=is_female($gender)?>/> Female
<br/>
<label><b>GRE Verbal: </b></label>
<input type="text" value=<?=$gre_v?> name="GRE_V">
<br/>
<label><b>GRE Quantitative: </b></label>
<input type="text" value=<?=$gre_q?> name="GRE_Q">
<br/>
<label><b>GRE Analytical Writing: </b></label>
<input type="text" value=<?=$gre_aw?> name="GRE_AW">
<br/>
<label><b>GPA: </b></label>
<input type="text" value=<?=$gpa?> name="GPA">
<br/>
<label><b>TOEFL: </b></label>
<input type="text" value=<?=$toefl?> name="TOEFL">
<br/>
<button type="submit"> Update</button>
</div>
</form>