我的论坛源代码(六)

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



回复论题:<? echo $zt;?>



include "linkfox.inc.php";               //包含进文件
include "info.inc.php";

function yy($f)
{
  $oldmess=@file($f);                                    //引用原文处理
  for ($i=0;$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 "";
          echo ";";
          echo "
如果系统没有反应,请点击";
        }
      else
      echo  "";
}
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="".$mess."
★原文……★……引用★

".$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 "";
         }
}

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

     echo "";
}

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="".$mess."
★原文……★……引用★

".$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);
}
}
?>



$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 "";


?>

  
    
    
    
    
    
  
  
    
   
    
    
    
  
  
    
    
    
    
      

      

    
       

      

    

     

    

      

    

      
当前位置:狐网─>狐网论坛─>回复主题:".$zt."";?>

    
    

    

      

    

      

    

      

     





  
    
  

      
        
          
        
        
          
        
        //如果是引用原文就显示
          
        
      
".$useinfo[2].""; ?> 你正在回复的主题是:[]

    

      if ($usename)  //不是注册用户就显示输入框输入游客信息。
      {
      echo "你的大名:";
      echo "OICQ:
";
      echo "来自何方:
";
      echo "电子信箱:
";
      echo "个人主页:
";
      echo "表情
";
      echo "";
      echo "";
      echo "";
      echo "
";
      }
      echo "
回复内容
";
      echo "
";
            ?>
                                   
         

          
".$mess;?>

    



 

你可能感兴趣的:(我的论坛源代码(六))