修改密码PHP
<?php<br /> session_start();<br /> header("Content-type:text/html; charset=utf-8");<br /> include '../config.php';<br /> if($_SESSION['admin']=='') header('location:index.php');<br /> $show = "display:none;";<br /> $sql = "SELECT * FROM `cp_admin` WHERE `id`='1'";<br /> $ret = mysql_query($sql);<br /> $row = mysql_fetch_assoc($ret);<br /> <br /> if($_POST){<br /> $admin = $_POST['admin'];<br /> $pass = $_POST['pass'];<br /> $pass1 = $_POST['pass1'];<br /> $pass2 = $_POST['pass2'];<br /><br /> if($row['name']!=$admin && $row['pwd']!=md5($pass) && $pass1!=$pass2){<br /> echo "<script>alert('修改失败,原因:原始密码不正确,或者两次输入的密码不相同!')</script>";<br /> }else{<br /> $pass1=md5($pass1);<br /> $sql1 = "UPDATE `cp_admin` SET `name`='{$admin}',`pwd`='$pwd2).', WHERE `id`='1'";<br /> mysql_query($sql1);<br /> echo "<script>alert('修改成功!')</script>";<br /> <br /> echo "<script language=\"javascript\">location.href='exit.php';</script>";<br /> $show = "display:block;";<br /> <br /> }<br /> }<br /> ?>