php制作文本式留言板
php  /  管理员 发布于 7年前   112
代码很简单,就不多废话了,直接奉上代码: del.php doAdd.php index.php liuyan.txt show.php menu.php 以上所述就是本文的全部内容了,希望大家能够喜欢。 122 在 123 在 原梓番博客 在 博主 在 1111 在
删除留言
$id=$_GET["id"];
$info=file_get_contents("liuyan.txt");
$lylist=explode("@@@", $info);
unset($lylist[$id]);
$ninfo=implode("@@@", $lylist);
file_put_contents("liuyan.txt", $ninfo);
$alert="alert('删除成功!')";
echo "";
?>
添加留言
//获取留言板的信息
$title=$_POST["title"];
$author=$_POST["author"];
$content=$_POST["content"];
$time=time();
$ip=$_SERVER["REMOTE_ADDR"];
$ly="{$title}##{$author}##{$content}##{$time}##{$ip}@@@";
echo $ly;
$ly=$ly.file_get_contents("liuyan.txt");
file_put_contents("liuyan.txt",$ly);
$alert="alert('留言成功!谢谢!')";
echo ";"
?>
添加留言
安神######1426588557##127.0.0.1@@@
添加留言
留言标题
留言人
留言内容
留言时间
IP地址
操作
$info=file_get_contents("liuyan.txt");
if($info==null){
$alert="alert('无留言信息!')";
echo "";
}
else{
$info=rtrim($info,"@");
$lylist=explode( "@@@",$info);
foreach ($lylist as $key=>$v) {
$ly=explode("##",$v );
echo ""; ";
echo "$ly[0] ";
echo "$ly[1] ";
echo "$ly[2] ";
echo "".date("Y-m-d H:i:s",$ly[3]+8*3600)." ";
echo "$ly[4] ";
echo "删除 ";
echo "
}
}
?>
我的留言板
添加留言
查看留言
您可能感兴趣的文章:
上一条:
php通过ksort()函数给关联数组按照键排序的方法
下一条:
php防止sql注入简单分析
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号