Example of a text message in PHP (iv)

Source: Internet
Author: User
Tags count include ord php and strlen
We'll put dele.php and sys.php up in this section.
---------
Dele.php
<title> Delete 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 ">
?

Require ("sys.php");
if ($Submit)
{

if ($password <> $managepwd)
{$errorm = "<font color=red> password error </font>. Not authorized to operate ...";}

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 for
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?>
&LT;TR align= "center" >
&LT;TD height= "Notoginseng" 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" > Admin password </font>
<input type= "password" name= "password" size= "ten" >
<input Type=hidden Name=record value=<? echo "$record";? >>
<input type= "Submit" name= "Submit" value= "I'm going to delete" >
</td>
</tr>
</form>
</table>
? Include ("bottom.htm");?>
</body>

------
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 the sys.php in the "$managepwd = ' zihanonline '" column in the sign is the message of the management password number, this is the default zihanonline. You can modify your own number.
Not 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.