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 相关文章推荐
实用函数7
Nov 08 PHP
php+AJAX传送中文会导致乱码的问题的解决方法
Sep 08 PHP
php目录管理函数小结
Sep 10 PHP
mayfish 数据入库验证代码
Apr 30 PHP
php IP转换整形(ip2long)的详解
Jun 06 PHP
PHP连接SQLServer2005方法及代码
Dec 26 PHP
PHP独立Session数据库存储操作类分享
Jun 11 PHP
CI(CodeIgniter)模型用法实例分析
Jan 20 PHP
PHP实现数组array转换成xml的方法
Jul 19 PHP
thinkPHP自动验证机制详解
Dec 05 PHP
php中curl和soap方式请求服务超时问题的解决
Jun 11 PHP
laravel 自定义常量的两种方案
Oct 14 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
Thinkphp 中 distinct 的用法解析
2016/12/14 PHP
Laravel框架表单验证操作实例分析
2019/09/30 PHP
YII2框架中behavior行为的理解与使用方法示例
2020/03/13 PHP
jQuery 获取、设置HTML或TEXT内容的两种方法
2014/05/23 Javascript
setinterval()与clearInterval()JS函数的调用方法
2015/01/21 Javascript
小议JavaScript中Generator和Iterator的使用
2015/07/29 Javascript
Prototype框架详解
2015/11/25 Javascript
Node.js获取前端ajax提交的request信息
2017/02/20 Javascript
Bootstrap 网格系统布局详解
2017/03/19 Javascript
详解Vue学习笔记入门篇之组件的内容分发(slot)
2017/07/17 Javascript
jQuery dateRangePicker插件使用方法详解
2017/07/28 jQuery
JavaScript中递归实现的方法及其区别
2017/09/12 Javascript
JQuery属性操作与循环用法示例
2019/05/15 jQuery
Vue路由前后端设计总结
2019/08/06 Javascript
javascript运行机制之执行顺序理解
2020/08/03 Javascript
JS实现密码框效果
2020/09/10 Javascript
vue 函数调用加括号与不加括号的区别
2020/10/29 Javascript
JavaScript实现鼠标经过表格某行时此行变色
2020/11/20 Javascript
python对html代码进行escape编码的方法
2015/05/04 Python
Python常用小技巧总结
2015/06/01 Python
python嵌套函数使用外部函数变量的方法(Python2和Python3)
2016/01/31 Python
pandas把dataframe转成Series,改变列中值的类型方法
2018/04/10 Python
python加载自定义词典实例
2019/12/06 Python
在python里创建一个任务(Task)实例
2020/04/25 Python
Pyinstaller加密打包应用的示例代码
2020/06/11 Python
Selenium环境变量配置(火狐浏览器)及验证实现
2020/12/07 Python
加拿大廉价机票预订网站:CheapOair.ca
2018/03/04 全球购物
校园广播稿精选
2014/10/01 职场文书
2014年图书馆工作总结
2014/11/25 职场文书
2014年班务工作总结
2014/12/02 职场文书
教师节表彰会主持词
2015/07/06 职场文书
Go 实现英尺和米的简单单位换算方式
2021/04/29 Golang
Python 实现Mac 屏幕截图详解
2021/10/05 Python
实现一个简单得数据响应系统
2021/11/11 Javascript
ipad隐藏软件app图标方法
2022/04/19 数码科技
python计算列表元素与乘积详情
2022/08/05 Python