In this section, we put DELE. php and SYS. php.
---------
// DELE. php <HTML>
<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...