www.pudn.com > smartstarwap.rar > chpasswd.php, change:2005-10-04,size:2467b


<? 
    /* ====================================== 
	 * ******smartstar firm wap system****** 
	 * ====================================== 
	 * AUTHOR : 
     * ======= 
     * Copyright (C) 2006 Wap-system - A wap system designed for firm 
     * by smartstar. 
	 */ 
?> 
<? 
include("function.inc.php"); 
?> 
<link href=js/common.css rel=stylesheet type=text/css> 
<? 
if($_POST) 
{ 
	include("../db_connect.php"); 
	$result=mysql_query("select * from users",$db) or die ("query failed"); 
	$row=mysql_fetch_row($result); 
	$passwd=$row[2]; 
	$ypasword=$_POST['ypassword']; 
	$password1=$_POST['password1']; 
	$password2=$_POST['password2']; 
	if(MD5($ypassword) != $passwd) 
	{ 
	echo "<p align=center>原密码错误!"; 
	echo "<a href=\"chpasswd.php\">返回</a></p>"; 
	exit; 
	} 
	else 
	{ 
		if($password1=="" || $password2 =="") 
		{ 
			echo "<p align=center>密码不能为空!"; 
			echo "<a href=\"chpasswd.php\">返回</a></p>"; 
			exit; 
		} 
	else if($password1 != $password2) 
	{ 
	echo "<p align=center>两次输入密码不一致!"; 
	echo "<a href=\"chpasswd.php\">返回</a></p>"; 
	exit; 
	} 
	else 
	{ 
	$passwd=md5($password1); 
	mysql_query("update users set password='$passwd'",$db) or die ("query failed"); 
	echo "<p align=center>密码修改成功,请用修改后的密码重新登陆!"; 
	echo "<a href=\"chpasswd.php\">返回</a></p>"; 
	exit; 
	} 
	} 
} 
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<title>修改密码</title></head> 
<body> 
<table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#DEDFDE"> 
<form method="post" action="chpasswd.php"> 
    <tr>  
      <td colspan="2" bgcolor="#f7f7f7"><div align="center"> <strong>修 改 密 码</strong></div></td> 
    </tr> 
	<tr>  
      <td bgcolor="#FFFFFF"><div align="center">原密码:</div></td> 
<td bgcolor="#FFFFFF"> 
<input type="password" name="ypassword" value=""/> 
</td></tr> 
<tr>  
      <td bgcolor="#FFFFFF"> 
<div align="center">新密码:</div></td> 
      <td bgcolor="#FFFFFF"><input type="password" name="password1" value=""/></td> 
</tr> 
<tr>  
      <td bgcolor="#FFFFFF"> 
<div align="center">确认新密码:</div></td> 
      <td bgcolor="#FFFFFF"><input type="password" name="password2" value=""/></td> 
</tr> 
<tr>  
      <td colspan="2" bgcolor="#f7f7f7"><div align="center"><input type="submit" name="change" value="修改"></div></td> 
    </tr> 
</form> 
</table> 
</body> 
</html>