【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:15_8.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php
session_start();
include_once("15_2.php");
isLogin();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD X
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="zh-CN" lang="zh-CN"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>基本资料修改 - 密码修改</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body><br>
<?php
if(isset($_GET["action"]) and $_GET["action"]=="modify"){
$username = $_COOKIE["username"];
$password = $_COOKIE["password"];
$oldpwd = $_POST["oldpwd"];
$pwd = $_POST["pwd"];
$repwd = $_POST["repwd"];
$question = $_POST["question"];
$answer = $_POST["answer"];
if($password != md5($oldpwd)){
info("原密码验证失败!","15_8.php");
}
if($answer==""){
info("问题答案不能为空!","15_8.php");
}
if($pwd!="" and $repwd!="" and $pwd==$repwd){
//构建SQL
$sql = "update members set `password`='".md5($pwd)."' where username = '".$username."' and password = '".$pass
word."' and question='".$question."' and answer='".$answer."'";
$rs = $conn->Execute($
sql);
if($rs == true){
info("修改密码成功!","15_8.php");
}else{
info("修改密码失败!","15_8.php");
}
}else{
info("新密码为空或不相等!","15_8.php");
}
}else{
$rs = $conn->Execute("select question from members where username = '".$_COOKIE["username"]."' and password = '".$_COOKIE["password"]."'");
print <<<EOT
<div id="nav_top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr width="100%">
<td id="user_right_td">
<form action="15_8.php?action=modify" method=POST name="theForm">
<div id="user_right">
<div id="tabtitle">
<div id="user_topic_bot">
<p class="user_tabgroup_on"><a href="15_7.php">资料修改</a></p>
<p class="user_tabgroup"><a href="15_8.php">密码修改</a></p>
<div style="clear:both;"></div>
</div>
<div id="topicbody">
<span>
<div class="user_nav_topic">
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5" class="title"> 用户密码修改</td>
</tr>
<tr>
<td class="tdcolor">旧密码确认:</td>
<td>
<input type="password" name="oldpwd" value="" size=30 maxlength=13">
*修改时请输入旧密码确认! </td>
</tr>
<tr>
<td class="tdcolor">新密码</td>
<td>
<input type="password" name="pwd" value="" size=30 maxlength=13>
请输入新密码</td>
</tr>
<tr>
<td class="tdcolor">新密码确认:</td>
<td>
<input type="password" name="repwd" value="" size=30 maxlength=13>
再次输入新密码</td>
</tr>
<tr>
<td class="tdcolor">密码问题:</td>
<td>
<input type=text name="question" size=30 value="{$rs->Fields("question")}">
修改密码
问题</td>
</tr>
<tr>
<td class="tdcolor">问题答案:</td>
<td>
<input type=text name="answer" size=30 value="">请正确填写问题答案</td>
</tr>
<tr>
<td colspan='2' align="center">
<input type=Submit value="更 新" name="Submit" class="button"> <input type="reset" name="Submit2" value="清 除" class="button">
</td>
</tr>
</table><br />
</div>
</span>
</div>
</div>
</div>
</form>
</td><tr>
</table>
EOT;
}
?>
</body>
</html>