📄 modifypass.php
字号:
<? ob_start(); ?>
<body background="../danse3.jpg">
<form action="modifyPass.php" method="post">
<center>
<!--提示信息 begin-->
<center><strong>修改密码<strong></center><br><br><br>
<hr>
<!--提示信息 end-->
<!--内容 begin-->
<table width=540 border=2 cellpadding=0 cellspacing=1 bgcolor="#0099FF">
<tr><td bgcolor="#7dafdb">
<br><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align=right ><font color=red>*</font>请输入原密码:</td>
<td align=left width="310"><input type="password" name="loginpassword" size="22" ><div id=loginname style="DISPLAY:none"></div></td></tr>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align=right ><font color=red>*</font>请输入新密码:</td>
<td align=left width="310"><input type="password" name="newpassword" size="22" maxlength=16><div id=loginname style="DISPLAY:none"></div></td></tr>
</table><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align=right ><font color=red>*</font>请确认新密码:</td>
<td align=left width="310"><input type="password" name="cnewpassword" size="22" maxlength=16><div id=loginname style="DISPLAY:none"></div></td></tr>
</table><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td></td><td></td></tr>
<tr><td width="100%" colspan=2 align=center><input type=submit name=submit value="提交修改"></td></tr>
</table><br><br>
</td>
</tr>
</table>
</center>
</form>
</body>
<?
include realpath('../Sysconf.php');//连接数据库
$pass=$_POST["loginpassword"];//原来的密码
$newPass=$_POST["newpassword"];//新密码
$cnewPass=$_POST["cnewpassword"];
$username=$_COOKIE["username"];
if($_POST["submit"]=="提交修改"){
if($pass==""){
echo "<script>alert('请输入原来的密码!')</script>";
echo "<script>history.back()</script>";
}elseif($newPass==""||strlen($newPass)<6){
echo "<script>alert('新密码的长度小于6位!')</script>";
echo "<script>history.back()</script>";
}elseif($newPass != $cnewPass){
echo "<script>alert('确认密码错误!')</script>";
echo "<script>history.back()</script>";
}else{
$sql="select * from user_base_information where user_name = '$username' and password='$pass';";
$result=mysql_query($sql);
if(mysql_num_rows($result)){
$sql="update user_base_information set password='$newPass' where user_name = '$username';";
$result=mysql_query($sql) or die("数据库查询失败");
if($result==true){
echo "<script>alert('密码更改成功!请牢记你的新密码...')</script>";
echo "<script>window.location.href='../safeCenter.php'</script>";
}
}else{
echo "<script>alert('密码错误')</script>";
echo "<script>window.location.href='modifyPass.php'</script>";
}
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -