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 相关文章推荐
PHP4实际应用经验篇(9)
Oct 09 PHP
利用Memcached在php下实现session机制 替换PHP的原生session支持
Aug 21 PHP
php对图像的各种处理函数代码小结
Jul 08 PHP
php不写闭合标签的好处
Mar 04 PHP
PHP获取POST数据的几种方法汇总
Mar 03 PHP
PHP实现在线阅读PDF文件的方法
Jun 17 PHP
PHP实现通过get方式识别用户发送邮件的方法
Jul 16 PHP
PHP对称加密函数实现数据的加密解密
Oct 27 PHP
PHP中call_user_func_array回调函数的用法示例
Nov 26 PHP
phpStudy 2016 使用教程详解(支持PHP7)
Oct 18 PHP
在phpstudy集成环境下的nginx服务器下配置url重写
Dec 02 PHP
PHP如何使用cURL实现Get和Post请求
Jul 11 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开启openssl的方法
2014/05/15 PHP
PHP编程中的常见漏洞和代码实例
2014/08/06 PHP
Yii中Model(模型)的创建及使用方法
2015/12/28 PHP
Yii 2.0实现联表查询加搜索分页的方法示例
2017/08/02 PHP
用Juery网页选项卡实现代码
2011/06/13 Javascript
如何在JavaScript中实现私有属性的写类方式(二)
2013/12/04 Javascript
JS生成随机字符串的多种方法
2014/06/10 Javascript
JS小游戏之宇宙战机源码详解
2014/09/25 Javascript
jQuery中delegate()方法用法实例
2015/01/19 Javascript
js实现class样式的修改、添加及删除的方法
2015/01/20 Javascript
JS+CSS实现滑动切换tab菜单效果
2015/08/25 Javascript
javascript实现计时器的简单方法
2016/02/21 Javascript
Ajax验证用户名或昵称是否已被注册
2017/04/05 Javascript
js实现Tab选项卡切换效果
2020/07/17 Javascript
react 实现页面代码分割、按需加载的方法
2018/04/03 Javascript
jQuery 查找元素操作实例小结
2019/10/02 jQuery
Vue组件通信入门之Provide和Inject机制
2019/12/29 Javascript
一篇文章带你使用Typescript封装一个Vue组件(简单易懂)
2020/06/05 Javascript
浅谈vue.watch的触发条件是什么
2020/11/07 Javascript
Python入门学习之字符串与比较运算符
2015/10/12 Python
详解python 拆包可迭代数据如tuple, list
2017/12/29 Python
Python求解任意闭区间的所有素数
2018/06/10 Python
Django REST Framework之频率限制的使用
2019/09/29 Python
HTML5 Canvas阴影使用方法实例演示
2013/08/02 HTML / CSS
使用分层画布来优化HTML5渲染的教程
2015/05/08 HTML / CSS
英国航空官网:British Airways
2016/09/11 全球购物
ziaja齐叶雅官方海外旗舰店:来自波兰的天然护肤品牌
2017/01/02 全球购物
Holland & Barrett爱尔兰:英国领先的健康零售商
2019/03/31 全球购物
社团文化节邀请函
2014/01/10 职场文书
幼儿园教师奖惩制度
2014/02/01 职场文书
户外亲子活动策划方案
2014/02/07 职场文书
后勤服务中心总经理工作职责
2014/03/03 职场文书
2015年感恩节演讲稿(优选篇)
2015/03/20 职场文书
元旦晚会主持词开场白
2015/05/28 职场文书
2019年教师入党申请书
2019/06/27 职场文书
javascript Number 与 Math对象的介绍
2021/11/17 Javascript