⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modify.php

📁 我不介意你怎么用这个程序
💻 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 + -