【php开源代码栏目提醒】:网学会员php开源代码为您提供15_7.php参考,解决您在15_7.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"];
$sex = $_POST["sex"];
$email = $_POST["email"];
//构建SQL
$rs = $conn->Execute("update members set `sex`='".$sex."',`email`='".$email."' where username = '".$username."' and password = '".$pass
word."'");
if($rs){
info("更新成功!","15_7.php");
}else{
info("更新失败!","15_7.php");
}
}else{
$rs = $conn->Execute("select id,sex,email 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_7.php?action=modify" method=POST name="theForm">
<div id="user_right">
<div id="tabtitle">
<div id="user_topic_bot">
<p class="user_tabgroup"><a href="15_7.php">资料修改</a></p>
<p class="user_tabgroup_on"><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>
EOT;
if($rs->Fields("sex") == 1){
echo '<input type="radio" name="sex" class="radio" value="1" checked="checked">酷哥
<input type="radio" name="sex" class="radio" value="0">靓妹';
}else{
echo '<input type="radio" name="sex" class="radio" value="1">酷哥
<input type="radio" name="sex" class="radio" value="0" checked="checked">靓妹';
}
print <<<EOT
</td>
</tr>
<tr>
<td class="tdcolor">邮 件:</td>
<td>
<input type="text" value="{$rs->Fields("email")}" name="email" size="30" />
</td>
</tr>
</table>
<br />
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" colspan='2'>
<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>