分享
 
 
 

PHP+TEXT留言本(三)

王朝php·作者佚名  2008-12-28
窄屏简体版  字體: |||超大  

上兩節我針對guest.php和edit.php作了講述.需要註意的是php和html的區別:

php通常是-->(1)<? echo("zihanonline");?>

(2)<? php

echo("zihanonline");

?>

(3)<script laanguage="php">

echo("zihanonline");

</script>

(4)<% echo("zihanonline");%>

等4種方式.不要混淆.

下面我們來研究信息管理:manage.php代碼.

-----------

//manage.php<html>

<head>

<title>留言管理</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>密碼錯誤!無法刪除留言!</font>";

echo "<p>程序將在3秒返回</p>";

echo "<p> <a href=http://zihanonline.longcity.net>子漢在線</a>斑竹維護管理。</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>刪除第'.$h."條留言:<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>密碼錯誤!無法刪除留言!</font>";

echo "<p>程序將在3秒返回</p>";

echo "<p> <a href=http://zihanonline.longcity.net>子漢在線</a>斑竹維護管理。</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>留言已正確刪除</font></p>";

echo "<p>程序將在3秒返回</p>";

echo "<p> <a href=http://zihanonline.longcity.net>子漢在線</a>斑竹維護管理。</p>";

echo "<br>";

echo "</center>";

exit;

}

}

?>

<tr>

<td bgcolor="#f0f0f0">

<p align=center>

<input type=submit value=刪除 name=submit>

    

<input type=reset value=重寫 name=reset>

</td>

<tr>

</form>

</table>

<?include('bottom.htm');?>

</body>

</html>

------------

未完待續...

 
 
 
免責聲明:本文為網絡用戶發布,其觀點僅代表作者個人觀點,與本站無關,本站僅提供信息存儲服務。文中陳述內容未經本站證實,其真實性、完整性、及時性本站不作任何保證或承諾,請讀者僅作參考,並請自行核實相關內容。
上兩節我針對guest.php和edit.php作了講述.需要註意的是php和html的區別: php通常是-->(1)<? echo("zihanonline");?> (2)<? php echo("zihanonline"); ?> (3)<script laanguage="php"> echo("zihanonline"); </script> (4)<% echo("zihanonline");%> 等4種方式.不要混淆. 下面我們來研究信息管理:manage.php代碼. ----------- //manage.php<html> <head> <title>留言管理</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>密碼錯誤!無法刪除留言!</font>"; echo "<p>程序將在3秒返回</p>"; echo "<p> <a href=http://zihanonline.longcity.net>子漢在線</a>斑竹維護管理。</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>刪除第'.$h."條留言:<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>密碼錯誤!無法刪除留言!</font>"; echo "<p>程序將在3秒返回</p>"; echo "<p> <a href=http://zihanonline.longcity.net>子漢在線</a>斑竹維護管理。</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>留言已正確刪除</font></p>"; echo "<p>程序將在3秒返回</p>"; echo "<p> <a href=http://zihanonline.longcity.net>子漢在線</a>斑竹維護管理。</p>"; echo "<br>"; echo "</center>"; exit; } } ?> <tr> <td bgcolor="#f0f0f0"> <p align=center> <input type=submit value=刪除 name=submit> &nbsp;&nbsp;&nbsp;&nbsp; <input type=reset value=重寫 name=reset> </td> <tr> </form> </table> <?include('bottom.htm');?> </body> </html> ------------ 未完待續...
美眾議院議長啟動對拜登的彈劾調查
 百态   2023-09-13
上海、濟南、武漢等多地出現不明墜落物
 探索   2023-09-06
印度或要將國名改為「巴拉特」
 百态   2023-09-06
男子為女友送行,買票不登機被捕
 百态   2023-08-20
手機地震預警功能怎麽開?
 干货   2023-08-06
女子4年賣2套房花700多萬做美容:不但沒變美臉,面部還出現變形
 百态   2023-08-04
住戶一樓被水淹 還衝來8頭豬
 百态   2023-07-31
女子體內爬出大量瓜子狀活蟲
 百态   2023-07-25
地球連續35年收到神秘規律性信號,網友:不要回答!
 探索   2023-07-21
全球鎵價格本周大漲27%
 探索   2023-07-09
錢都流向了那些不缺錢的人,苦都留給了能吃苦的人
 探索   2023-07-02
倩女手遊刀客魅者強控制(強混亂強眩暈強睡眠)和對應控制抗性的關系
 百态   2020-08-20
美國5月9日最新疫情:美國確診人數突破131萬
 百态   2020-05-09
荷蘭政府宣布將集體辭職
 干货   2020-04-30
倩女幽魂手遊師徒任務情義春秋猜成語答案逍遙觀:鵬程萬裏
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案神機營:射石飲羽
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案昆侖山:拔刀相助
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案天工閣:鬼斧神工
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案絲路古道:單槍匹馬
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案鎮郊荒野:與虎謀皮
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案鎮郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案鎮郊荒野:指鹿為馬
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案金陵:小鳥依人
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案金陵:千金買鄰
 干货   2019-11-12
倩女幽魂手遊師徒任務情義春秋猜成語答案金陵:倒履相迎
 干货   2019-11-12
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有