-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_pass.php
More file actions
executable file
·80 lines (79 loc) · 2.53 KB
/
user_pass.php
File metadata and controls
executable file
·80 lines (79 loc) · 2.53 KB
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
<script type="text/javascript">
function CheckUserPass(ObjForm){
if (ObjForm.u_pass_old.value==""){
alert("请输入原始密码!");
ObjForm.u_pass_old.focus();
return false;
}
var Reg=/^\w{5,30}$/;
if (ObjForm.u_pass.value==""){
alert("请输入新密码!");
ObjForm.u_pass.focus();
return false;
}
if (!Reg.test(ObjForm.u_pass.value)){
alert("非法的密码!");
ObjForm.u_pass.value="";
ObjForm.u_pass.focus();
return false;
}
if (ObjForm.u_pass.value!=ObjForm.u_pass2.value){
alert("确认密码错误!");
ObjForm.u_pass2.value="";
ObjForm.u_pass2.focus();
return false;
}
}
</script>
<?php
if ($user=='') Msg('','index.php');
if ($_POST['act']=='user_pass'){
$u_pass_old=md5(ReStra($_POST['u_pass_old']));
$u_pass=md5(ReStra($_POST['u_pass']));
if (RsField('select u_pass from user where u_id='.$user_id)==$u_pass_old){
$sql="update user set u_pass='$u_pass' where u_id=$user_id";
mysql_query($sql) or die(mysql_error($sql));
Msg('修改密码成功!','');
}
else {
Msg('原始密码错误!','');
}
}
?>
<div id="user_right">
<p id="user_title">修改密码</p>
<div class="reg">
<form name="form1" method="post" action="user_pass.php" onsubmit="return CheckUserPass(this);">
<table width="580" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="40%" align="right">原始密码:</td>
<td width="60%"><input name="u_pass_old" type="password" class="inputtext" size="50" maxlength="30" /></td>
</tr>
<tr>
<td style="padding:0px 5px 6px 5px;"> </td>
<td style="padding:0px 5px 6px 5px;"><span>请输入原来的密码</span></td>
</tr>
<tr>
<td align="right">新 密 码:</td>
<td><input name="u_pass" type="password" class="inputtext" size="50" maxlength="30" /></td>
</tr>
<tr>
<td style="padding:0px 5px 6px 5px;"> </td>
<td style="padding:0px 5px 6px 5px;"><span>由5-30个字符(A-Z,a-z,0-9,下划线)组成</span></td>
</tr>
<tr>
<td align="right">确认密码:</td>
<td><input name="u_pass2" type="password" class="inputtext" size="50" maxlength="30" /></td>
</tr>
<tr>
<td> </td>
<td><br /><input type="submit" name="button" class="button" value="修 改" /></td>
</tr>
</table>
<input type="hidden" name="act" value="user_pass" />
</form>
</div>
</div>
</body>
</html>