---------
//dele.php<html>

<head>
<title>刪除留言</title>
<style>
<!--
A:link {text-decoration: none ; color:0000ff}
A:visited {text-decoration: none; col " /> 成全电影大全在线观看,精品不卡视频,国产精品视频精品

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

一個(gè)php作的文本留言本的例子(四)

這一節(jié)我們將dele.php和sys.php放上來(lái).
---------
//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>密碼錯(cuò)誤</font>.無(wú)權(quán)操作..";}

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 "僅刪除回復(fù)";
     }
     ?>
        <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="我要?jiǎng)h除了">
      </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' "一欄中等號(hào)后的是留言本的管理密碼號(hào),此時(shí)是默認(rèn)的zihanonline.您可以修改為自己的號(hào)碼.
未完待續(xù)...

php技術(shù)一個(gè)php作的文本留言本的例子(四),轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 纳雍县| 石泉县| 商南县| 涿鹿县| 铁岭市| 东源县| 周至县| 郑州市| 汪清县| 和田县| 灵川县| 青铜峡市| 新巴尔虎右旗| 于都县| 边坝县| 锦州市| 长泰县| 清苑县| 舒城县| 双辽市| 南城县| 杨浦区| 凤阳县| 磐安县| 务川| 开封市| 塔城市| 阜宁县| 剑川县| 湘潭县| 应用必备| 阿拉善左旗| 开平市| 蒲城县| 北京市| 兖州市| 临澧县| 连城县| 英吉沙县| 田东县| 上虞市|