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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
<?php include_once("common.php"); if (!isset($_SESSION['member'])) { header("Location: login.php"); exit; }
$isPostBack = isset($_POST['current_password'], $_POST['new_password'], $_POST['confirm_password']); if ($isPostBack) { $password = $_POST['current_password']; $newPassword = $_POST['new_password']; $confirmPassword = $_POST['confirm_password']; if (strlen($newPassword) && strlen($confirmPassword)) { if ($newPassword == $confirmPassword) { require_once("../webadmin/configure.php"); $sql_password = mysql_real_escape_string(md5($password)); $sql_newPassword = mysql_real_escape_string(md5($newPassword)); $sql_cid = mysql_real_escape_string($_SESSION['member']['cid']); $sql = "UPDATE clients SET cpw = '$sql_newPassword' WHERE cid = '$sql_cid' AND cpw = '$sql_password' AND cstatus = '1'"; if ($result = mysql_query($sql)) { if (mysql_affected_rows() === 0) $message = 'Current password incorrect.'; else { header("Location: order_history.php?msg=" . urlencode('Password update success.')); exit; } } else $message = 'Failure to update password.'; } else $message = 'New password and confirm new password are not match.'; } else $message = 'New password not allow empty.'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title>Glorious Company</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> function validate() { var newPwd = $('#new_password').val(); var confirmPwd = $('#confirm_password').val(); var isValid = true; if (newPwd != confirmPwd) { isValid = false; alert('New password and confirm new password are not match.'); } else if (newPwd.length == 0) { isValid = false; alert('New password not allow empty.'); } return isValid; } </script> </head> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!-- Header --> <tr> <td height="73"><table width="930" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="220"><a href="../" target="_blank"><img src="images/logo.png" width="263" height="80" border="0"/></a></td> <td align="right"><span class="header">Welcome [<?=$_SESSION['member']['ccontactp']?>]</span> <a href="logout.php"><img src="images/btn_logout.png" border="0" align="absmiddle"/></a></td> </tr> </table></td> </tr> <tr> <td><table width="930" border="0" align="center" cellspacing="0" cellpadding="0"> <tr> <td align="right"><img src="images/menu_changepassword.png" width="200" height="35" border="0" /></td> </tr> </table></td> </tr> <tr> <td height="5" class="headerline"></td> </tr> <!-- End Header --> <tr> <td height="450" align="center" valign="middle"> <?php if (strlen($message)) { ?> <div style="height: 30px; color: red"><?=$message?></div> <?php } ?> <form action="change_password.php" method="post" onsubmit="return validate();"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="150" height="30" align="left" class="login">Current Password </td> <td colspan="2" align="left"><input type="password" id="current_password" name="current_password" class="logininput" style="width:300px;" /></td> </tr> <tr> <td height="30" align="left" class="login">New Password </td> <td colspan="2" align="left"><input type="password" id="new_password" name="new_password" class="logininput" style="width:300px;" /></td> </tr> <tr> <td height="30" align="left" class="login">Confirm New Password </td> <td colspan="2" align="left"><input type="password" id="confirm_password" name="confirm_password" class="logininput" style="width:300px;" /></td> </tr> <tr> <td align="left"> </td> <td align="left" class="login"><a href="#" style="display:none">Forgot Password?</a></td> <td align="right"> <input type="submit" name="submit" value="" style="background-image: url(images/btn_ok.png); background-color: transparent; width: 60px; height: 20px; border: 0px" /> <input type="button" name="btn_cancel" value="" style="background-image: url(images/btn_cancel.png); background-color: transparent; width: 60px; height: 20px; border: 0px" onclick="window.location.href='order_history.php'" /> </td> </tr> </table> </form> </td> </tr> <!-- Footer --> <tr> <td class="footer">COPYRIGHT © 2012 GLORIOUS COMPANY. ALL RIGHTS RESERVED</td> </tr> </table> </body> </html>
|