PHP FORUM
1.index.php
<html>
<!--功能:php论坛标题部分-->
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>论坛首页</title>
<style type="text/css" media="all">
body { margin:0px; padding:0px; font:12px verdana, arial, helvetica, sans-serif;}
td, legend{ font-size:14px; line-height:16px;}
p { font-size:12px;}
<!-- HTML头样式 -->
#Header { margin:10px 0px 10px 0px; padding:10px 8px 8px 20px; border-style:solid;
border-color:green; background-color:#eee; font-size:14px; height:14px;
}
<!--HTML正文内容样式 -->
#Content { margin:5px; width:100%; padding:10px;}
</style>
</head>
<body>
<center>
<h1>论坛首页</h1>
</center>
<!-- 头开始 -->
<div id="Header">
<?php
include "config.inc.php";
//判断用户是否登录,从而显示不同的导航界面
if($_SESSION['username'])
{
?>
<!-- 用户登录后的导航条 -->
<strong><?php echo $_SESSION['username']; ?>,欢迎登录</strong> |
<a href="main_forum.php">主页</a> |
<a href="edit_profile.php">个人资料</a> |
<a href="logoff_user.php">退出论坛</a>
<?php } else { ?>
<!-- 用户未登录的导航条 -->
<a href="main_forum.php">主页</a> |
<a href="create_user.php">注册</a> |
<a href="logon_forum.php">登录</a>
<?php
}//判断结束
?>
<br>
</div>
<!-- 头结束 -->
<!-- 正文内容开始 -->
<div id="Content">
2.main_forum.php
<?php
//**************************************
//* 功能:论坛主页面
//**************************************
require('config.inc.php');
//取得当前页数
$page=$_GET['page'];
//每页最多显示的记录数
$each_page = EACH_PAGE;
//计算页面开始位置
if(!$page || $page == 1)
{
$start = 0;
}else{
$offset = $page - 1;
$start = ($offset * $each_page);
}
?>
<h2>
论坛主页
<a href="edit_profile.php">个人资料</a>
<a href="logoff_user.php">注销用户</a>
<form action="main_search.php" method="post">
<input type="text" name="keys">
<input type="submit" name="subs" value="Search Topic">
</form>
</h2>
<?php
//检索记录,按照置顶标记和时间排序
$sql = "SELECT * FROM forum_topic
ORDER BY sticky DESC, datetime DESC LIMIT $start, $each_page";
$result = mysql_query($sql);
?>
<table width="100%" border="0" align="center"
cellpadding="3" cellspacing="1" bgcolor="#111">
<tr bgcolor="#E6E6E6">
<td width="60%" align="center"><strong>帖子</strong></td>
<td width="8%" align="center"><strong>访问量</strong></td>
<td width="8%" align="center"><strong>回复数</strong></td>
<td width="24%" align="center"><strong>日期</strong></td>
</tr>
<?php
//循环输出输出记录列表
while($rows=mysql_fetch_array($result))
{
?>
<tr bgcolor="#FFFFFF">
<td>
<?php
//如果是“置顶”的记录
if ($rows['sticky'] == "1")
{
?><img src="sticky.jpg" alt="置顶" border="0"><?php
}
//如果是“锁定”的记录
if ($rows['locked'] == "1")
{
?><img src="lock.jpg" alt="锁定" border="0"><?php
}
?>
<a href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['topic']; ?></a>
</td>
<td align="center">
<?php
echo $rows['view']; //浏览量
?>
</td>
<td align="center">
<?php
echo $rows['reply']; //回复量
?>
</td>
<td align="center">
<?php
echo $rows['datetime']; //日期
?>
</td>
</tr>
<?php
} //退出while循环
?>
<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6">
<input type="button" onClick="location.href='create_topic.php'" value="创建新帖子">
</td>
</tr>
</table>
<?php
//计算前一页
if($page > 1)
{
$prevpage = $page - 1;
}
//当前记录
$currentend = $start + EACH_PAGE;
//取得所有的记录数
$sql = "SELECT COUNT(*) FROM forum_topic";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
$total = $row[0];
//计算后一页
if($total>$currentend)
{
if(!$page){
$nextpage = 2;
}else{
$nextpage = $page + 1;
}
}
?>
</p>
<p style="text-align: right;">
<?php
//判断分页并输出
if ($prevpage || $nextpage)
{
//前一页
if($prevpage)
{
echo "<a href=\"?page={$prevpage}\"><< 前一页</a> ";
}else{
echo " ";
}
//后一页
if($nextpage)
{
echo "<a href=\"?page={$nextpage}\">后一页 >></a> ";
}else{
echo " ";
}
}
?>
</p>
<h3 align="right">标志</h3>
<p align="right">
<img src="sticky.jpg" alt="Sticky" border="0" align="absmiddle"> 置顶的帖子<br/><br/>
<img src="lock.jpg" alt="Locked" border="0" align="absmiddle"> 锁定的帖子<br/><br/>
<?php
//检索在线用户
$sql = "SELECT COUNT(*) FROM forum_user";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
$total_user = $row[0];
?>
共有<b><?php echo $total_user ?></b>位注册的用户。</p>
<?php
//公用尾部页面
include('footer.inc.php')
?>
3.main_search.php
<?php
session_cache_limiter('private, must-revalidate');
require "config.inc.php";
if(!empty($_POST['keys'])){
$w="`topic` like '%".$_POST['keys']."%'";
}else{
$w=1;
}
$sear="select * from `forum_topic` where $w order by id desc limit 10";
$query=mysql_query($sear);
if($w!=1){
while($rs=mysql_fetch_array($query)){
echo "Post Man: ".$rs['name']."<br/>";
echo "Topic: ";
?>
<a href="view_topic.php?id=<?php echo $rs['id']; ?>"><?php echo $rs['topic']; ?></a>
<?php
echo "<br/>"."<br/>";
}
}else{
echo "<a href='main_forum.php'>go back</a>";
}
?>
4.view_profile.php
<?php
include "config.inc.php";
include "header.inc.php";
$id=$_GET['id'];
$sql="select username,email,realname,regdate from forum_user where username='$id'";
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs);
if(isset($row)){
echo "username: ".$row['username']."<br/>";
echo "email: ".$row['email']."<br/>";
echo "realname: ".$row['realname']."<br/>";
echo "register date: ".$row['regdate']."<br/>";
echo "<a href='main_forum.php'><font size='5'>go back</font></a>";
}else{
echo "查询数据库出错!";
}
?>
5.logoff_user.php
<?php
session_start();
//从session中获取登录用户名
$username=$_SESSION["username"];
//删除所有Session的变量
$_SESSION=array();
//判断是否是使用基于Cookie的Session,删除包含Session ID的Cookie
if(isset($_COOKIE[session_name()])){
setcookie(session_name(),'',time()-42000,'/');
}
//彻底销毁Session
session_destroy();
?>
<html>
<head>
<title>退出论坛</title>
</head>
<body>
<p><?php echo $username?> Bye!</p>
<p>请点击<a href="index.php">这里</a>注销并退出。</p>
</body>
</html>
6.view_topic.php
<?php
//**************************************
//* 功能:文章详细页面
//**************************************
require('config.inc.php');
//根据ID取得贴子记录
$id=$_GET['id'];
$sql="SELECT * FROM forum_topic WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
//记录不存在
if (!$rows)
{
ExitMessage("该贴记录不存在!", "main_forum.php");
}
//置顶标记
$sticky=$rows['sticky'];
?>
<?php include('header.inc.php'); ?>
<h2><? echo $rows['topic']; ?></h2>
<em class="info">
<a href="view_profile.php?id=<?php echo $rows['name']; ?>">
<? echo $rows['name']; ?></a> 于 <? echo $rows['datetime']; ?>
创建
</em>
<p>
<?php
//输出整理好的内容
echo nl2br(htmlspecialchars($rows['detail']));
?>
</p>
<?php if ($rows['locked']) { $locked = 1; } ?>
<hr size=1 />
<dl>
<?php
//获取回复内容
$sql ="SELECT * FROM forum_reply WHERE topic_id='$id'";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if ($num_rows)
{
//循环取出记录内容
while($rows=mysql_fetch_array($result))
{
?>
<dt>
<a href="view_profile.php?id=<?php echo $rows['reply_name']; ?>">
<? echo $rows['reply_name']; ?>
</a>
- <em><?php echo $rows['reply_datetime']; ?></em>
</dt>
<dd>
<p><?php
//输出整理好的内容
echo nl2br(htmlspecialchars($rows['reply_detail']));
?></p>
</dd>
<?
}//结束循环
}else{
echo "<p><strong>没有跟贴记录。</strong></p>";
}
//浏览量加1
$sql = "UPDATE forum_topic set view=view+1 WHERE id='$id'";
$result = mysql_query($sql);
?>
</dl>
<!--内容回复表单,开始-->
<fieldset>
<legend>贴子回复</legend>
<?php
//判断用户是否已经注册
if (!$_SESSION['username'])
{
echo '<p>请先<a href="create_user.php">注册</a>,
或者<a href="logon_forum.php">登录</a>或后进行操作。<br> </p>';
} else {
//帖子已经被锁定
if ($locked == 1)
{
echo '<p><strong>该贴是被锁定的,无法回帖</strong><br> </p>';
}else{
?>
<form name="form1" method="post" action="add_reply.php" id="reply">
<input name="id" type="hidden" value="<? echo $id; ?>">
<table>
<tr>
<td> </td>
<td>
<textarea name="reply_detail" cols="45" rows="10"></textarea>
</td>
</tr>
</table>
<br />
<input type="submit" name="Submit" value="回复该帖" class="button" />
<input type="reset" name="Reset" class="button" />
</form>
<?php } ?>
</fieldset><br>
<!--内容回复表单,结束-->
<?php
//如果是管理员用户,则输出“置顶”、“锁定”和“删除”按钮
if ($_SESSION['username'] == ADMIN_USER)
{
?>
<!--管理员操作表单,开始-->
<fieldset>
<legend>管理员操作</legend>
<!--显示锁定操作按钮-->
<?php if ($locked == 0) { ?>
<form name="lock" method="post" action="lock_topic.php">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" name="Submit" value="锁定该贴" class="button">
将该贴锁定,其他用户无法回复
</form>
<?php }else{ ?>
<form name="unlock" method="post" action="unlock_topic.php">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" name="Submit" value="解除锁定" class="button">
解除锁定,其他人可以回复
</form>
<?php } ?>
<!--显示置顶操作按钮-->
<?php if ($sticky == 0) { ?>
<form name="stick" method="post" action="stick_topic.php">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" name="Submit" value="置顶该贴" class="button">
将该贴置于顶端
</form>
<?php } else { ?>
<form name="unstick" method="post" action="unstick_topic.php">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" name="Submit" value="取消置顶" class="button">
取消该贴置顶
</form>
<?php } ?>
<!--显示删除操作按钮-->
<form name="delete" method="get" action="del_topic.php">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" name="Submit" value="删除帖子" class="button">
删除该帖与回复内容
</form>
</fieldset>
<!--管理员操作表单,结束-->
<?php
}
}
?>
<?php
include('footer.inc.php');
?>
7.update_profile.php
<?php
//**************************************
//* 功能:用户资料修改页面
//**************************************
require('config.inc.php');
if (!$_SESSION['username']) {
ExitMessage("请<b>登录</b>后执行该请求 ", "logon_form.php");
}
//用户名
$username=$_SESSION['username'];
//电子邮件
$email=ClearSpecialChars($_POST['email']);
//真实姓名
$realname=ClearSpecialChars($_POST['realname']);
//用户密码
$password=$_POST['password'];
if (!$password)
{
//如果密码为空,则密码项不予更新
$sql="UPDATE forum_user
SET email = '$email',
realname = '$realname'
WHERE username = '$username'";
} else {
//如果输入了新的密码,则密码项也予以更新
//$password = md5($password);
$sql="UPDATE forum_user
SET password = '$password',
email = '$email',
realname = '$realname'
WHERE username = '$username'";
}
$result=mysql_query($sql);
if($result){
?>
<h2>个人资料更新成功</h2>
<p>
您的个人资料已经被成功更新
请<a href="main_forum.php">返回</a>论坛主页
</p>
<?php
}
else {
ExitMessage("记录不存在!");
}
?>
8.unstick_topic.php
<?php
//**************************************
//* 功能:取消“置顶”操作
//**************************************
require('config.inc.php');
//判断是否为管理员
if ($_SESSION['username'] == ADMIN_USER)
{
//取得文章ID
$id=$_POST['id'];
//取消“置顶”的SQL语句
$sql = "UPDATE forum_topic SET sticky='0' WHERE id='$id'";
$result=mysql_query($sql);
if($result)
{
//跳转页面
header("Location: view_topic.php?id=$id");
}
else {
ExitMessage("数据库操作错误!");
}
} else {
ExitMessage("你没有管理权限!");
}
?>
9.unlock_topic.php
<?php
//**************************************
//* 功能:取消“锁定”操作
//**************************************
require('config.inc.php');
//判断是否为管理员
if ($_SESSION['username'] == ADMIN_USER)
{
//取得文章ID
$id=$_POST['id'];
//取消“锁定”的SQL语句
$sql = "UPDATE forum_topic SET locked='0' WHERE id='$id'";
$result=mysql_query($sql);
if($result)
{
//跳转页面
header("Location: view_topic.php?id=$id");
}
else {
ExitMessage("数据库操作错误!");
}
} else {
ExitMessage("你没有管理权限!");
}
?>
10.stick_topic.php
<?php
//**************************************
//* 功能:设置“置顶”操作
//**************************************
require('config.inc.php');
//判断是否为管理员
if ($_SESSION['username'] == ADMIN_USER)
{
//取得文章ID
$id=$_POST['id'];
//设置“置顶”的SQL语句
$sql = "UPDATE forum_topic SET sticky='1' WHERE id='$id'";
$result=mysql_query($sql);
if($result)
{
//跳转页面
header("Location: view_topic.php?id=$id");
}
else {
ExitMessage("数据库操作错误!");
}
} else {
ExitMessage("你没有管理权限!");
}
?>
11.logon_forum.php
<?php
//**************************************
//* 功能:用户登录程序
//**************************************
require('config.inc.php');
if($_POST['submit'])
{
//用户名
$username=ClearSpecialChars($_POST['username']);
$password=$_POST['password'];
//密码,需要进行MD5加密
//$password=md5($_POST['password']);
//从数据库中检索用户名,密码是否匹配
$sql = "SELECT * FROM forum_user
WHERE username='$username' AND password='$password'";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows == 1)
{
//获得用户名
$row = mysql_fetch_assoc($result);
//将用户名存入SESSION中
$_SESSION['username'] = $row['username'];
//跳转到论坛主页面
header("Location: main_forum.php");
}
else {
ExitMessage("用户名或者密码错误!", "logon_forum.php");
}
}
else{
//公用头部页面
//include('header.inc.php');
?>
<h2>用户登录</h2>
<fieldset>
<form method="post" action="logon_forum.php">
<table>
<tr>
<td>用户名:</td>
<td><input name="username" type="text"></td>
</tr>
<tr>
<td>密 码:</td>
<td><input name="password" type="password"></td>
</tr>
</table>
<input type="submit" name="submit" value="登录" class="button">
</form>
</fieldset>
<?php
}
//公用尾部页面
include('footer.inc.php');
?>
12.lock_topic.php
<?php
//**************************************
//* 功能:设置“锁定”操作
//**************************************
require('config.inc.php');
//判断是否为管理员
if ($_SESSION['username'] == ADMIN_USER)
{
//取得文章ID
$id=$_POST['id'];
//锁定的SQL语句
$sql = "UPDATE forum_topic SET locked='1' WHERE id='$id'";
$result=mysql_query($sql);
if($result)
{
//跳转页面
header("Location: view_topic.php?id=$id");
}
else {
ExitMessage("数据库操作错误!");
}
} else {
ExitMessage("你没有管理权限!");
}
?>
13.header.inc.php
<?php
//* 初始化程序 *
//*******************
//开启SESSION
session_start();
//打开数据库连接
$db = mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$db)
{
die('<b>数据库连接失败!</b>');
exit;
}
//选择数据库
mysql_select_db (DB_NAME);
?>
14.footer.inc.php
<!---功能:共用尾部页面-!>
<!-- 正文内容结束 -->
<!-- 版权信息 -->
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<center>
<table border=0>
<tr>
<td><span class="STYLE1">版权所有</span>:KARMA</td>
</tr>
</center>
</table>
</body>
</html>
15.edit_profile.php
<?php
//******************************************
//* 功能:用户资料修改页面
//******************************************
require('config.inc.php');
//用户名
$id = $_SESSION['username'];
//如果用户没有登录
if (!$_SESSION['username']) {
ExitMessage("请登录后执行该请求。", "logon_forum.php");
}
?>
<h2>编辑个人资料</h2>
<?php
//查询用户资料
$sql="SELECT * FROM forum_user WHERE username = '$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
<fieldset>
<legend>个人资料</legend>
<form method="post" action="update_profile.php">
<table>
<tr>
<td>登录用户:</td>
<td><b><? echo $rows['username']; ?></b></td>
</tr>
<tr>
<td>
更新密码:</td><td><input name="password" type="password">
</td>
</tr>
<tr>
<td>电子邮件:</td>
<td><input name="email" type="text"
value="<?php echo $rows['email']; ?>"></td>
</tr>
<tr>
<td>真实姓名:</td>
<td><input name="realname" type="text"
value="<?php echo $rows['realname']; ?>"></td>
</tr>
</table>
<br><br>
<input type="submit" name="submit" value="更新个人资料" class="button">
</form>
</fieldset>
<?php include('footer.inc.php');?>
16.del_topic.php
<?php
//**************************************
//* 功能:删除文章内容操作
//**************************************
require('config.inc.php');
//判断是否为管理员
if ($_SESSION['username'] == ADMIN_USER)
{
// get data that sent from form
$id=$_GET['id'];
//删除文章
$sql = "DELETE FROM forum_topic WHERE id=$id";
$result=mysql_query($sql);
//删除回复内容
$sql2 = "DELETE FROM forum_reply WHERE topic_id=$id";
$result2=mysql_query($sql2);
if($result AND $result2)
{
//页面跳转
header("Location: main_forum.php");
}
else {
ExitMessage("数据库操作错误!");
}
} else {
ExitMessage("你没有管理权限!");
}
?>
17.create_user.php
<?php
//**************************************
// 功能:生成用户注册页面
//**************************************
require('config.inc.php');
include('header.inc.php');
?>
<h2>注册新用户</h2>
<fieldset>
<form method="post" action="add_user.php">
<table>
<tr>
<td>用户名:</td>
<td><input name="username" type="text"></td>
</tr>
<tr>
<td>密 码:</td>
<td><input name="password" type="password"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input name="email" type="text"></td>
</tr>
<tr>
<td>真实姓名:</td>
<td><input name="realname" type="text"></td>
</tr>
</table>
<input type="submit" name="Submit" value="提交注册" class="button"/>
<input type="reset" name="Submit2" value="清空" class="button"/>
</form>
</fieldset>
<?php
//公用尾部页面
include('footer.inc.php');
?>
18.create_topic.php
<?php
//***********************************
//* 功能:发表文章页面
//***********************************
require('config.inc.php');
include('header.inc.php');
?>
<h2>创建新贴</h2>
<?php
if (!$_SESSION['username'])
{
//如果用户未登录,显示错误信息
?>
<h3>未注册的用户</h3>
<p>对不起,请<a href="create_user.php">注册</a>新用户,
或者进行<a href="logon_forum.php">登录</a>
</p>
<?php
}else{
//如果用户登录,显示输入表单
?>
<h3>发言注意事项</h3>
<ul>
<li>所有项目必须填写。</li>
<li>在标题和正文中不能使用HTML代码。</li>
</ul>
<form method="post" action="add_topic.php" id="postComment">
<table>
<tr>
<td>话题</td>
<td><input name="topic" type="text" id="topic" size="50"><td>
</tr>
<tr>
<td>正文</td>
<td><textarea name="detail" cols="50" rows="10" id="detail"></textarea></td>
</tr>
</table>
<?php
//如果是管理员,将显示“置顶”和“锁定”功能
if ($_SESSION['username'] == ADMIN_USER)
{
?>
<br>将帖子置顶 <input type="checkbox" name="sticky" value="on">
<br>锁定该帖子 <input type="checkbox" name="locked" value="on">
<?php
}
?>
<br><br>
<input type="submit" name="Submit" value="立即发布" class="button">
<input type="reset" name="Submit2" class="button">
</form>
<?php } ?>
<?php
//公用尾部页面
include('footer.inc.php');
?>
19.add_reply.php
<?php
//**************************************
//* 功能:回复文章保存页面
//***************************************
require('config.inc.php');
//判断用户是否登录
if (!$_SESSION['username'])
{
ExitMessage("请<b>登录</b>后执行该请求。", "logon_form.php");
}
//回帖的ID
$id=$_POST['id'];
//验证帖子已经存在,未被锁定
$sql = "SELECT * from forum_topic WHERE id='$id'";
$result = mysql_query($sql);
$topic_info = mysql_fetch_array($result);
if (!$topic_info)
{
ExitMessage("帖子记录不存在!", "main_forum.php");
}
if ($topic_info['locked'] == 1)
{
ExitMessage("该贴已经被锁定,无法进行回复。");
}
//取得用户信息
$username = $_SESSION['username'];
$sql = "SELECT * from forum_user WHERE username='$username'";
$result = mysql_query($sql);
$user_info = mysql_fetch_array($result);
//取得提交过来的数据
$reply_name=$_SESSION['username'];
$reply_email=$user_info['email'];
$reply_detail=filterBadWords($_POST['reply_detail']);
if (!$reply_detail)
{
ExitMessage("没有回贴记录!", "main_forum.php");
}
//取得reply_id的最大值
$sql = "SELECT Count(reply_id) AS MaxReplyId
FROM forum_reply WHERE topic_id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_row($result);
//将reply_id最大值+1,如果没有该值,则设置为1。
if ($rows)
{
$Max_id = $rows[0]+1;
}
else {
$Max_id = 1;
}
//插入回复数据
$sql="INSERT INTO forum_reply (topic_id, reply_id, reply_name,
reply_email, reply_detail, reply_datetime)
VALUES('$id', '$Max_id', '$reply_name',
'$reply_email', '$reply_detail', NOW())";
$result=mysql_query($sql);
if($result)
{
//更新reply字段
$sql="UPDATE forum_topic SET reply='$Max_id' WHERE id='$id'";
$result=mysql_query($sql);
//页面跳转
header("Location: view_topic.php?id=$id");
}
else {
ExitMessage("记录不存在");
}
?>
20.add_topic.php
<?php
//**************************************
//* 功能:发表文章程序
//**************************************
require('config.inc.php');
if (!$_SESSION['username'])
{
//如果用户未登录,显示错误信息
include('header.inc.php'); //头文件
?>
<h2>创建新贴</h2>
<h3>未注册的用户</h3>
<p>对不起,请<a href="create_user.php">注册</a>新用户
或者进行<a href="logon_forum.php">登录</a>。
</p>
<?php
include('footer.inc.php'); //尾文件
} else {
//获得用户信息
$username = $_SESSION['username'];
$sql = "SELECT * from forum_user WHERE username='$username'";
$result = mysql_query($sql);
$info = mysql_fetch_array($result);
//取得传递来的值
//标题
$topic = filterBadWords($_POST['topic']); //标题的脏字过滤
//正文
$detail = filterBadWords($_POST['detail']); //正文的脏字过滤
//发帖人
$name = $_SESSION['username'];
//电子邮件地址
$email = $info['email'];
//是否置顶
$sticky = $_POST['sticky'];
//是否锁定
$locked = $_POST['locked'];
//数据合法性检查
if (!$topic)
{
ExitMessage("请输入标题!");
}
if (!$detail)
{
ExitMessage("请输入正文!");
}
//判断是否为锁定状态
if ($locked == "on" && $name == ADMIN_USER) {
$locked = 1;
}
else {
$locked = 0;
}
//判断是否置顶状态
if ($sticky == "on" && $name == ADMIN_USER) {
$sticky = 1;
}
else {
$sticky = 0;
}
//将数据插入数据库
$sql="INSERT INTO forum_topic(topic, detail, name, email, datetime, locked, sticky)
VALUES('$topic', '$detail', '$name', '$email',NOW(), '$locked', '$sticky')";
$result=mysql_query($sql);
if($result)
{
//成功后,跳转页面到论坛主页面
header("Location: main_forum.php");
}
else
{
ExitMessage("数据库错误!");
}
}
?>
21.add_user.php
<?php
//**********************************
//* 功能:添加注册用户记录
//**********************************
require('config.inc.php');
//取得提交的数据,并做清理
//用户名
$username = ClearSpecialChars($_POST['username']);
//密码
$password = $_POST['password'];
//电子邮件地址
$email = ClearSpecialChars($_POST['email']);
//真实姓名
$realname = ClearSpecialChars($_POST['realname']);
//检验数据的合法性
if (!$username) {
ExitMessage('请输入用户名!');
}
if (!$password) {
ExitMessage('请输入密码!');
}
if (!$email) {
ExitMessage('请输入电子邮件地址!');
}
else if(!checkEmail($email)){
ExitMessage('电子邮件地址格式错误!');
}
//对密码进行MD5加密
//$password=md5($_POST['password']);
//判断用户是否已经存在
$sql = "SELECT * FROM forum_user WHERE username='$username'";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0) {
ExitMessage('该用户已经存在!');
}
//创建用户
$sql = "INSERT INTO forum_user (username, password, email, realname, regdate)
VALUES('$username', '$password', '$email', '$realname', NOW())";
$result = mysql_query($sql);
if($result)
{
?>
<h2>创建用户</h2>
<p>您的用户账号已经建立,请点击<a href="logon_forum.php">这里</a>登录。</p>
<?php
}
else {
ExitMessage("数据库错误!");
}
?>
22.config.inc.php
<?php
//*******************
// 功能:数据库操作程序
//*******************
//连接数据库的定义
//用户名
define('DB_USER', "root");
//密码
define('DB_PASSWORD', "root");
//数据库主机地址
define('DB_HOST', "localhost");
//数据库
define('DB_NAME', "phpforum");
//管理员用户
define('ADMIN_USER', "admin");
//分页设置,每页最多显示的记录数
define('EACH_PAGE', 15);
//无效的字符,用于ClearSpecialChars()函数
$invalidchars = array(
"'", //单引号
";", //分号
"=", //等号
"\\", //反斜线
"/" //斜线
);
//“脏字”数组,用于FilterBadWords()
$badwords=array
(
"fuck", "shit", "wanker", "cunt", "gay",
"nigger", "bastard", "tosser", "dipshit",
"homosexual", "nigga", "gaylord", "retard",
"asshole", "slut", "prick", "cock", "pussy",
"bitch", "wanking", "bollocks"
);
//*******************
//* 公共函数设置 *
//*******************
//功能:检查电子邮件地址格式是否正确
//输入:电子邮件地址
//输出:true或false
function CheckEmail($email)
{
$check = "/^[0-9a-zA-Z_-]+@[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+){0,3}$/";
if(preg_match ($check, $email)){
return true;
}
else{
return false;
}
}
//功能:显示错误信息和返回的链接地址,并终止程序执行
//输入:错误信息, 链接地址
//输出:字符串
function ExitMessage($message, $url='')
{
echo '<p class="message">';
echo $message;
echo '<br>';
if($url){
echo '<a href="'.$url.'">返回</a>';
}else{
echo '<a href="#" onClick="window.history.go(-1);">返回</a>';
}
echo '</p>';
exit;
}
//功能:清除字符串中的特殊字符
//输入:字符串
//输出:字符串
function ClearSpecialChars($str)
{
global $invalidchars;
$str = trim($str);
$str = str_replace($invalidchars,"",$str);
return $str;
}
//功能:“脏字”处理程序
//输入:字符串
//输出:字符串
function FilterBadWords($str)
{
global $badwords;
//替代字数组
$replacements=array("[ensored]", "***");
for($i=0;$i < sizeof($badwords);$i++)
{
//随机函数发生器
srand((double)microtime()*1000000);
//生成随机代码
$rand_key = (rand()%sizeof($replacements));
$str=eregi_replace($badwords[$i], $replacements[$rand_key], $str);
}
return $str;
}
/*******************/
/* 初始化程序 */
/*******************/
//开启SESSION
session_start();
//打开数据库连接
$db = mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$db)
{
die('<b>数据库连接失败!</b>');
exit;
}
//选择数据库
mysql_select_db (DB_NAME);
?>
SQL语句:
-- MySQL dump 10.11
--
-- Host: localhost Database: phpforum
-- ------------------------------------------------------
-- Server version 5.0.51a-community-nt
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `forum_reply`
--
DROP TABLE IF EXISTS `forum_reply`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `forum_reply` (
`id` int(20) NOT NULL auto_increment,
`topic_id` int(20) NOT NULL,
`reply_id` int(20) NOT NULL,
`reply_name` varchar(20) NOT NULL,
`reply_email` text NOT NULL,
`reply_detail` text NOT NULL,
`reply_datetime` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `forum_reply`
--
LOCK TABLES `forum_reply` WRITE;
/*!40000 ALTER TABLE `forum_reply` DISABLE KEYS */;
INSERT INTO `forum_reply` VALUES (1,3,1,'karma','','huihuihui','2013-12-26'),(9,21,2,'admin','webmaster@gmail.com','admin is mine, i want to go to school!\r\nwhere are you?\r\nif you in the bookstore along the libary now, i could go to bedroom with you at the minutes. ','2013-12-28'),(8,21,1,'xcc','123456@sina.com','i want to go to school, where are you?\r\nif you at the playground now, i could go with you anything time that you want to.','2013-12-28'),(10,21,3,'admin','webmaster@gmail.com','xcc is my school,so you can go to xcc,if you have sometimes.in short,you should go to xcc,i could carry you to qiong lake to in sunshine.\r\n','2013-12-28'),(11,22,1,'struts','35454565@baidu.com','what his cellphone number?\r\nhis cellphone number is:15678909999','2013-12-28'),(12,21,4,'admin','webmaster@gmail.com','ä½ æ˜¯ï¼Ÿï¼Ÿ','2013-12-28'),(13,21,5,'admin','webmaster@gmail.com','SB??','2013-12-28'),(14,23,1,'karma','123456@qq.com','å¯ä»¥çš„è¯call me:\r\n16783456783(cellphone)','2013-12-28'),(15,23,2,'xcc','123456@sina.com','[ensored]!','2013-12-28'),(16,23,3,'xcc','123456@sina.com','[ensored]er!','2013-12-28'),(17,23,4,'xcc','123456@sina.com','fuc!','2013-12-28'),(18,23,5,'xcc','123456@sina.com','f4ck','2013-12-28'),(19,23,6,'xcc','123456@sina.com','å¥½çš„ï¼Œå°±è¿™æ ·ï¼ï¼ï¼','2013-12-28'),(20,24,1,'xcc','123456@sina.com','真是个好东西这论å›ï¼ï¼ï¼','2013-12-28'),(21,21,6,'xcc','123456@sina.com','so F4CK!','2013-12-28'),(22,25,1,'xcc','123456@sina.com','怎么没效果,SB\r\n这个网站太åšå›ºäº†ï¼ï¼ï¼','2013-12-28'),(23,25,2,'xcc','123456@sina.com','我在政府部门,还没è§è¿‡è¿™ä¹ˆåšå›ºçš„网站呢ï¼ï¼ï¼','2013-12-28'),(24,26,1,'xcc','123456@sina.com','楼上SB在干å—??','2013-12-28'),(25,26,2,'xcc','123456@sina.com','good luck!!! just one way, if you want to success.\r\n\r\nMaybe you can go to college to study upstairs.\r\n\r\nso, do you understand my ideas.','2013-12-28'),(26,21,7,'hack','54545454@baidu.com','Hello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!','2013-12-28'),(27,22,2,'xcc','123456@sina.com','good!!!!!','2013-12-29'),(28,28,1,'xcc','123456@sina.com','xxxxxxxxcccccccccccccccccccccccccccc','2013-12-29'),(29,21,8,'xcc','123456@sina.com','Hello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\n','2013-12-29'),(30,21,9,'xcc','123456@sina.com','Hello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\nHello i\'m hack , nice to meet you\r\nToday, i will show my picture to everyone\r\nThe picture told us : everyting is no failed!!!\r\n\r\n','2013-12-29'),(31,27,1,'xcc','123456@sina.com','i\'m chinese , so i\'m love China!!!','2013-12-29'),(32,29,1,'xcc','123456@sina.com','xss\r\n','2013-12-30'),(33,26,3,'xcc','123456@sina.com','xss\r\n!!','2013-12-30'),(34,26,4,'xcc','123456@sina.com','<script>alert(\"xcc\")</script>','2013-12-30'),(35,27,2,'admin','webmaster@gmail.com','xcc\'s students\' idea is so great!!','2013-12-31'),(36,30,1,'xcc','34545454@qq.com','ccccccccccccccccccccccccccccccccc','2014-01-01'),(37,21,10,'xcc','34545454@qq.com','ok,i see,at my school,i will go top of the lu shan mountain,who will go along with me?\r\n','2014-03-02'),(38,21,11,'xcc','34545454@qq.com','everything is ok,so if you want to go here,i will go with you at the monment.','2014-03-02'),(39,25,3,'xcc','34545454@qq.com','是啊,我也是,我觉得我的网站还行å§ï¼ï¼ï¼','2014-03-02');
/*!40000 ALTER TABLE `forum_reply` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `forum_topic`
--
DROP TABLE IF EXISTS `forum_topic`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `forum_topic` (
`id` int(20) NOT NULL auto_increment,
`topic` text NOT NULL,
`detail` text NOT NULL,
`name` text NOT NULL,
`email` text NOT NULL,
`datetime` date NOT NULL,
`locked` varchar(20) NOT NULL,
`sticky` varchar(20) NOT NULL,
`reply` int(20) NOT NULL,
`view` int(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `forum_topic`
--
LOCK TABLES `forum_topic` WRITE;
/*!40000 ALTER TABLE `forum_topic` DISABLE KEYS */;
INSERT INTO `forum_topic` VALUES (27,'xcc student\'s ideas','xcc student\'s ideas is so perfect!','xcc','123456@sina.com','2013-12-29','0','1',2,37),(25,'xcc','<script>alert(\"xss\")</script>','xcc','123456@sina.com','2013-12-28','0','0',3,15),(26,'西昌å¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼','西昌å¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼è¥¿æ˜Œå¦é™¢çš„åŒå¦ä½ 们好ï¼ï¼ï¼','xcc','123456@sina.com','2013-12-28','0','0',4,17),(21,'i wnt to go to school','i want to go to school,who will go along with me?','xx','123456@qq.com','2013-12-28','0','1',11,72),(22,'struts is a student.','struts is a student,he is study in xcc,so if you have some questions,you can contact him.','struts','35454565@baidu.com','2013-12-28','0','0',2,14),(23,'请问有西院的å¦ç”Ÿä½è¿™é‡Œå—??','请问有西院的å¦ç”Ÿä½è¿™é‡Œå—??\r\nå¯ä»¥çš„è¯ï¼Œå¯ä»¥èŠèŠçš„!\r\nåŽŸå› æ˜¯è¿™é‡Œæœ‰ä¸€äº›å¦ç”Ÿé¡¹ç›®éœ€è¦ä½ 们åšï¼Œ\r\næ‰€ä»¥ï¼Œæƒ³æ‰¾ä½ ä»¬å¸®å¸®æˆ‘ä»¬ï¼Œä¸çŸ¥é“å¯ä»¥ä¸ï¼','karma','123456@qq.com','2013-12-28','1','0',6,56),(24,'zxcv','zxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcvzxcv!!!','xcc','123456@sina.com','2013-12-28','0','0',1,9),(28,'xxxxxxxxxxxxxxxxxxxxx','xxxxxxxxxxxxxx\r\nccccccccccccccc\r\nccccccccccccccc\r\niiiiiiiiiiiiiiii\r\nssssssssssssssss\r\nbbbbbbbbbbbbbbbb\r\naaaaaaaaaaaaaaaa\r\ndddddddddddddddd','xcc','123456@sina.com','2013-12-29','0','0',1,10),(29,'html','html','xcc','123456@sina.com','2013-12-29','0','0',1,5),(30,'xxxxxxxxxxxxxxxx','xxxxxxxxxxxxxxxxxxxx','xcc','34545454@qq.com','2014-01-01','0','0',1,3),(31,'现在的房价太高了~','åªèƒ½ã€è¯´ä¹°ä¸èµ·å•ŠÂ·','xcc','34545454@qq.com','2014-01-01','0','0',0,1);
/*!40000 ALTER TABLE `forum_topic` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `forum_user`
--
DROP TABLE IF EXISTS `forum_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `forum_user` (
`id` int(20) NOT NULL auto_increment,
`username` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
`email` text NOT NULL,
`realname` text NOT NULL,
`regdate` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `forum_user`
--
LOCK TABLES `forum_user` WRITE;
/*!40000 ALTER TABLE `forum_user` DISABLE KEYS */;
INSERT INTO `forum_user` VALUES (29,'xcc','xcc','34545454@qq.com','xcc','2014-01-01');
/*!40000 ALTER TABLE `forum_user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-04-16 15:35:45
PHP FORUM的更多相关文章
- discuz首页设置默认地址不带forum.php后缀的方法
最近在研究discuz,上传安装几部搞定,打开首页跳到含有"/forum.php"的网址,到管理中心改了好一会儿也没好.那么如何实现discuz首页设置不带forum.php后缀呢 ...
- ./upload/forum.php
这是forum.php的全部代码,然后试着读一读,自己做做笔记. define('APPTYPEID', 2); define('CURSCRIPT', 'forum'); define(); 定义常 ...
- ENode 2.0 - 第一个真实案例剖析-一个简易论坛(Forum)
前言 经过不断的坚持和努力,ENode 2.0的第一个真实案例终于出来了.这个案例是一个简易的论坛,开发这个论坛的初衷是为了验证用ENode框架来开发一个真实项目的可行性.目前这个论坛在UI上是使用了 ...
- Urban Planning and Public Health - Reflection on Professor Webster's article in Urban Planning Forum
1. General review. Professor Webster published this article in Urban Planning Forum, one of the top ...
- 客户访问站点将bbs/链接 跳转至forum/链接下的两种方式
显性 302 暂时重定向跳转 server { listen 80 ; server_name localhost; index index.html index.htm index.php; roo ...
- Allegro学习(http://www.asmyword.com/forum.php?mod=forumdisplay&fid=86)
一.资源 1.网站推荐www.eda365.com,里面有很多有用的东西:当然还有官方代理商的网站http://www.pspice.com.cn/: 2.视频教程:有库源电气的视频教程,还有在www ...
- 黄聪:Dsicuz x2.5、X3、X3.2如何去掉域名后面的/forum.php
Dsicuz x2.5去掉域名后面的/forum.php 1, 后台--全局--域名设置--应用域名--设置默认域名为访问域名就可以,如:www.xxxxx.com 上面2种方法都可以去掉域名后面的/ ...
- NFC Forum : Frequently Asked Questions (NFC 论坛:FAQ)
NFC for Business What is the NFC Forum? The NFC Forum is a not-for-profit industry organization whos ...
- http://f.dataguru.cn/forum.php?mod=viewthread&tid=44212&fromuid=4771
http://f.dataguru.cn/forum.php?mod=viewthread&tid=44212&fromuid=4771
- 高性能PHP论坛 Carbon Forum
Carbon Forum,一个高性能的.高安全性的.基于话题的PHP轻论坛. 优秀的架构,高效的代码,每个页面平均执行时间仅为1~5毫秒,同时恰当地使用异步加载技术,在SEO与用户体验间取得平衡. 论 ...
随机推荐
- .NET编译的目标平台(AnyCPU,x86,x64)
转载:http://blog.sina.com.cn/s/blog_78b94aa301014i8r.html 今天有项目的代码收到客户的反馈,要求所有的EXE工程的目标平台全部指定成x86,而所有D ...
- 坑死我啊,一个WPF Adorner使用注意事项
1.见鬼了? 项目中遇到这样的要求,一个Button用一个Adorner装饰,这个Adorner上又有一个Button,如下面这样 此时,我们在点击小Button的时候只希望处理小Button的事件, ...
- [译]Canvas的基本用法
在本文章中 <canvas> 元素 替换内容 </canvas> 标签不可省 渲染上下文(The rendering context如何翻译) 检查支持性 一个模板骨架 一个简 ...
- 地图坐标转换 -- 火星坐标与GPS坐标
第一次处理地理位置的数据的人,没什么经验,往往掉入很多坑浪费不少时间.我也是刚刚从坑里爬出来.这篇博文主要是把入门GPS轨迹分析的经验总结一下,以方便大家少走些弯路. (1)可视化 GPS 路径 刚拿 ...
- unity3d 赛车游戏——复位点检测
一直没有时间写博客 昨天我的CarWaypoints插件也告一段落了 今年没回家,过年就我一个人 挺无聊的,那就休息一天写几篇博客吧 我的代码可能很少,但是思路很重要 希望不懂的朋友别只copy代码 ...
- 【MPI学习6】MPI并行程序设计模式:具有不连续数据发送的MPI程序设计
基于都志辉老师<MPI并行程序设计模式>第14章内容. 前面接触到的MPI发送的数据类型都是连续型的数据.非连续类型的数据,MPI也可以发送,但是需要预先处理,大概有两类方法: (1)用户 ...
- IT男的”幸福”生活"续7
哇,兄弟们的热情真牛X的高呀!!! 在这里谢谢大家了.同时祝大家元宵节快乐,幸福美好.呵呵. 续7准备开始了… ….. 是什么样的事困扰她了… 躺在床上我,一直回想着MM,今天的情绪状态. 分析一下: ...
- [Json.net]快速入门
引言 有个朋友问了一个如何更方便的解析json格式字符串,之前也没怎么研究过json.net,就上网帮他查了一下,现学现卖的给他整了一个demo,这才发现json.net的强大,用着很方便. Json ...
- iOS UI基础-17.0 UILable之NSMutableAttributedString
在iOS开发中,常常会有一段文字显示不同的颜色和字体,或者给某几个文字加删除线或下划线的需求.之前在网上找了一些资料,有的是重绘UILabel的textLayer,有的是用html5实现的,都比较麻烦 ...
- JAVA 注解的几大作用及使用方法详解【转】
java 注解,从名字上看是注释,解释.但功能却不仅仅是注释那么简单.注解(Annotation) 为我们在代码中添加信息提供了一种形式化的方法,是我们可以在稍后 某个时刻方便地使用这些数据(通过 解 ...