我的论坛源代码(六)


Posted in PHP onOctober 09, 2006

repal.php回复用的页面,因为回复可以不必要是用户,所以没加用户身份校验

<html>
<head>
<title>回复论题:<? echo $zt;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
</STYLE>
<LINK href="js/cpcw.css" rel=stylesheet /LINK>
<?php
include "linkfox.inc.php";               //包含进文件
include "info.inc.php";

function yy($f)
{
  $oldmess=@file($f);                                    //引用原文处理
  for ($i=0;$i<count($oldmess);$i++)
  {
   if (ord(substr($oldmess[$i],0,1))==161)   //第一位是否全角空格
   $mess=$mess.$oldmess[$i];
   else $mess=$mess."

".trim($oldmess[$i]);
  }
  return $mess;
}

function mesput($query,$use,$id)       
{
      $req=mysql_query($query);
      if ($req)
        {
          echo "<script language='JavaScript'> alert('谢谢你的回复!系统将返回论题!'); </script>";
          echo "<script language='JavaScript'> javascript:location.href='dispbbs.php?id=".$id."&use=".$use."'; </script>;";
          echo "<div align='center'><a href='dispbbs.php?id=".$id."&use=".$use."'>如果系统没有反应,请点击</a></a>";
        }
      else
      echo  "<script language='JavaScript'> alert('写入失败!'); </script>";
}
function usehf($message,$useinfo,$id,$use,$ft,$mess,$c)         //用户回复就直接从表里调出用户信息
{
   $query="select * from useinfo where usename='".$useinfo[0]."'";
   $req=mysql_query($query);
      if ($req)
         {
             $useinfo=mysql_fetch_array($req);
             $fo=fopen($ft,"a");
             $message=str_replace("<","<",str_replace(">",">",$message));
             $message=nl2br($message);
             $gip=getenv("REMOTE_ADDR");
             $messages=$message."ㄞㄚㄓ".$useinfo[2]."ㄞㄚㄓ".$useinfo[3]."ㄞㄚㄓ".$useinfo[9]."ㄞㄚㄓ".$useinfo[8]."ㄞㄚㄓ".$useinfo[14]."ㄞㄚㄓ".$useinfo[11]."ㄞㄚㄓ".$time."ㄞㄚㄓ".$gip."δεζ";
            if($c==dd)       //如果是引用回复,加上原文内容
               {
          $messages="<font color='999999'>".$mess."<div align='center'>★原文……★……引用★</div></font><br>".$messages;
               }
             $fp=fputs($fo,$messages);
             $time=date(Y年n月j日G时i分);   //主题回复数加一,覆盖上一回复人与时间
             $query="update foxbbs set hfnum=hfnum+1,hfname='".$ft."',hfusename='".$useinfo[2]."',hfdate='".$time."' where id='".$id."'";
             mesput($query,$use,$id);
          }
      else
         {
      echo "<script language='JavaScript'> alert('数据库错误:104号'); </script>";
         }
}

function gr($ft,$message,$youname,$youmail,$youoicq,$youweb,$youaddr,$youbq,$id,$use,$mess,$c)        //非注册用户
{
if (!uinfo($youmail,mail)||strlen($youmail)<12)  //校验MAIL
{
     echo "<script language='JavaScript'> alert('请输入正确的MAIL地址!'); </script>";
}
else if (!uinfo($youoicq,oicq)||strlen($youoicq)>12) //校验OICQ,只能判断是否数字和位数,如果有更好的方法就好。
{

     echo "<script language='JavaScript'> alert('请输入正确的OICQ号!'); </script>";
}

else
{
      if (uinfo($youweb,web)==OK&&substr($youweb,0,3)!=htt) $youweb="http://".$youweb;
      else if (uinfo($youweb,web)==OK&&substr($youweb,0,3)==htt) $youweb=$youweb;
      else $youweb="不告诉你";
      $time=date(Y年n月j日G时i分);          //取当前时间
      $message=str_replace("<","<",str_replace(">",">",$message));
      $message=nl2br($message);
      $gip=getenv("REMOTE_ADDR");
      $messages=$message."ㄞㄚㄓ".$youname."ㄞㄚㄓ".$youoicq."ㄞㄚㄓ".$youweb."ㄞㄚㄓ".$youmail."ㄞㄚㄓ".$youbq."ㄞㄚㄓ".$youaddr."ㄞㄚㄓ".$time."ㄞㄚㄓ".$gip."δεζ";
       if($c==dd)       //如果是引用回复
         {
        $messages="<font color='999999'>".$mess."<div align='center'>★原文……★……引用★</div></font><br>".$messages;
         }
      $fo=fopen($ft,"a");
      $fp=fputs($fo,$messages);
      $query="update foxbbs set hfnum=hfnum+1,hfname='".$ft."',hfusename='".$youname."',hfdate='".$time."' where id='".$id."'";
      mesput($query,$use,$id);
}
}
?>
</head>

