欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

PHP+DBM的同学录程序(3)

程序员文章站 2022-06-15 16:09:40
6、登出文件logout.php3
6、登出文件logout.php3
<?
setcookie("login",false,time()+31536000);
header("location:login.php3");
?>

7、修改信息文件modify.php3
<?
require("common.php3");
$id=$login;
if($submit){
  if($name=="")error("请填写您的名字!");
  elseif($mail=="")error("请填写您的邮件地址!");
  else{
    $dbm=dbmopen("class","w");
    $intro=nl2br($intro);
    $data="$name|!:!|$nickname|!:!|$mail|!:!|$home|!:!|$oicq|!:!|$icq|!:!|$add|!:!|$tel|!:!|$birth|!:!|$job|!:!|$intro|!:!|$sex";
    dbmreplace($dbm,$id,$data);
    dbmclose($dbm);
    header("location:index.php3");
  }
}else{
        $dbm=dbmopen("class","r");
        $data=dbmfetch($dbm,$login);
    $info=explode("|!:!|",$data);
    dbmclose($dbm);
?>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html><head><title>同学录用户修改信息</title>
<meta content="text/html; charset=gb2312" http-equiv=content-type>
<link rel="stylesheet" href="style.css">
</head><body bgcolor="#ffffff" topmargin=0>
<table border=0 cellpadding=0 cellspacing=0 width="100%"><br>
<div align=center></div><center><tbody></tbody></center>
  </table>
<table border=0 cellpadding=0 cellspacing=0 width="60%" align="center">
<tbody> <tr valign=top>
    <td bgcolor=#000000 width="100%" height="336">  
      <div align=center>
        <table border=0 cellpadding=4 cellspacing=1 height=390 width=586>
          <tbody>  
          <tr>  
            <td align=middle bgcolor=#2f5e8c colspan=2 height=14 valign=top><form method="post" action="modify.php3"> <font color=#ffffff>修改信息-同学录<?echo$login;?></font></td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>nickname: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=20 name=nickname size=23 value=<?echo$info[1];?>>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>电子邮件: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=30 name=mail size=23 value=<?echo$info[2];?>>
              *必须填写 </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的oicq: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=9 name=oicq size=23 value=<?echo$info[4];?>>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的主页: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=50 name=home size=23 value="<?echo$info[3];?>">
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的 icq: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=10 name=icq size=23 value=<?echo$info[5];?>>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的名字: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=10 name=name size=23 value=<?echo$info[0];?>>
              *必须填写 </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的电话: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=20 name=tel size=23 value=<?echo$info[7];?>>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>出生日期: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=11 name=birth size=23 value=<?echo$info[8];?>>
              *类似2000-10-10 </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>联系地址: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=50 name=add size=23 value=<?echo$info[6];?>>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的职业: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <select name="job">
                <option value="学 生">学 生</option>
                <option value="老 师">老 师</option>
                <option value="其 他">其 他</option>
              </select>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>您的性别: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <select name="sex">
                <option value="俊  男">俊  男</option>
                <option value="靓  女">靓  女</option>
                <option value="其  他">其  他</option>
              </select>
            </td>
          </tr>
          <tr>  
            <td align=middle bgcolor=#ffffff height=25 width=121>个人简介: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <textarea class="stedit" name="intro" cols="40" rows="4"><?echo$info[10];?></textarea>
            </td>
          </tr>
          <tr bgcolor=#ffedc8>  
            <td bgcolor=#ffffff colspan=2>  
              <div align="center">  
                <input type="submit" name="submit" value="确认修改" class="stbtm">
                  
                <input type="reset" name="reset" value="重置信息" class="stbtm">
              </div></form>
            </td>
          </tr>
          </tbody>  
        </table>
      </div></tr></tbody></table><br><tr><td></td></tr>
</body>
</html>
<?
}
?>