This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
useredit.php
98 lines (90 loc) · 2.41 KB
/
useredit.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
<?php
include("include/session.php");
function pbrnches()
{
global $session;
global $database;
$result=$database->query("select * from ".TBL_BRANCH.";");
if(!$result)
{echo "error executing query";exit();}
while($rows=mysql_fetch_array($result))
{
if($rows['bran_id']==$session->branchid){$sel="selected=true";}
echo "<option value=".$rows['bran_id']." ".$sel.">".$rows['bran_name']."</option>";
unset($sel);
}
}
?>
<html>
<title>Talent Hunt:User Edit</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<body>
<?php
/**
* User has submitted form without errors and user's
* account has been edited successfully.
*/
if(isset($_SESSION['useredit'])){
unset($_SESSION['useredit']);
echo "<h1>User Account Edit Success!</h1>";
echo "<p><b>$session->username</b>, your account has been successfully updated. "
."<a href=\"./\">Main</a>.</p>";
}
else{
?>
<?php
/**
* If user is not logged in, then do not display anything.
* If user is logged in, then display the form to edit
* account information, with the current email address
* already in the field.
*/
if($session->logged_in){
?>
<h1>User Account Edit : <?php echo $session->username; ?></h1>
<?php
if($form->num_errors > 0){
echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Current Password:</td>
<td><input type="password" name="curpass" maxlength="30" value="
<?php echo $form->value("curpass"); ?>"></td>
<td><?php echo $form->error("curpass"); ?></td>
</tr>
<tr>
<td>New Password:</td>
<td><input type="password" name="newpass" maxlength="30" value="
<?php echo $form->value("newpass"); ?>"></td>
<td><?php echo $form->error("newpass"); ?></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" maxlength="50" value="
<?php
if($form->value("email") == ""){
echo $session->userinfo['email'];
}else{
echo $form->value("email");
}
?>">
</td>
<td><?php echo $form->error("email"); ?></td>
</tr>
<tr><td>Branch</td><td><select name='bran_id'><?php pbrnches();?></select></td></tr>
<tr><td colspan="2" align="right">
<input type="hidden" name="subedit" value="1">
<input type="submit" value="Edit Account"></td></tr>
<tr><td colspan="2" align="left"></td></tr>
</table>
</form>
<?php
}
}
?>
</body>
</html>