BBS(php & mysql)完整版(一)


Posted in PHP onOctober 09, 2006

//此页面为say.php
<?
include "signup/mysql.inc";
if($id1){
       $sql="select * from $table where id='$id1'";    //显示回复题目
       $result=mysql_query($sql)or die(mysql_error());
       $row=mysql_fetch_array($result);
       $title="RE:".$row["title"];

        }

$ip=$REMOTE_ADDR;
$sql="select * from user_stus where ip='$ip'";    //查询当前用户名
$result=mysql_query($sql)or die(mysql_error());
$row=mysql_fetch_array($result);

if(!$row)                                         //判断用户是否登陆
{

echo "<html><div id=Layer2  align=center z-index:1><BR><BR><BR><BR>";
echo" <div id=Layer3  align=center z-index:2><img src=pic/3.gif width=15 height=15></div>";
echo"  <div align=center>";  
echo" <p><font size=2 color=#FF33CC>嘻嘻!! 请先登陆</font></p>";
echo"<p><font size=2 color=#FF33CC><a href='".$PHP_SELF."?p=1&&table=$table'>返回</a></font></p> </div> </html>";

exit();
}

else $userid=$row["userid"];

if($ok)
{

    if($title==""||$content=="")
    {
        echo "<BR>      请您添完整后提交";

    }
    else{
    $id=time();                                 //提交文章
    $date1=date("Y/m/d");
    $title=htmlspecialchars($title);
    $content=htmlspecialchars($content);

    $sql="select * from ".$table;
    $result=mysql_query($sql)or die(mysql_error());
    $row1=mysql_num_rows($result);
    $row1++;

    if($id1){

    $sql="insert into bbs_re (id,userid,date1,title,content)values('$id','$userid','$date1','$title','$content')";
    mysql_query($sql)or die(mysql_error());
    $sql="select * from ".$table." where id='$id1'";
    $result=mysql_query($sql)or die(mysql_error());
    $lin=mysql_fetch_array($result);
    for($i=1;$i<6;$i++)
        {
         $re="r".$i;
         if(!$lin["$re"])
         break;
        }
    $sql="update ".$table." set ".$re."='$id' where id='$id1'";

           }
    else   
    $sql="insert into ".$table." (id,userid,date1,title,content,row)values('$id','$userid','$date1','$title','$content','$row1')";
    $result=mysql_query($sql)or die(mysql_error());

    if($result)
       {

        header("Location:php3.php?p=1&&table=$table");
        exit ;
       }
    }
}

?>

<html>
<head>
<title>xiaoyang</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript1.2" src="js/menu_comment.js"></script>
<script language="JavaScript1.2" src="js/fw_menu.js"></script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div id="Layer1" style="position:absolute; left:31px; top:1px; width:560px; height:46px; z-index:10">
<script language="JavaScript1.2">fwLoadMenus();</script></div>

<div id="Layer6" style="position:absolute; left:409px; top:29px; width:118px; height:17px; z-index:6"></div>
<div id="Layer5" style="position:absolute; left:86px; top:63px; width:464px; height:303px; z-index:7">  
  <form name="form1" method="post" action="<? echo $PHP_SELF ?>">
    <table width="98%" border="1" cellspacing="0" cellpadding="0" bordercolor="#FF99FF">
      <tr>  
        <td width="26%" height="42">  
          <div align="center"><font size="2" color="#FF33FF">题目</font></div>
        </td>
        <td width="74%" height="42">  
          <input type="text" name="title" size="40" value="<?echo $title ;?>" onMouseover="this.document.form1.title.focus();return true">
          <input type="hidden" name="table" value="<?echo $table ;?>">
          <input type="hidden" name="id1" value="<? echo $id1 ;?>">
          <br>
        </td>
      </tr>
      <tr>  
        <td width="26%" height="172">  
          <div align="center"><font size="2" color="#FF33FF">内容</font></div>
        </td>
        <td width="74%" height="172">  
          <textarea name="content" cols="40" rows="10" wrap="physical" value="<?echo $content ;?>" onMouseOver="this.document.form1.content.focus()"></textarea>
        </td>
      </tr>
      <tr>
        <td width="26%">
          <div align="center">
            <input type="reset" name="Submit2" value="重写">
          </div>
        </td>
        <td width="74%">
          <div align="center">
            <input type="submit" name="ok" value="发表">
          </div>
        </td>
      </tr>
    </table>
    <p> </p>
  </form>
</div>
<div id="back" style="position:absolute; left:455px; top:30px; width:85px; height:3px; z-index:8">  
  <hr color="#ff9999" noshade>
</div>
<div id="goback" style="position:absolute; left:461px; top:23px; width:120px; height:16px; z-index:9">  
  <div align="center"><a href="php3.php?p=1&&table=<?echo $table ;?>" target="_self" onMouseover="window.status='' ;return true"><font size="2" color="#FF33FF">返回</font></a></div>
</div>
<p> </p>
<p> </p>
</body>
</html>

PHP 相关文章推荐
PHP 危险函数全解析
Sep 09 PHP
有关PHP中MVC的开发经验分享
May 17 PHP
PHP计数器的实现代码
Jun 08 PHP
自己写了一个php检测文件编码的函数
Apr 21 PHP
PHP基于php_imagick_st-Q8.dll实现JPG合成GIF图片的方法
Jul 11 PHP
destoon实现会员商铺中指定会员或会员组投放广告的方法
Aug 21 PHP
php网页病毒清除类
Dec 08 PHP
ZendFramework框架实现连接两个或多个数据库的方法
Dec 08 PHP
yii2实现 &quot;上一篇,下一篇&quot; 功能的代码实例
Feb 04 PHP
LaravelS通过Swoole加速Laravel/Lumen详解
Mar 02 PHP
PHP中单例模式的使用场景与使用方法讲解
Mar 18 PHP
goto语法在PHP中的使用教程
Sep 17 PHP
建立动态的WML站点(二)
Oct 09 #PHP
建立动态的WML站点(一)
Oct 09 #PHP
建立动态的WML站点(三)
Oct 09 #PHP
Session的工作方式
Oct 09 #PHP
用Flash图形化数据(一)
Oct 09 #PHP
PHP中Session的概念
Oct 09 #PHP
虚拟主机中对PHP的特殊设置
Oct 09 #PHP
You might like
PHP获取网卡地址的代码
2008/04/09 PHP
Yii不依赖Model的表单生成器用法实例
2014/12/04 PHP
php输出金字塔的2种实现方法
2014/12/16 PHP
JavaScript性能陷阱小结(附实例说明)
2010/12/28 Javascript
Firefox中beforeunload事件的实现缺陷浅析
2012/05/03 Javascript
js,jquery滚动/跳转页面到指定位置的实现思路
2014/06/03 Javascript
鼠标移到图片上变大显示而不是放大镜效果
2014/06/15 Javascript
javascript实现详细时间提醒信息效果的方法
2015/03/11 Javascript
JavaScript下的时间格式处理函数Date.prototype.format
2016/01/27 Javascript
三种Node.js写文件的方式
2016/03/08 Javascript
js闭包引起的事件注册问题介绍
2016/03/29 Javascript
touch.js 拖动、缩放、旋转 (鼠标手势)功能代码
2017/02/04 Javascript
深入理解angular2启动项目步骤
2017/07/15 Javascript
举例讲解Python编程中对线程锁的使用
2016/07/12 Python
Python爬虫实现简单的爬取有道翻译功能示例
2018/07/13 Python
详解python while 函数及while和for的区别
2018/09/07 Python
深入理解Python异常处理的哲学
2019/02/01 Python
django ListView的使用 ListView中获取url中的参数值方式
2020/03/27 Python
基于Python实现视频的人脸融合功能
2020/06/12 Python
CSS3——齿轮转动关键代码
2013/05/02 HTML / CSS
css3实现六边形边框的实例代码
2019/05/24 HTML / CSS
美国最大的高尔夫发球时间预订网站:TeeOff.com
2018/03/28 全球购物
美国在线旅行社:Crystal Travel
2018/09/11 全球购物
Fanatics英国官网:美国体育电商
2018/11/06 全球购物
精选奢华:THE LIST
2019/09/05 全球购物
体育教育专业毕业生自荐信
2013/11/15 职场文书
英语道歉信范文
2014/01/09 职场文书
《小儿垂钓》教学反思
2014/02/23 职场文书
体育节口号
2014/06/19 职场文书
未受刑事制裁公证证明
2014/09/20 职场文书
学校食堂食品安全承诺书
2015/04/29 职场文书
辩护意见书
2015/06/04 职场文书
Python利用Turtle绘制哆啦A梦和小猪佩奇
2022/04/04 Python
代码复现python目标检测yolo3详解预测
2022/05/06 Python
Java死锁的排查
2022/05/11 Java/Android
V Rising 服务器搭建图文教程
2022/06/16 Servers