SoFunction
Updated on 2025-04-08

Classmate Records of Xinglin (8)

Class Management Section:
front page:
<?php
include ("class/");
if ($superadmin){     //If the administrator has been logged in, perform password verification
  if (!($supername==$supervisor)||!($superpass==$superpsw)){  
echo "Password error";
   exit;
}else{ //Login with session record administrator
session_start(); // Start session
   session_register("superlogin");
   $superlogin=$supername;   
   }
}else{
echo "<form name='form1' method='post' action='$PHP_SELF'>";
echo "<div align='center'> Please enter the administrator password<br>";
echo "administrator";
echo "<input type='text' name='supername'><br>";
echo "password";
echo "<input type='password' name='superpass'><br>";
echo "<input type='submit' name='superadmin' value='enter'><br>";
echo "<input type='reset' name='cancel' value='rewrite'></div>";
echo "</form>";
exit;
}
?>
<html>
<head>
<title>Class Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p>&nbsp;</p>
<table width="73%" border="0" cellspacing="0" cellpadding="0" align="center" height="208">
  <tr>  
    <td>
      <div align="center"><img src="class/image/" width="224" height="60"></div>
    </td>
  </tr>
  <tr>  
    <td>  
<div align="center">Class Management</div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align="center">
<a href="class/admin/" target="_blank">Add member</a><br>
<a href="class/admin/" target="_blank">Show and delete members</a><br>
<a href="class/admin/" target="_blank">Modify member information</a><br>
<a href="class/notebook/" target="_blank">Class Message Management</a><br>
<a href="class/notebookg/" target="_blank">Guest message management</a></div>
    </td>
  </tr>
</table>
</body>
</html>
Add member: class/admin/
<?
session_start();
if(!session_is_registered("superlogin"))//Check whether to register
{
echo "<a href='../../'>Please re-login the administrator<BR>";
exit;
}
include "../";
if ($submit){
if (!$username||!$name){           //Check whether to fill in the complete
echo "Sorry, you must fill in all items with *!<BR>"."<a href='javascript:()'>Return</a>";
      exit;
    }
$username=trim($username);
$psw=trim($psw);
$name=trim($name);
$birth=$year.'-'.$month.'-'.$day;
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
//Check whether this name has been registered
$result = mysql_query("SELECT name FROM user where name='$name'",$db);
if (mysql_num_rows($result)!=0){   
echo "This name has been registered!"."<a href='javascript:()'>Refill in</a>&nbsp;"."Forgot your password and ask your administrator for your password</a>";
exit;
}
//Check whether the user name is used
$result = mysql_query("SELECT user FROM user where user='$username'",$db);//If the number of returned columns is not 0, it means that this user name has been used by someone
if (mysql_num_rows($result)!=0){   
echo "This username has been used by someone!"."<a href='javascript:()'>Refill in</a>";
exit;
}
//Write to the database
  $sql="INSERT INTO user (user,psw,name,sex,birth,work,ad,post,ph,bp,email,oicq) VALUES ('$username','$psw','$name','$sex','$birth','$work','$ad','$post','$ph','$bp','$email','$oicq')";
$result = mysql_query($sql,$db);
mysql_close($db);
echo "Added successfully";
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE> Add a member </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<form method='post' action='<? echo $PHP_SELF;?>'>

  <table width="51%" border="1" cellspacing="1" cellpadding="0" align="center" bordercolor="#FFCC00">
    <tr>
            <td height="153" width="60%"><br>
username:
              <input type='Text' name='username' size='12' maxlength='12'>
              *<br>
(English letters or numbers, the length shall not exceed 12)<br>
password:
          <input type='password' name='psw' size='8' maxlength='8'>
              <br>
(English letters or numbers, no more than 8 characters)<br>
Name:
          <input type='Text' name='name' size='8' maxlength='8'>
          *<br>
Gender: Male
<input type='radio' name='sex' value='male' checked>
female
<input type='radio' name='sex' value='female'>
          <br>
Birthday:
          <select name='year'>
            <option selected>1991</option>
            <option>1990</option>
            <option>1989</option>
            <option>1988</option>
            <option>1987</option>
            <option>1986</option>
            <option>1985</option>
            <option>1984</option>
            <option>1983</option>
            <option>1982</option>
            <option>1981</option>
            <option>1980</option>
            <option>1979</option>
            <option>1978</option>
            <option>1977</option>
            <option>1976</option>
            <option>1975</option>
            <option>1974</option>
            <option>1973</option>
            <option>1972</option>
            <option>1971</option>
            <option>1970</option>
            <option>1969</option>
            <option>1968</option>
            <option>1967</option>
            <option>1966</option>
            <option>1965</option>
            <option>1964</option>
            <option>1963</option>
            <option>1962</option>
            <option>1961</option>
            <option>1960</option>
            <option>1959</option>
            <option>1958</option>
            <option>1957</option>
            <option>1956</option>
            <option>1955</option>
            <option>1954</option>
          </select>
Year
          <select name='month'>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
          </select>
moon
          <select name='day'>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
            <option>13</option>
            <option>14</option>
            <option>15</option>
            <option>16</option>
            <option>17</option>
            <option>18</option>
            <option>19</option>
            <option>20</option>
            <option>21</option>
            <option>22</option>
            <option>23</option>
            <option>24</option>
            <option>25</option>
            <option>26</option>
            <option>27</option>
            <option>28</option>
            <option>29</option>
            <option>30</option>
            <option>31</option>
          </select>
Day<br>
Working unit:
          <input type='Text' name='work' size='30' maxlength='50'>
          <br>
Mailing address:
          <input type='Text' name='ad' size='30' maxlength='50'>
          <br>
post code:
          <input type='Text' name='post' size='6' maxlength='6'>
          <br>
Telephone:
          <input type='Text' name='ph' size='15' maxlength='30'>
          <br>
Paging:
          <input type='Text' name='bp' size='15' maxlength='20'>
          <br>
          Email:  
          <input type='Text' name='email' size='15' maxlength='35'>
          <br>
          oicq:  
          <input type='Text' name='oicq' size='12' maxlength='12'>
          <br>
           </td> </tr> </table>
             <div align="center">
          <br>
<input type='Submit' name='submit' value='submit'>
<input type='reset' name='Reset' value='rewrite'>
        </div>
      </form>


</BODY>
</HTML>
Show and delete members: class/admin/
<?
session_start();
if(!session_is_registered("superlogin"))//Check whether to register
{
echo "<a href='../../'>Please re-login the administrator<BR>";
exit;
}
include "../";
if ($del==1){
mysql_query("delete from user where user='$user'",$db); //Delete
echo "Delete successfully!";}
?>
<html>
<head>
<title>Member List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="91%" border="0" cellspacing="0" cellpadding="0" height="139" align="center">
  <tr>  
    <td>  
      <div align="center"><img src="../image/" width="224" height="60"></div>
    </td>
  </tr>
  <tr>
    <td height="28">
<div align="center">Member list</div>
    </td>
  </tr>
  <tr>  
    <td height="163">
      <table width="95%" border="1" cellspacing="1" cellpadding="0">
        <tr>  
          <td>  
<div align="center">username</div>
          </td>
          <td>
<div align="center">Password</div>
          </td>
          <td>
<div align="center">name</div>
          </td>
          <td>
<div align="center">Delete</div>
          </td>
        </tr>
        <?
          $result = mysql_query("SELECT * FROM user",$db);
$row=mysql_num_rows($result);// Check how many rows there are in the result
           for ($i=0;$i<=($row-1);$i++) {
   $name=mysql_result($result,$i,'name');
   $user=mysql_result($result,$i,'user');
   $psw=mysql_result($result,$i,'psw');
   echo "<tr>";
   echo "<td>$name</td>";
   echo "<td>$psw</td>";
   echo "<td>$name</td>";
echo "<td><a href='$PHP_SELF?del=1&user=$user'>Delete</a></td>";
   echo "</tr>";  
        }
          ?>
        </table>
    </td>
  </tr>
</table>
</body>
</html>
Modify member information: class/admin/
<?
session_start();
if(!session_is_registered("superlogin"))//Check whether to register
{
echo "<a href='../../'>Please re-login the administrator<BR>";
exit;
}
?>
<html>
<head>
<title>Modify member information</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="editmember_step2.php">
  <table width="95%" border="0" cellspacing="0" cellpadding="0">
    <tr>  
      <td height="117" width="49%">  
Whose information do you want to modify? <br>
          <select name="member">
          <?php
            include "../";
            $result = mysql_query("SELECT * FROM user",$db);
$row=mysql_num_rows($result);// Check how many rows there are, that is, the number of members
            for ($i=0;$i<=($row-1);$i++){
             $name=mysql_result($result,$i,'name');
             echo "<option>",$name,"</option>";
            }
          ?>             
          </select>
          <br>
<input type="submit" name="Submit" value="OK">
<input type="reset" name="cancel" value="reset">
        </div>
      </td>
    </tr>
  </table>
</form>
</body>
</html>
Step 2 of modifying member information: class/admin/editmember_step2.php
<?
session_start();
if(!session_is_registered("superlogin"))//Check whether to register
{
echo "<a href='../../'>Please re-login the administrator<BR>";
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>Modify member information</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
include "../";
if ($submit){
$user=trim($username);
$psw=trim($psw);
$name=trim($name);
$birth=trim($birth);
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
$photoname=trim($photoname);
$account=strip_tags(trim($account));//Remove the beginning and end spaces and html tags
$signature=strip_tags(trim($signature));
//Write to the database
$sql="UPDATE user SET user='$user',psw='$psw',name='$name',sex='$sex',birth='$birth',work='$work',ad='$ad',post='$post',ph='$ph',bp='$bp',email='$email',oicq='$oicq',account='$account',signature='$signature',photo='$photoname',face='$face' where name='$member'";
$result = mysql_query($sql,$db);
mysql_close($db);
echo "Congratulations on the successful modification!";
exit;
}
$result = mysql_query("SELECT * FROM user where name='$member'",$db);
$user=mysql_result($result,0,"user");
$psw=mysql_result($result,0,"psw");
$sex=mysql_result($result,0,"sex");
$birth=mysql_result($result,0,"birth");
$work=mysql_result($result,0,"work");
$ad=mysql_result($result,0,"ad");
$post=mysql_result($result,0,"post");
$ph=mysql_result($result,0,"ph");
$bp=mysql_result($result,0,"bp");
$email=mysql_result($result,0,"email");
$oicq=mysql_result($result,0,"oicq");
$photo=mysql_result($result,0,"photo");
$account=mysql_result($result,0,"account");
$signature=mysql_result($result,0,"signature");
$photo=mysql_result($result,0,"photo");
$face=mysql_result($result,0,"face");
mysql_close($db);
?>
<table width='95%' border='0' cellspacing='0' cellpadding='0' align='center'>
  <tr>  
    <td colspan="2">  
      <div align="center"><img src="../image/" width="224" height="60"></div>
    </td>
  </tr>
  <tr>  
    <td>  
<div align="center">Modify member information</div>
    </td>
  </tr>
  <tr>  
    <td colspan="2">  
      <form method='post' action='<? echo $PHP_SELF,'?member=',$member;?>'>
        <table width="95%" border="1" cellspacing="1" cellpadding="0" align="center" bordercolor="#FFCC00">
          <tr>
            <td height="153" width="60%"><br>
username:
              <input type='Text' name='username' size='12' maxlength='12' value="<? echo $user;?>">
              <br>
(English letters or numbers, the length shall not exceed 12)<br>
password:
          <input type='password' name='psw' size='8' maxlength='8' value="<? echo $psw; ?>">
              <br>
(English letters or numbers, no more than 8 characters)<br>
Name:
          <input type='Text' name='name' size='8' maxlength='8' value="<? echo $member; ?>">
          *<br>
Gender: Male
<input type='radio' name='sex' value='male' <? if ($sex=='male'){echo "checked";} ?>>
female
<input type='radio' name='sex' value='female' <? if ($sex=='female'){echo "checked";} ?>>
          <br>
Birthday: <input type="text" name="birth" size="12" maxlength="12" value="<? echo $birth; ?>"><br>
Working unit:
          <input type='Text' name='work' size='30' maxlength='50' value="<? echo $work; ?>">
          <br>
Mailing address:
          <input type='Text' name='ad' size='30' maxlength='50' value="<? echo $ad; ?>">
              <br>
post code:
          <input type='Text' name='post' size='6' maxlength='6' value="<? echo $post; ?>">
          <br>
Telephone:
          <input type='Text' name='ph' size='15' maxlength='30' value="<? echo $ph; ?>">
              <br>
Paging:
          <input type='Text' name='bp' size='15' maxlength='20' value="<? echo $bp; ?>">
          <br>
          Email:  
          <input type='Text' name='email' size='15' maxlength='35' value="<? echo $email; ?>">
              <br>
          oicq:  
          <input type='Text' name='oicq' size='12' maxlength='12' value="<? echo $oicq; ?>">
              <br>
Personal photos:
              <input type='text' name='photoname' value="<? echo $photo; ?>">
              <br>
Personal description: (Showing in the address book, no more than 125 Chinese characters)<BR>
          <textarea name='account' cols='50' rows='5'><? echo $account; ?></textarea>
          <br>
Personal signature: (automatic signature in the guest book, no more than 125 Chinese characters)<br>
              <textarea name="signature" cols="50" rows="5"><? echo $signature; ?></textarea>
            </td>
            <td height="153" width="40%"><br>
Choose avatar you like:<br>
          <?
           for ($i=1;$i<=64;$i++){
            echo "<img src='../image/face/icon".$i.".gif' width='32' height='32'>";  
            echo "<input type='radio' name='face' value='$i' ";
            if ($face==$i){
            echo "checked";
            }
            echo ">";
if (($i%4)==0){ //Apart 4 lines, new lines
             echo "<br>";
            }
           }
           ?><br>
            </td>
          </tr>
        </table>
        <div align="center">
          <br>
<input type='Submit' name='submit' value='submit'>
<input type='reset' name='Reset' value='rewrite'>
        </div>
      </form>
    </td>
  </tr>
</table>
</BODY>
</HTML>