省实附中吧吧务应征系统3.0 源代码开放·修改密码

<?php session_start();
require(‘head.php’);
require(‘header.php’);
if($_SESSION[“username”]==””){
echo “<script>location.href=’index.php’;</script>”;
}?>
<?php if ($_POST[‘password’]) {
require(‘config.php’);
$db=mysql_connect($ucenterhostname,$ucentersqlname,$ucentersqlpass);
mysql_select_db($ucenterdbname,$db);
mysql_query(“set names ‘utf8′”);
$username=$_SESSION[“username”];
$old_pass=md5($_POST[‘old_password’]);
$sql=”SELECT passwd FROM $ucenterdbtable WHERE username=’$username'”;
$ret=mysql_query($sql);
$arr=mysql_fetch_array($ret);
if ($old_pass==$arr[‘passwd’]) {
$pass=md5($_POST[‘password’]);
$sql=”UPDATE $ucenterdbtable SET `passwd` = ‘$pass’ WHERE username=’$username'”;
mysql_query($sql);
mysql_close();
session_destroy();
header(“Location: erro.php?content=密码修改成功,请用新密码登陆!”);
exit();
}
else
{
$err=true;
}
}
?>
<?php require(‘stat.php’);?>
<center>
<div class=”main_container”>
<div class=”good_card”>
<div class=”notify_title”>
修改密码
</div>
<div class=”notify_content”>
<form action=”passwd_edit.php” id=”f” method=”post”>
<table>
<tr>
<td class=”profile_name”>
原密码:
</td>
<td class=”profile_content”>
<input onfocus=”$(‘#e’).hide();” type=”password” name=”old_password”>
<?php if ($err) {
echo “<span id=’e’ style=’color:#FF0000;’>原密码错误</span>”;
}?>
</td>
</tr>
<tr>
<td class=”profile_name”>
新密码:
</td>
<td class=”profile_content”>
<input type=”password” id=”p1″ name=”password”>
</td>
</tr>
<tr>
<td class=”profile_name”>
重复新密码:
</td>
<td class=”profile_content”>
<input type=”password” id=”p2″>
<input type=”submit”>
</form>
</td>
</tr>
</table>
</div>
</div>

</div>
</center>
<script type=”text/javascript”>
function s () {
if(($(“#p1”).val()===$(“#p2”).val())==true)$(“#f”).submit();
else alert(“密码不一致”);
}
</script>
<div id=”footerTD” class=”footer centerParent” style=”clear: both;”>
<div class=”center” style=”width: 895px;”>
<div id=”idDiv_MSLogo” class=”mslogo”>
</div>
</div>
<?php include(“footer.php”);?>
</div>
</body>
</html>

未经允许不得转载:Lyndon's Studio » 省实附中吧吧务应征系统3.0 源代码开放·修改密码