?? modify.php
字號:
<?php
include("includes/fun_post.php");
include("includes/fun_check.php");
include("includes/fun_data.php");
include("includes/inc_var.php");
DB($g_db_host, $g_db_name, $g_db_user, $g_db_password);
$db = new DBReader;
if(!empty($_POST["mail"]))
{
if(!empty($_POST["password"]))
$db->execute("UPDATE `".$g_db_prefix."user`SET u_password=MD5('".$_POST["password"]."') WHERE u_ID='".$_SESSION["user_id"]."'");
$db->execute("UPDATE `".$g_db_prefix."user`SET u_homepage='".h2t($_POST["homepage"])."' WHERE u_ID='".$_SESSION["user_id"]."'");
$db->execute("UPDATE `".$g_db_prefix."user`SET u_mail='".h2t($_POST["mail"])."' WHERE u_ID='".$_SESSION["user_id"]."'");
$db->execute("UPDATE `".$g_db_prefix."user`SET u_title='".h2t($_POST["title"])."' WHERE u_ID='".$_SESSION["user_id"]."'");
$db->execute("UPDATE `".$g_db_prefix."user`SET h_ID='".$_POST["head"]."' WHERE u_ID='".$_SESSION["user_id"]."'");
$db->execute("UPDATE `".$g_db_prefix."user`SET s_ID='".$_POST["style"]."' WHERE u_ID='".$_SESSION["user_id"]."'");
$db->execute("UPDATE `".$g_db_prefix."user`SET u_pagesize='".$_POST["pagesize"]."' WHERE u_ID='".$_SESSION["user_id"]."'");
if($_POST["showip"]=="S")
$showip = "S";
else
$showip = "N";
$db->execute("UPDATE `".$g_db_prefix."user`SET u_IP='".$showip."' WHERE u_ID='".$_SESSION["user_id"]."'");
echo "<script language='javascript'>window.alert('用戶資料修改成功!');self.location='modify.php';</script>";
exit();
}
$db->execute("SELECT * FROM ".$g_db_prefix."user WHERE u_ID = '".$_SESSION["user_id"]."'");
$dbrow = $db->reader();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="includes/main.css" rel="stylesheet" type="text/css">
<title>星雨留言板</title>
<script language="JavaScript">
<!--
function verifyAddress(obj)
{
var email = obj;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
return true;
else
return false;
}
function regcheck() {
if (this.document.reg.password.value!=""){
if (this.document.reg.repassword.value==""){
window.alert("請重復密碼!");
this.document.reg.repassword.focus();
return;
}
if (this.document.reg.password.value!=this.document.reg.repassword.value){
window.alert("重復密碼與密碼不符!");
document.reg.repassword.select();
this.document.reg.repassword.focus();
return;
}
}
if (this.document.reg.homepage.value==""){
window.alert("請輸入主頁!");
this.document.reg.homepage.focus();
return;
}
if (this.document.reg.mail.value==""){
window.alert("請輸入電子郵件!");
this.document.reg.mail.focus();
return;
}
if(!verifyAddress(document.reg.mail.value))
{
window.alert("請輸入正確的電子郵件!");
document.reg.mail.select();
document.reg.mail.focus();
return;
}
if(this.document.reg.title.value==""){
window.alert("請輸入網站標題!");
this.document.reg.title.focus();
return;
}
this.document.reg.submit();
return;
}
//-->
</script>
</head>
<body>
<form action="modify.php" method="post" name="reg" id="reg">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
<tr>
<th height="20" colspan="2">修改資料</th>
</tr>
<tr>
<td width="107" height="20" align="right">用戶名: </td>
<td width="479"><?php echo $dbrow["u_name"]?></td>
</tr>
<tr>
<td height="20" align="right">密碼: </td>
<td><input name="password" type="password" class="textbox" id="password" maxlength="255">
如果不需要修改密碼請留空。 </td>
</tr>
<tr>
<td height="20" align="right">重復密碼: </td>
<td><input name="repassword" type="password" id="repassword" maxlength="255" class="textbox">
重復密碼。 </td>
</tr>
<tr>
<td height="20" align="right">主頁: </td>
<td><input name="homepage" type="text" class="textbox" id="homepage" value="<?php echo $dbrow["u_homepage"]?>" maxlength="255">
您的主頁地址。</td>
</tr>
<tr>
<td height="20" align="right">電子郵件: </td>
<td><input name="mail" type="text" class="textbox" id="mail" value="<?php echo $dbrow["u_mail"]?>" maxlength="64">
您的電子郵件地址。 </td>
</tr>
<tr>
<td height="20" align="right">標題: </td>
<td><input name="title" type="text" class="textbox" id="title" value="<?php echo $dbrow["u_title"]?>" maxlength="64">
瀏覽器標題顯示內容。</td>
</tr>
<tr>
<td height="20" align="right">樣式模板: </td>
<td><select name="style" class="button" id="style">
<?php
$db->execute("SELECT * FROM `".$g_db_prefix."style`");
while($dbstyle = $db->reader())
{
if($dbrow["s_ID"]==$dbstyle["s_ID"])
echo "<option value=\"".$dbstyle["s_ID"]."\" selected>".$dbstyle["s_name"]."</option>";
else
echo "<option value=\"".$dbstyle["s_ID"]."\">".$dbstyle["s_name"]."</option>";
}
?>
</select>
使用圖片與樣式。</td>
</tr>
<tr>
<td height="20" align="right">頭像模板: </td>
<td><select name="head" class="button" id="head">
<?php
$db->execute("SELECT * FROM `".$g_db_prefix."head`");
while($dbhead = $db->reader())
{
if($dbrow["h_ID"]==$dbhead["h_ID"])
echo "<option value=\"".$dbhead["h_ID"]."\" selected>".$dbhead["h_name"]."</option>";
else
echo "<option value=\"".$dbhead["h_ID"]."\">".$dbhead["h_name"]."</option>";
}
?>
</select>
使用頭像。</td>
</tr>
<tr>
<td height="20" align="right">每頁留言數: </td>
<td><select name="pagesize" id="pagesize" class="button">
<?php
for($i=5;$i<=30;$i=$i+5)
{
if($i==$dbrow["u_pagesize"])
echo "<option value=\"".$i."\" selected>".$i."條</option>";
else
echo "<option value=\"".$i."\">".$i."條</option>";
}
?>
<option value="10">10條</option>
<option value="15">15條</option>
<option value="20">20條</option>
<option value="25">25條</option>
<option value="30">30條</option>
</select></td>
</tr>
<tr>
<td height="20" align="right">顯示留言IP: </td>
<td>
<?php
if($dbrow["u_IP"]=="S")
echo "<input name=\"showip\" type=\"checkbox\" class=\"button\" id=\"showip\" value=\"S\" checked>";
else
echo "<input name=\"showip\" type=\"checkbox\" class=\"button\" id=\"showip\" value=\"S\">";
?>
是 </td>
</tr>
<tr>
<td height="20" colspan="2" align="center"><input type="button" name="Submit" value="修改" class="button" onClick="javascript:regcheck();">
<input type="reset" name="Submit2" value="重置" class="button"></td>
</tr>
</table>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -