PHP + text message book (4)

Source: Internet
Author: User

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, the "$ managepwd = zihanonline" column contains the middle number and the management password of the message book. In this case, it is the default zihanonline. You can change it to your own number.
To be continued...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.