留言本php源码(留言源码php源码)
华为云服务器特价优惠火热进行中! 2核2G2兆仅需 38 元;4核4G3兆仅需 79 元。购买时间越长越优惠!更多配置及优惠价格请咨询客服。
合作流程: |
今天给各位分享留言本php源码的知识,其中也会对留言源码php源码进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
微信号:cloud7591如需了解更多,欢迎添加客服微信咨询。
复制微信号
本文目录一览:
在网上下载的PHP留言板源码 要怎样才能浏览它整站的一个效果呢/ PHP文件都是分开编写的
你搭建一个php环境,实在不会可以下载一个wamp集成安装,然后把这个项目全部放在一个文件夹里,之后放在wamp安装目录下一个www的文件夹里。之后通过浏览器,输入:localhost,点击你新建的那个文件夹就可以
php留言本代码! 【求详细解析】谢谢
没有注释的php部分我都写了注释,html不用教吧
?
//Chap25 留言本
$fileName="data.txt";//数据保存文件名
if($action == "send")//判断用户是否提交数据
{
$message = ereg_replace("\r\n", "br", $message);//回车替换成html的换行标签
$message = ereg_replace(" ", " ", $message);//一个空格替换成两个空格,莫名,而且为什么不是str_replace,效率啊效率,这多少年前的代码
$Today = date("F dS, Y");//取当天日期
$data =$name."\r\n".$Today."\r\n".$message."\r\n";//代码不完整,我不知道name是谁送来的
$fileContent = fopen("$fileName","a");//打开数据保存的文件,以只写方式
if(chop($name)!="" Chop($message)!="")//已经有注释了
//删除字符串结尾的空白字符
{
fwrite($fileContent,"$data");//写入数据
fclose($fileContent);//关闭文件句柄
}
$action ="";//清空$action变量,避免影响下面的提交页面
}
?
html
head
titleGB/title
/head
body bgcolor=#ffffff text="#333333"
?
if(file_exists($fileName))//如果文件存在,执行:
{
$fileMessage=file($fileName);
//将文件$fileName中所有内容读入数组$fileName
//一行内容保存在一个数组元素中
}
$count=count($fileMessage)/3;
//计算地址薄条目的数目,三行字符表示一个地址簿条目
?
table width="99%" border="0" bgcolor="#ffefb0"
?
print(" trtd colspan=\"2\"bgcolor=\"#fffae6\"留言数:".$count."/td/tr\r\n");
for($i=0; $fileMessage[$i]!="";)//显示所有留言
{
print("tr\r\n");
print(" td");
print(" Name: font color=\"#ff0000\"".$fileMessage[$i++]."/font/td\r\n");
print(" tddiv align=\"right\"font color=\"#777777\"'.$fileMessage[$i++]."/font/div/td");
print("/tr\r\ntr\r\n");
print(" td colspan=\"2\" bgcolor=\"#fffae6\"");
print(" Message: brfont color=\"#0000cc\"".$fileMessage[$i++]."/font/td\r\n");
print("/tr\r\n");
}
?
/table
form action="exa10-1.php" method="POST" target="_self"
input type="hidden" name="action" value="send"
姓名:br
input name="name" size=30 maxlength=15br
textarea name="message" rows="12" cols="51"/textareabr
input type="submit" value="发出留言"br
/form
/body
/html

谁能提供一个PHP留言板源码
input.htm
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
titleinput/title
/head
body
form method="POST" action="receive.php"
p您的姓名: input type="text" name="T1" size="20"/p
p您的性别:男input type="radio" value="0" name="R1"
女input type="radio" name="R1" value="1"/p
p您的EMAIL:input type="text" name="T2" size="35"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45"/textarea/p
p /p
p input type="submit" value="提交" name="B1"
input type="reset" value="重置" name="B2"/p
/form
/body
/html
receive.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$ip=getenv(REMOTE_ADDR);
$sql = "INSERT INTO `guestbook`.`gbook` (`id`, `name`, `sex`, `email`, `info`, `ip`, `time_at`) VALUES (NULL, '$T1', '$R1', '$T2', '$S1', '$ip', NOW());";
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
mysql_query($sql);
$result=mysql_query("select * from $table");
while ($arr=mysql_fetch_array($result))
{
if ($arr[2]==0)
$gender='先生';
else
$gender='女士';
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
titleReceive/title
/head
body style="background-attachment: fixed"
table border="1" width="100%" id="table1" bgcolor="#FFFFFF"
tr
td bordercolor="#FFFFFF" bgcolor="#C0C0C0"?=$arr[6]?(?=$arr[5]?)p?=$arr[1]? ?=$gender?a href="?=$arr[3]?"?=$arr[3]?/a
写到:/td
/tr
tr
td?=$arr[4]?p /p
pa href="del.php?id=?=$arr[0]?"[删除]/a
a href="modify.php?id=?=$arr[0]?"[修改]/a]/td
/tr
/table
/body
/html
?php
echo 'p';
echo 'p';
}
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title新建网页 1/title
/head
body
pa href="input.htm"继续留言/a/p
/body
/html
del.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$sql="DELETE FROM $table WHERE id=$id";
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
$result=mysql_query($sql);
if ($result)
echo "删除成功";
else
echo "删除失败";
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title新建网页 1/title
/head
body
pa href="receive.php"返回首页/a/p
/body
/html
modify.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$ip=getenv(REMOTE_ADDR);
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
$result=mysql_query("select * from $table where id=$id");
$arr=mysql_fetch_array($result);
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
titleinput/title
/head
body
form method="POST" action="modify_ok.php?id=?=$id?"
p您的姓名: input type="text" name="T1" size="20" value="?=$arr[1]?"/p
p您的性别:
?php
if ($arr[2]==0) echo '男input type="radio" value="0" name="R1" checked
女input type="radio" name="R1" value="1"/p';
else echo '男input type="radio" value="0" name="R1"
女input type="radio" name="R1" value="1" checked/p';
?
p您的EMAIL:input type="text" name="T2" size="35" value="?=$arr[3]?"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45" ?=$arr[4]?/textarea/p
p /p
p input type="submit" value="修改" name="B1"
input type="reset" value="重置" name="B2"/p
/form
/body
/html
modify_ok.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);;
$sql = "UPDATE `guestbook`.`gbook` SET `name` = '$T1', `sex` = '$R1', `email` = '$T2', `info` = '$S1' WHERE `gbook`.`id` = '$id' LIMIT 1;";
$result=mysql_query($sql);
if ($result)
echo "修改成功";
else
echo "修改失败";
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title新建网页 1/title
/head
body
pa href="input.htm"继续留言/a/p
/body
/html
关于留言本php源码和留言源码php源码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
