分享
 
 
 

PHP+TEXT留言本(四)

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

這一節我們將dele.php和sys.php放上來.

---------

//dele.php<html>

<head>

<title>刪除留言</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>密碼錯誤</font>.無權操作..";}

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 ?>

<tr align="center">

<td height="37" bgcolor="#f0f0f0">

<?

if ($found)

{

echo "<input type=radio name=dele value=delall>";

echo "全部刪除 ";

echo "<input type=radio name=dele value=delreply checked>";

echo "僅刪除回復";

}

?>

<font color="#000000">管理密碼</font>

<input type="password" name="password" size="10">

<input type=hidden name=record value=<? echo "$record";?>>

<input type="submit" name="Submit" value="我要刪除了">

</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">

----------

註意sys.php中的" $managepwd='zihanonline' "一欄中等號後的是留言本的管理密碼號,此時是默認的zihanonline.您可以修改為自己的號碼.

未完待續...

 
 
 
免責聲明:本文為網絡用戶發布,其觀點僅代表作者個人觀點,與本站無關,本站僅提供信息存儲服務。文中陳述內容未經本站證實,其真實性、完整性、及時性本站不作任何保證或承諾,請讀者僅作參考,並請自行核實相關內容。
這一節我們將dele.php和sys.php放上來. --------- //dele.php<html> <head> <title>刪除留言</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>密碼錯誤</font>.無權操作..";} 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 ?> <tr align="center"> <td height="37" bgcolor="#f0f0f0"> <? if ($found) { echo "<input type=radio name=dele value=delall>"; echo "全部刪除 "; echo "<input type=radio name=dele value=delreply checked>"; echo "僅刪除回復"; } ?> <font color="#000000">管理密碼</font> <input type="password" name="password" size="10"> <input type=hidden name=record value=<? echo "$record";?>> <input type="submit" name="Submit" value="我要刪除了"> </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"> ---------- 註意sys.php中的" $managepwd='zihanonline' "一欄中等號後的是留言本的管理密碼號,此時是默認的zihanonline.您可以修改為自己的號碼. 未完待續...
美眾議院議長啟動對拜登的彈劾調查
 百态   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- 王朝網路 版權所有