<body bgcolor="#FFFFFF">
<?
$tem=$HTTP_COOKIE_VARS[FlyFoxNet];
$temp=explode("|",$tem);
$cookiem=$temp[0];
$useinfo=cuser($cookiem,$action);

if (!$useinfo[0]){  $useinfo[2]="游客"; $usename=1;}

$query="select mesname from foxbbs where id='".$id."'";
$req=mysql_query($query);
  if ($req)
  {
  $f=mysql_fetch_array($req);
  $mess=yy($f[0]);
      if ($message&&$action=add)
        {
          $ft="foxbbs/".$f[0].".bbs";
          if (ord(substr($message,0,1))!=161) $message="

".$message;
          for ($i=0;$i<10;$i++)
          {
            if ($bq[$i]) $youbq=$bq[$i];
          }
          if ($usename)  gr($ft,$message,$youname,$youmail,$youoicq,$youweb,$youaddr,$youbq,$id,$use,$mess,$c);
          else usehf($message,$useinfo,$id,$use,$ft,$mess,$c);
        }
   }
   else echo "<script language='JavaScript'> alert('打开文件错误!可能服务器忙,请稍候再试!'); </script>";

?>
<table width="100%" cellpadding="4" cellspacing="0" border="0">
  <tr>
    <td height="20">
      <div align="right"></div>
    </td>
    <td height="20" width="75"> </td>
    <td height="20" width="75"> </td>
    <td height="20" width="75"> </td>
    <td height="20" width="75"> </td>
  </tr>
  <tr>
    <td height="20">
      <div align="right"></div>
    </td>
   <td height="20" width="10%">
     <div align="center"><a href="reguse.php?action=xy"><img src="images/top_register.gif" width="74" height="21" border="0"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="useinfo.php?action=find"><img src="images/top_members.gif" width="74" height="21" border="0"></a></div>
    </td>
    <td height="20" width="10%"><a href="useinfo.php?action=edit"><img src="images/top_profile.gif" width="74" height="21" border="0"></a></td>
    <td height="20" width="10%"><a href="okey.php?d=q"><img src="images/top_logout.gif" width="74" height="21" border="0"></a></td>
  </tr>
  <tr>
    <td height="20">
      <div align="left">当前位置:<font color="#0000FF">狐网─>狐网论坛─>回复主题:<?echo "<font color='ff0000'>".$zt."</font>";?></font></div>
    </td>
    <td>    <div align="center"><a href="foxbbs.php"><img src="images/index.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="superuse.php"><img src="images/super.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="reguse.php?action=xy"><img src="images/dl.gif" width="70" height="20" border="0" align="middle"></a></div>
    </td>
    <td height="20" width="10%">
      <div align="center"><a href="../index.php"><img src="images/fox.gif" width="70" height="20" border="0" align="middle"></a></div>
     </td>  </tr>
</table>

<script language="JavaScript">
<!--
var submitcount=0;

