Example of a text message in PHP (c)
Last Update:2017-02-28
Source: Internet
Author: User
In the last two sections I spoke about guest.php and edit.php. Note the difference between PHP and HTML:
PHP is usually--> (1). Echo ("Zihanonline");? >
(2) PHP
Echo ("Zihanonline");
?>
(3) <script laanguage= "PHP" >
Echo ("Zihanonline");
</script>
(4) <% echo ("Zihanonline");%>
, etc. 4 ways. Don't confuse it.
below we'll look at information management: manage.php code.
-----------
//manage.php<html>
<head>
<title> message Management </title>
<meta http-equiv= "Content-type" content= "text/html"; charset=gb2312 ">
<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:9p}
TH {font-size:9pt}
TD {font-size:9pt}
-->
</style>
</head>
<body bgcolor= "#FFFFFF" background= "Back.gif" >
;?
include (' head.htm ');
include ("sys.php");
if ($password!= $managepwd and $dispflag)
{
echo "<meta http-equiv=refresh content=5;url=guest.php>";
echo "<center>";
echo "<font color=red> password Error! Cannot delete message!</font>";
echo "<p> program will return in 3 seconds </p>";
echo "<p> <a href=http://zihanonline.longcity.net> son Han online </a> owner Maintenance management. </p> ";
echo "<br>";
echo "</center>";
exit;
}
?>
<table width= "445" border= "0" align= "center" bgcolor= "#CCCCCC" >
<form method= "POST" action= "manage.php" >
;?
if ($dispflag = = "Show")
{
$content = file ($guestfile);
$count =count ($content);
$text = "";
for ($h = $count; $h >0; $h-)
{
$text = $text. ' <tr><td> delete the '. $h. Message: <input type=checkbox name=check$h value= $h ></td></tr>nn ";
$text = $text. $content [$h-1];
}
echo "$text";
}
?>
<input Type=hidden Name=password value=<? echo $password?>>
;?
if ($submit)
{
if ($password!= $managepwd)
{
echo "<meta http-equiv=refresh content=5;url=guest.php>";
echo "<center>";
echo "<font color=red> password Error! Cannot delete message!</font>";
echo "<p> program will return in 3 seconds </p>";
echo "<p> <a href=http://zihanonline.longcity.net> son Han online </a> owner Maintenance management. </p> ";
echo "<br>";
echo "</center>";
exit;
}
if ($password = = $managepwd)
{
$guest _content=file ($guestfile);
$count =count ($guest _content);
for ($j =1; $j <= $count; $j + +)
{
$del _rec_num= "Check". $j;
$del _num=$ $del _rec_num;
//echo "$del _num: $del _num";
$guest _content[$del _num-1]= "";
}
$fp =fopen ($guestfile, "w");
for ($i =0 $i <= $count-1; $i + +)
{
if ($guest _content[$i]!= "")
{
fputs ($fp, $guest _content[$i],strlen ($guest _content[$i]));
}
}
fclose ($FP);
echo "<meta http-equiv=refresh content=5;url=guest.php>";
echo "<center>";
echo "<p><font color=red> message has been correctly deleted </font></p>";
echo "<p> program will return in 3 seconds </p>";
echo "<p> <a href=http://zihanonline.longcity.net> son Han online </a> owner Maintenance management. </p> ";
echo "<br>";
echo "</center>";
exit;
}
}
?>
<tr>
<td bgcolor= "#f0f0f0" >
<p align=center>
<input type=submit value= Delete name=submit>
<input type=reset value= rewrite name=reset>
</td>
<tr>
</form>
</table>
<?include (' bottom.htm ');? >
</body>
</html>
------------
to be Continued ...