【php开源代码栏目提醒】:以下是网学会员为您推荐的php开源代码-reply.php,希望本篇文章对您学习有所帮助。
<?php
// 包含数据库连接文件
require ('dbconnect.php');
?>
<?
// 取得html页的参数
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$gender=$_POST['select'];
$title=$_POST['title'];
$content=$_POST['content'];
$hideip=$_POST['checkbox'];
// 获得网页传递的参数
$firstmesid=$_POST[firstmesid];
$lastmesid=$_POST[lastmesid];
//echo "Email:".$email;
//echo "gender:".$gender;
//echo "content:".$content;
//echo "hideip:".$hideip;
// echo "firstmesid:".$firstmesid;
// 得到登录ip.
$ip=getenv (REMOTE_ADDR);
// 取得当前时间和日前
$now = date("Y-m-d H:i:s");
// 加密密码
$password=md5($pass
word);
// 回复留言写入数据库表
$strsql="insert into guestbook (username, password, gender, email, title, content, posttime, ip, hideIP, firstMesID, lastMesID ) values('$username', '$password', '$gender', '$email', '$title', '$content', '$now', '$ip', '$hideip', '$firstmesid', '$lastmesid')";
mysql_query($str
sql,$conn) or die ("插入数据失败: ".
mysql_error());
// 关闭连接
mysql_close($conn);
// print "GOOD!";
// 重定向到contents.php,重新显示发言内容
header("Location:display.php?mesid=$firstmesid");
?>