function checkSubmit() {
    if (submitcount == 0) {
      submitcount++;
      return true;
    } else {
            if (submitcount>0){
            alert("帖子已成功提交了,别急,等等!");
            return false;
      }
    }
}

function check_com(){
   if(document.form.youname.value.length ==0){
      submitcount--;
      alert("名字不能为空!快填上吧!");
      return false;
   }
      if(document.form.youmail.value.length ==0){
      submitcount--;
      alert("EMAIL不能为空!快填上吧!");
      return false;
   }
   if(document.form.youoicq.value.length ==0){
      submitcount--;
      alert("OICQ不能为空!快填上吧!");
      return false;
   }

   if(document.form.message.value.length == 0){
      submitcount--;
      alert("内容不能为空!");
      return false;
   }
   return true;
}
//-->
</script>

<table width='70%' border='0' cellspacing='0' cellpadding='0' bgcolor='#000000' align='center'>
  <tr>
    <td>
      <table width='100%' border='0' cellspacing='0' cellpadding='0'>
        <tr bgcolor='#006699'>
          <td><div align="center"><font color="ffffff"><? echo "<font color='00ff00'>".$useinfo[2]."</font>"; ?> 你正在回复的主题是:[<? echo $zt; ?>]</font></div></td>
        </tr>
        <tr bgcolor='#eeeeee'>
          <td>
    <form name="form" onSubmit="return check_com()" method="post"><div align="center">
<?
      if ($usename)  //不是注册用户就显示输入框输入游客信息。
      {
      echo "你的大名:<input onFocus='this.select()' style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;' type='text' name='youname' size='30' maxlength='30' value='".$youname."'>";
      echo "OICQ:<input onFocus='this.select()' style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;' type='text' name='youoicq' size='16' maxlength='16' value='".$youoicq."'><br>";
      echo "来自何方:<input onFocus='this.select()' style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;' type='text' name='youaddr' size='55' value='".$youaddr."'><br>";
      echo "电子信箱:<input onFocus='this.select()' style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;' type='text' name='youmail' size='55' value='".$youmail."'><br>";
      echo "个人主页:<input onFocus='this.select()' style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;' type='text' name='youweb' size='55' value='".$youweb."'><br>";
      echo "表情<br><input type='radio' name='bq[0]' value='a'><img src='images/a.gif'><input type='radio' name='bq[1]' value='1'><img src='images/1.gif'>";
      echo "<input type='radio' name='bq[2]' value='2'><img src='images/2.gif'><input type='radio' name='bq[3]' value='3'><img src='images/3.gif'>";
      echo "<input type='radio' name='bq[4]' value='4'><img src='images/4.gif'><input type='radio' name='bq[5]' value='5'><img src='images/5.gif'>";
      echo "<input type='radio' name='bq[6]' value='6'><img src='images/6.gif'><input type='radio' name='bq[7]' value='7'><img src='images/7.gif'>";
      echo "<input type='radio' name='bq[8]' value='8'><img src='images/8.gif'><input type='radio' name='bq[9]' value='9'><img src='images/9.gif'><br>";
      }
      echo "<div align='center'>回复内容<br>";
      echo "<textarea onFocus='this.select()' style='BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #000000 1px dashed; BORDER-LEFT: #000000 1px dashed; BORDER-RIGHT: #000000 1px dashed; BORDER-TOP: #000000 1px dashed;' name='message' cols='64' rows='5' wrap='VIRTUAL'>".$message."</textarea><br>";
            ?>
         <input type="submit" name="Submit" value="确定" onClick="return checkSubmit()">                


         <input type="reset" name="Submit2" value="重写"></div></div></form>
          </td>
        </tr>
        <tr bgcolor='#eeeeee'>//如果是引用原文就显示
          <td><div align="center"><? if ($c==dd) echo "原文如下<br><div align='left'>".$mess;?></div></td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</body>
</html> 

