php makes text message board, php text message board
The code is very simple, no more nonsense, just give the code:
del.php
Copy code The code is as follows:
My Message Board
Delete message
$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('Delete successfully!')";
echo "<script>".$alert."</script>";
?>
doAdd.php
Copy code The code is as follows:
My Message Board
Add a message
//Get message board information
$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('Message successfully! Thank you!')";
echo "<script>".$alert."</script>;"
?>
index.php
Copy code The code is as follows:
My Message Board
Add a message
liuyan.txt
Copy code
The code is as follows:
Anshen######1426588557##127.0.0.1@@@
show.php
Copy code The code is as follows:
My Message Board
Add a message
& Lt; th & gt; message content & lt;/th & gt;
$info=file_get_contents("liuyan.txt");
If($info==null){
$alert="alert('No message!')";
echo "<script>".$alert."</script>";
}
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 "Delete | ";
echo "
";
}
}
?>
menu.php
Copy code
The code is as follows:
My Message Board
Add a message
View messages
The above is the entire content of this article, I hope you all like it.
http://www.bkjia.com/PHPjc/969493.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/969493.html
TechArticlephp makes a text message board. The code of the php text message board is very simple. No more nonsense. I will give it directly. Code: del.php Copy the code as follows: html head meta charset="utf-8" titl...