SoFunction
Updated on 2025-04-04

PHP+DBM classmate recording program (3)

6. Logout file logout.php3
<?
setcookie("login",false,time()+31536000);
header("location:login.php3");
?>

7. Modify the information file modify.php3
<?
require("common.php3");
$id=$login;
if($submit){
if($name=="")error("Please fill in your name!");
elseif($mail=="")error("Please fill in your email address!");
  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>Classmate record user modification information</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link rel="stylesheet" href="">
</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>  
<FONT color=#ffffff>Modify information - Classmate <?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>Email: </TD>
            <TD align=left bgColor=#ffffff height=25 width=486>  
              <INPUT class=stedit maxLength=30 name=mail size=23 value=<?echo$info[2];?>>
* Must fill in </TD>
          </TR>
          <tr>  
<td align=middle bgcolor=#ffffff height=25 width=121>Your 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>Your homepage: </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>Your 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>Your name: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=10 name=name size=23 value=<?echo$info[0];?>>
* Must fill in </td>
          </tr>
          <tr>  
<td align=middle bgcolor=#ffffff height=25 width=121>Your phone number: </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>Date of birth: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <input class=stedit maxlength=11 name=birth size=23 value=<?echo$info[8];?>>
*Similar to 2000-10-10 </td>
          </tr>
          <tr>  
<td align=middle bgcolor=#ffffff height=25 width=121>Contact address: </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>Your occupation: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <select name="job">
<option value="Student">Student</option>
<option value="Teacher">Teacher</option>
<option value="Other">Other</option>
              </select>
            </td>
          </tr>
          <tr>  
<td align=middle bgcolor=#ffffff height=25 width=121>Your gender: </td>
            <td align=left bgcolor=#ffffff height=25 width=486>  
              <select name="sex">
<option value="June  Male">June  Male</option>
<option value="Beautiful  Female">Beautiful  Female</option>
<option value="enter  ">enter  </option>
              </select>
            </td>
          </tr>
          <tr>  
<td align=middle bgcolor=#ffffff height=25 width=121>Personal profile: </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="confirm modification" class="stbtm">
                  
<input type="reset" name="reset" value="reset information" class="stbtm">
              </div></form>
            </TD>
          </TR>
          </TBODY>  
        </TABLE>
      </DIV></TR></TBODY></TABLE><BR><TR><TD></TD></TR>
</BODY>
</HTML>
<?
}
?>