PHP 相关文章推荐
PHP 5.0 Pear安装方法
Dec 06 PHP
用php实现像JSP,ASP里Application那样的全局变量
Jan 12 PHP
比file_get_contents稳定的curl_get_contents分享
Jan 11 PHP
PHP-Fcgi下PHP的执行时间设置方法
Aug 02 PHP
php通过隐藏表单控件获取到前两个页面的url
Sep 09 PHP
编写PHP脚本使WordPress的主题支持Widget侧边栏
Dec 14 PHP
PHP类和对象相关系统函数与运算符小结
Sep 28 PHP
PHP与jquery实时显示网站在线人数实例详解
Dec 02 PHP
Thinkphp开发--集成极光推送
Sep 15 PHP
laravel withCount 统计关联数量的方法
Oct 10 PHP
laravel5 Eloquent 实现事务方式
Oct 21 PHP
php模拟实现斗地主发牌
Apr 22 PHP
我的论坛源代码(五)
Oct 09 #PHP
杏林同学录(五)
Oct 09 #PHP
PHP的FTP学习(二)
Oct 09 #PHP
杏林同学录(四)
Oct 09 #PHP
PHP的FTP学习(一)
Oct 09 #PHP
PHP VS ASP
Oct 09 #PHP
用PHP来写记数器(详细介绍)
Oct 09 #PHP
You might like
利用Memcached在php下实现session机制 替换PHP的原生session支持
2010/08/21 PHP
分享一个php 的异常处理程序
2014/06/22 PHP
php获取flash尺寸详细数据的方法
2016/11/12 PHP
Laravel 5.4向IoC容器中添加自定义类的方法示例
2017/08/15 PHP
浅析PHP中的闭包和匿名函数
2017/12/25 PHP
PHP图像处理技术实例总结【绘图、水印、验证码、图像压缩】
2018/12/08 PHP
JavaScript 以对象为索引的关联数组
2010/05/19 Javascript
基于jQuery的Tab选项框效果代码(插件)
2011/03/01 Javascript
javascript中比较字符串是否相等的方法
2013/07/23 Javascript
JavaScript的常见兼容问题及相关解决方法(chrome/IE/firefox)
2013/12/31 Javascript
document.execCommand()的用法小结
2014/01/08 Javascript
JavaScript实现的使用键盘控制人物走动实例
2014/08/27 Javascript
JS DOMReady事件的六种实现方法总结
2016/11/23 Javascript
微信小程序 跳转方式总结
2017/04/20 Javascript
利用vscode编写vue的简单配置详解
2017/06/17 Javascript
微信小程序wx.uploadfile 本地文件转base64的实现代码
2018/06/28 Javascript
ES6 Map结构的应用实例分析
2019/06/26 Javascript
JQuery+drag.js上传图片并且实现图片拖曳
2020/11/18 jQuery
使用Django Form解决表单数据无法动态刷新的两种方法
2017/07/14 Python
Python简单实现两个任意字符串乘积的方法示例
2018/04/12 Python
PYTHON EVAL的用法及注意事项解析
2019/09/06 Python
python3.7 利用函数os pandas利用excel对文件名进行归类
2019/09/29 Python
Python实现序列化及csv文件读取
2020/01/19 Python
基于Python数据分析之pandas统计分析
2020/03/03 Python
Pandas将列表(List)转换为数据框(Dataframe)
2020/04/24 Python
Python 2.6.6升级到Python2.7.15的详细步骤
2020/12/14 Python
html5实现微信打飞机游戏
2014/03/27 HTML / CSS
英国异国风情旅游网站:Travel Talk Tours(团体旅游、探险旅游、帆船假期)
2018/07/26 全球购物
求职简历自荐信范文
2013/10/21 职场文书
公积金转移接收函
2014/01/11 职场文书
企业元宵节主持词
2014/03/25 职场文书
党支部公开承诺书
2014/03/28 职场文书
争先创优活动总结
2014/08/27 职场文书
房屋分割离婚协议书范本
2014/12/01 职场文书
给老婆的保证书怎么写
2015/05/08 职场文书
2016社区平安家庭事迹材料
2016/02/26 职场文书