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

📄 modify_user.php

📁 不错的图书管理系统。简单明了
💻 PHP
字号:
<?php
include("header.php");
include("checking.php");
if($mode==""):
if($userid=="")
{
	echo "<p align=center>超链接发生错误<br><a href=\"javascript:history.go(-1)\">返回</a>";
	exit();
}
$sql="select * from user where id=".$userid;
$rs=mysql_query($sql,$conn);
if(mysql_num_rows($rs)==0)
{
	echo "<p align=center>发后致命错误:此用户资料没有找到<br><a href=\"javascript:history.go(-1)\">返回</a>";
	exit();
}
$lists=mysql_fetch_array($rs);
?>
<div align="center">
  <center>
  <p align class="1">用户:<?php echo $lists[name] ?></p>
  <table border="1" width="80%" bordercolor="#000000" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%">
      <form action="modify_user.php?mode=doit&postword=<?php echo $postword."&userid=".$userid; ?>". method="post">
        <table border="0" width="100%" cellspacing="0" cellpadding="0" height="86">
          <tr>
            <td width="50%" height="18" align="right">姓名*:</td>
            <td width="50%" height="18"><input type="text" name="name" size="20" value="<?php echo $lists[name] ?>"></td>
          </tr>
          <tr>
            <td width="50%" height="18" align="right">证件号码*:</td>
            <td width="50%" height="18"><input type="text" name="document" size="20" value="<?php echo $lists[document] ?>"></td>
			<input type="hidden" name="old_document" size="20" value="<?php echo $lists[document] ?>">
          </tr>
          <tr>
            <td width="50%" height="18" align="right">编号*:</td>
            <td width="50%" height="18"><input type="text" name="editor" size="20" value="<?php echo $lists[editor] ?>"></td>
            <input type="hidden" name="old_editor" size="20" value="<?php echo $lists[editor] ?>">
          </tr>
          <tr>
            <td width="50%" height="18" align="right">住址*:</td>
            <td width="50%" height="18"><input type="text" name="dress" size="20" value="<?php echo $lists[dress] ?>"></td>
          </tr>
          <tr>
            <td width="50%" height="18" align="right">Email:</td>
            <td width="50%" height="18"><input type="text" name="email" size="20" value="<?php echo $lists[email] ?>"></td>
          </tr>
          <tr>
            <td width="50%" height="18" align="right">电话*:</td>
            <td width="50%" height="18"><input type="text" name="phone" size="20" value="<?php echo $lists[phone] ?>" ></td>
          </tr>
          <tr>
            <td width="50%" height="18" align="right">密码*:</td>
            <td width="50%" height="18"><input type="text" name="passwords" size="20" value="<?php echo $lists[password] ?>"></td>
          </tr>
<?php
if($flag!=0):
?>    
          <tr>
            <td width="50%" height="14" colspan="2" align="right">
              <p align="center"><br><input type="submit" name="T7" size="20" value="提交"><input type="reset" name="T7" size="20"></p>
            </td>
          </tr>
<?php
endif;
?>
        </table>
        </form>
      </td>
    </tr>
  </table>
  </center>
</div>
<?php
endif;
if($mode=="doit")
{
	if($name=="" || $document=="" || $editor=="" || $dress=="" || password=="")
	{
		echo "<p align=center>所有选项不能为空";
		echo "<br><a href=\"javascript:history.back()\">返回</a>";
		exit();
	}
	if($email!="")
		if(!strpos($email,"@") || !strpos($email,"."))
		{
			echo "<p align=center>Email地址格式错误";
			echo "<br><a href=\"javascript:history.back()\">返回</a>";
			exit();
		}
	//echo $old_document." or ".$old_editor." or ".$editor;
	if($old_editor != $editor)
	{
		$sql="select id from user where editor='".$editor."'";
		$rs=mysql_query($sql,$conn);
		if(mysql_num_rows($rs)!=0)
		{
			echo "<p align=center>出现相同的编号";
			echo "<br><a href=\"javascript:history.back()\">返回</a>";
			exit();
		}
	}
	if($old_document != $document)
	{
		$sql="select id from user where document='".$document."'";
		$rs=mysql_query($sql,$conn);
		if(mysql_num_rows($rs)!=0)
			if($parety_document)
			{
				echo "<p align=center>出现相同证件号码";
				echo "<br><a href=\"javascript:history.back()\">返回</a>";
				exit();
			}
			else
				$paretys=1;
	}
	$sql="update user set document='".$document."'";
	$sql.=",name='".$name."'";
	$sql.=",dress='".$dress."'";
	$sql.=",phone='".$phone."'";
	$sql.=",password='".$passwords."'";
	$sql.=",editor='".$editor."'";
	$sql.=",email='".$email."'";
	$sql.=" where id=".$userid;
	//echo $sql;

	@mysql_query($sql,$conn) or die ("<p align=center>修改时发生错误");
	echo "<p align=center>用户资料修改成功</p>";
	if($paretys)
		echo "<br><font color=red>警告:出现相同的证件号码</font>";	
	echo "<P align=center><a href=\"list_user.php?".urldecode($postword)."\">返回</a>";
}

mysql_close($conn);
?>
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -