In this section, we put dele. php and sys. php.
---------
// Dele. php
<Head>
<Title> delete a message </title>
<Style>
<! --
A: link {text-decoration: none; color: 0000ff}
A: visited {text-decoration: none; color: 004080}
A: active {text-decoration: none}
A: hover {text-decoration: underline; color: ff0000}
BODY {FONT-SIZE: 10pt}
TH {FONT-SIZE: 10 pt}
TD {FONT-SIZE: 10pt}
-->
</Style>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</Head>
<?
Require ("sys. php ");
If ($ Submit)
{
If ($ password <> $ managepwd)
{$ Errorm = "<font color = red> incorrect password </font>. No operation permission ..";}
Else
{
$ Content = file ($ guestfile );
$ Message = $ content [$ record-1];
$ Count = count ($ content );
If ($ dele = "delreply ")
{
$ Replylen = strlen (strstr ($ message, "<! -- Reply> "));
$ Long = strlen ($ message );
$ Len = $ long-$ replylen;
$ Message = substr ($ message, 0, $ len );
}
Else
{$ Message = "";}
// Writefile
$ Fp = fopen ($ guestfile, "w ");
For ($ I = 0; $ I <$ count; $ I ++)
{
If ($ I = ($ record-1) {$ content [$ I] = $ message ;}
Fputs ($ fp, $ content [$ I], strlen ($ content [$ I]);
} // End
Fclose ($ fp );
Echo "<meta http-equiv = Refresh content =" 1; url = guest. php "> ";
Exit;
}
} // End ifSubmit
$ Content = file ($ guestfile );
$ Message = $ content [$ record-1];
$ Found = ereg ("<! -- Reply> ", $ message );
?>
<Body bgcolor = "# FFFFFF" background = "back.gif">
<? Include ("head.htm");?>
<Table width = "68%" border = "1" cellpadding = "5" align = "center" cellspacing = "0" bordercolor = "# F2F2F2">
<Form action = dele. php method = post>
<?
If ($ errorm)
{
Echo "<tr> ";
Echo "<td height = 27> $ errorm </td> ";
Echo "</tr> ";
}
?>
<? Echo $ message?>
<Tr align = "center">
<Td height = "37" bgcolor = "# f0f0f0">
<?
If ($ found)
{
Echo "<input type = radio name = dele value = delall> ";
Echo "delete all ";
Echo "<input type = radio name = dele value = delreply checked> ";
Echo "delete reply only ";
}
?>
<Font color = "#000000"> password management </font>
<Input type = "password" name = "password" size = "10">
<Input type = hidden name = record value = <? Echo "$ record" ;?>>
<Input type = "submit" name = "Submit" value = "I want to delete">
</Td>
</Tr>
</Form>
</Table>
<? Include ("bottom.htm");?>
</Body>
</Html>
------
// Sys. php
<Title> zihanonline </title> <?
$ Managepwd = 'zihanonline ';
$ Guestfile = "guest.txt ";
Function check_strlen_long ($ txt)
{
$ Count = 0;
$ Arrtemp = $ txt;
$ Len = strlen ($ txt );
$ Txt = $ txt .'';
For ($ I = 0; $ I <$ len; $ I ++)
{
If (ord ($ txt [$ I]) <128)
{$ Count = $ count + 1 ;}
If (ord ($ txt [$ I]) = 10 or ord ($ txt [$ I]) = 32)
{$ Count = 0 ;}
If ($ count> = 70)
{
For ($ j = $ I; $ j <$ len; $ j ++)
{
$ Txt [$ j + 1] = $ arrtemp [$ j];
}
$ Txt [$ I] = "n ";
$ Len = $ len + 1;
$ Txt [$ len] = $ arrtemp [$ len-1];
$ Count = 0;
$ Arrtemp = $ txt;
} // End if count
}
$ Txt = trim ($ txt );
Return $ txt;
} // End function
Function encode ($ txt)
{
$ Txt = strip_tags ($ txt );
$ Txt = htmlspecialchars ($ txt );
$ Message = StripSlashes ($ txt );
Return $ message;
}
Function ubb ($ txt)
{
}
?>
<Body bgcolor = "# FFFFFF" background = "back.gif">
----------
Note that in sys. php, "$ managepwd = 'zihanonline'" is followed by the management password of the message book, which is the default zihanonline. You can change it to your own number.
To be continued...