-
您的位置:首页 → 网页设计 → PHP实例 → 一个模仿oso的论坛程序(之三)
一个模仿oso的论坛程序(之三)
时间:2004/11/7 3:22:00来源:本站整理作者:蓝点我要评论(0)
-
程序三:readforum.php
论坛信息
include ("c:mydbheader.inc");
?>
//完成功能:
//echo $username;
//echo $useremail;
//echo $userhttp;
//echo $forumtitle;
//echo $fouumface;
//echo $forumcontent;
//echo $theme_id;
echo 'g_username:'.$GLOBALS["g_username"].' is ok';
$dbh = mysql_connect('localhost:3306','root','');
mysql_select_db('test');
if (empty($readflag)) {
$readflag = 0;
}
if ($readflag > 0) {
$theme_id = $readflag;
}
if (empty($theme_id)) {
$theme_id = 0;
}
//echo $username;
//echo $useremail;
//echo $userhttp;
//echo $forumtitle;
//echo $fouumface;
//echo $forumcontent;
if (($readflag == 0) and ($theme_id == 0)) { //增加数据
if (empty($username)) {
print "错误,请核对数据";
}
$res=mysql_query("SELECT max(id) + 1 AS rid FROM fr_t_forumtitle",$dbh);
$row=mysql_fetch_array($res);
if (empty($row["rid"])) {
$theme_id = 1;
} else {
$theme_id = $row["rid"] + 1;
}
$tempstr = " insert into fr_t_forumtitle(id,state,readcount,replycount,title,";
$tempstr = $tempstr."createman,replytime) ";
$tempstr = $tempstr." values(".$theme_id.",'0',0,-1,'".$forumtitle."','".$username."',now());";
$res=mysql_query($tempstr,$dbh);
}
if ($readflag == 0 ) {
$forumcontent = nl2br($forumcontent);
$tempstr = " insert into fr_t_forumcontent(id,content,replyman,replyemail,";
$tempstr = $tempstr."replyhttp,replytime,replyface)";
$tempstr = $tempstr." values(".$theme_id.",'".$forumcontent."','".$username."','".
$useremail."','".$userhttp."',now(),".$forumface.");";
$res=mysql_query($tempstr,$dbh);
$tempstr = " update fr_t_forumtitle set readcount = readcount +1,replycount = replycount + 1,";
$tempstr = $tempstr."replytime = now(),replyman ='".$username."' where id=".$theme_id;
$res=mysql_query($tempstr,$dbh);
} else {
$tempstr = " update fr_t_forumtitle set readcount = readcount +1 where id =".$theme_id;
$res=mysql_query($tempstr,$dbh);
}
?>
$tempstr = " select title,readcount,replycount from fr_t_forumtitle where id = ".$theme_id;
$res=mysql_query($tempstr,$dbh);
$row=mysql_fetch_array($res);
$ls_theme_title = $row["title"];
$li_readcount = $row["readcount"];
$li_replycount = $row["replycount"] + 1;
?>
主题:
print $ls_theme_title;
?>
|
|
print '';
?>
|
|
共有帖子
print $li_replycount;
?>
个,已阅读
print $li_readcount;
?>
次 |
|
//显示帖子的所有内容
$ls_query = 'select content,replyman,replytime,replyemail,replyhttp,replyface from fr_t_forumcontent ';
$ls_query = $ls_query. ' where id = '.$theme_id.' order by replytime';
$res = mysql_query($ls_query, $dbh);
$li_tempr = 0;
while ($row = mysql_fetch_array($res)) {
if ($li_tempr == 0) {
$li_tempr = 1;
print '';
print ' ';
print ' '; print ' | ';
print ' ';
print ' 作者:'.$row["replyman"].' ';
print ' | ';
print ' ';
print ' 发表于:'.$row["replytime"].' | ';
print ' ';
print ' E_mail:'.$row["replyemail"].' | ';
print ' ';
print ''.$row["replyhttp"].' | ';
print '
';
print ' ';
print ' ';
print ' '.$row["content"].' ';
print ' | ';
print '
';
print '
';
}
else {
$li_tempr = 0;
print '';
print ' ';
print ' '; print ' | ';
print ' ';
print ' 作者:'.$row["replyman"].' ';
print ' | ';
print ' ';
print ' 发表于:'.$row["replytime"].' | ';
print ' ';
print 'E_mail:'.$row["replyemail"].' | ';
print ' ';
print ''.$row["replyhttp"].' | ';
print '
';
print ' ';
print ' ';
print ' '.$row["content"].' ';
print ' | ';
print '
';
print '
';
}
}
?>
include ("c:mydbfooter.inc");
?>
----------
http://zhangcg.yeah.net
【本文版权归作者zhangcg与奥索网共同拥有,如需转载,请注明作者及出处】
相关阅读
Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么
-
热门文章
没有查询到任何记录。
最新文章
我的php文件怎么打开_php运算符怎么写 php
如何生成静态页面的函数PHP生成图片缩略图PHP session常见问题集锦及解决办法PHP实现同步远程Mysql
人气排行
DEDE在文章列表文章没有缩略图的不显示图片php+mysq修改用户密码我的php文件怎么打开_如何打开php文件的办法FCKeditor的配置和使用方法使用dedecms建站教程PHP+Ajax实现分页技术图片存储与浏览一例Linux+Apache+PHP+MySQLPHP生成图片缩略图
查看所有0条评论>>