一个模仿oso的php论坛程序源码(之三)第1/2页

 更新时间:2007年03月11日 00:00:00   作者:  
程序三:readforum.php 
<HTML> 
<HEAD> 
<TITLE> 论坛信息 </TITLE> 
<link rel="STYLESHEET" type="text/css" href="fp_zhangcg.css"> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<meta name="Microsoft Theme" content="none"> 
<meta name="Microsoft Border" content="none"> 
<META NAME="Generator" CONTENT="EditPlus"> 
<META NAME="Author" CONTENT=""> 
<META NAME="Keywords" CONTENT=""> 
<META NAME="Description" CONTENT=""> 
</HEAD> 
<body bgcolor="#C0C0C0" background="backcolor.GIF"> 
<? 
  include ("c:mydbheader.inc"); 
?> 
<?php  
//完成功能: 
//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); 

?> 
<table width="100%" border="0"> 
<tr class="text">  
<td width="50%">  <div align="left">当前位置:主页——论坛——论坛内容</div> </td> 
<td width="50%">  <div align="center">&nbsp</div> </td> 
</table> 
<? 
    $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;   
?> 
<table width="100%" border="0"> 
  <tr>  
    <td width="61%" class="text">主题:<span class="text"><font color="#ff0000"> 
      <? 
        print $ls_theme_title; 
      ?> 
    </font></span></td> 
    <td width="13%">  
      <div align="center"><a href="addforum.php?theme_id=0" target="_top"><img src="post.gif" width="80" height="20" alt="加新贴字" border="0"></a></div> 
    </td> 
    <td width="13%">  
    <? 
      print '<div align="center"><a href="addforum.php?theme_id='.$theme_id.'"'; 
      print 'target="_top"><img src="reply.gif" width="80" height="20"'; 
      print 'alt="回复贴字" border="0"></a></div>'; 
    ?> 
    </td> 
    <td width="13%">  
      <div align="center"><a href="mainforum.php" target="_top"><img src="theme.gif" width="80" height="20" alt="主题列表" border="0"></a></div>

相关文章

  • Laravel5中contracts详解

    Laravel5中contracts详解

    在Laravel5中出现了一个新的东西,叫做contracts,那么它到底是什么?有什么用?怎么用?我们就来探讨下吧。
    2015-03-03
  • yii中widget的用法

    yii中widget的用法

    这篇文章主要介绍了yii中widget的用法,实例分析了widget在视图中的调用方法以及定义方法,具有一定的参考借鉴价值,需要的朋友可以参考下
    2014-12-12
  • yii,CI,yaf框架+smarty模板使用方法

    yii,CI,yaf框架+smarty模板使用方法

    这篇文章主要介绍了yii,CI,yaf框架+smarty模板使用方法,结合实例形式介绍了yii,CI及yaf框架整合smaryt模板的使用技巧,具有一定参考借鉴价值,需要的朋友可以参考下
    2015-12-12
  • Laravel异常上下文解决方案分享

    Laravel异常上下文解决方案分享

    异常处理是编程中十分重要但也最容易被人忽视的语言特性,下面这篇文章主要给大家介绍了关于Laravel异常上下文解决方案的相关资料,文中通过实例代码介绍的非常详细,需要的朋友可以参考下
    2022-01-01
  • 显示youtube视频缩略图和Vimeo视频缩略图代码分享

    显示youtube视频缩略图和Vimeo视频缩略图代码分享

    这篇文章主要介绍了显示youtube视频缩略图和Vimeo视频缩略图的代码,需要的朋友可以参考下
    2014-02-02
  • 基于ThinkPHP删除目录及目录文件函数

    基于ThinkPHP删除目录及目录文件函数

    这篇文章主要介绍了基于ThinkPHP删除目录及目录文件函数,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-10-10
  • YII视图整合kindeditor扩展的方法

    YII视图整合kindeditor扩展的方法

    这篇文章主要介绍了YII视图整合kindeditor扩展的方法,较为详细的分析了Yii框架整合kindeditor的功能实现代码与设置相关技巧,需要的朋友可以参考下
    2016-07-07
  • Zend Framework页面缓存实例

    Zend Framework页面缓存实例

    这篇文章主要介绍了Zend Framework页面缓存实例,使用Zend缓存对象Zend_Cache实现,需要的朋友可以参考下
    2014-06-06
  • 基于php上传图片重命名的6种解决方法的详细介绍

    基于php上传图片重命名的6种解决方法的详细介绍

    本篇文章介绍了,在php中上传图片重命名的6种解决方法的详细说明,需要的朋友参考下
    2013-04-04
  • 浅谈使用 PHP 进行手机 APP 开发(API 接口开发)

    浅谈使用 PHP 进行手机 APP 开发(API 接口开发)

    做过 API 的人应该了解,其实开发 API 比开发 WEB 更简洁,但可能逻辑更复杂,因为 API 其实就是数据输出,不用呈现页面,所以也就不存在 MVC(API 只有 M 和 C),那么我们来探讨下,如何使用php进行手机API接口开发
    2014-08-08

最新评论