Home > Backend Development > PHP Tutorial > 批改密码PHP

批改密码PHP

WBOY
Release: 2016-06-13 12:59:47
Original
866 people have browsed it

修改密码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 />
 ?>
Copy after login
这个 哪里出了错误。
------解决方案--------------------

本帖最后由 xuzuning 于 2012-11-24 10:16:01 编辑 "UPDATE `cp_admin` SET `name`='{$admin}',`pwd`='$pwd2).', WHERE `id`='1'"
?????????
------解决方案--------------------
不如贴出你的错误信息
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template