我的论坛源代码(六)

POST.PHP发布主题的页面,发布的信息提交到OKEY.PHP中去处理。 html head
title论坛发帖/title meta 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 ?
include linkfox.inc.php; include info.inc.php; ? LINK href=js/cpcw.css
rel=stylesheet /LINK /head body bgcolor=#FFFFFF ?
$tem=$HTTP_COOKIE_VARS[FlyFoxNet];//取COOKIE信息
$temp=explode(|,$tem); $cookiem=$temp[0];
$useinfo=cuser($cookiem,$action); if ($useinfo[2]==游客) $usename=1; ?
table width=100% cellpadding=4 cellspacing=0 border=0 tr td height=40
rowspan=2 width=60% div align=right/div div align=right/div /td td
height=20 width=10%/td td height=20 width=10%/td td height=20
width=10%/td td height=20 width=10%/td /tr tr td height=20 width=10% div
align=centera href=reguse.php?action=xyimg src=images/top_register.gif
width=74 height=21 border=0/a/div /td td height=20 width=10% div
align=centera href=useinfo.php?action=findimg
src=images/top_members.gif width=74 height=21 border=0/a/div /td td
height=20 width=10%a href=useinfo.php?action=editimg
src=images/top_profile.gif width=74 height=21 border=0/a/td td
height=20 width=10%a href=okey.php?d=qimg src=images/top_logout.gif
width=74 height=21 border=0/a/td /tr tr td height=20 div
align=left当前位置:font color=#0000FF狐网─狐网论坛─发布论题/font ?
echo font color=’00dd00′.$useinfo[2]./font; ?/div /td td height=20 div
align=centera href=foxbbs.phpimg src=images/index.gif width=70 height=20
border=0 align=middle/a/div /td td height=20 width=10% div align=centera
href=superuse.phpimg src=images/super.gif width=70 height=20 border=0
align=middle/a/div /td td height=20 width=10% div align=centera
href=reguse.php?action=xyimg src=images/dl.gif width=70 height=20
border=0 align=middle/a/div /td td height=20 width=10% div align=centera
href=../index.phpimg src=images/fox.gif width=70 height=20 border=0
align=middle/a/div /td /tr /table script
language=JavaScript//这段JS用来检查表单内信息状态,是不是有点眼熟?呵呵……OSO上CUT下来的了。
!– var submitcount=0; function checkSubmit() { if (submitcount == 0) {
submitcount++; return true; } else { if (submitcount0){
alert(帖子已成功提交了,别急,等等!); return false; } } } function
check_com(){ if(document.form.title.value.length ==0){ submitcount–;
alert(主题不能为空!快填上吧!); return false; }
if(document.form.message.value.length == 0){ submitcount–;
alert(OH!SORRY!加贴内容不能为空!); return false; } return true; } //–
/script table width=100% border=0 cellspacing=0 cellpadding=0 tr
bgcolor=#009999 td height=20div align=’center’font color=ffffff
?//在前面检查是否用户时给$USEINFO[0]赋了用户信息。 if ($useinfo[0])
echo font color=’00ff00′[.$useinfo[2].]/font
你好!请在下面填写你的贴子。; else echo font
color=’00ff00′.$useinfo[2]./font你好,请先登录,再发帖,如果你还未注册,请先注册吧!;
?/font/div /td /tr tr td height=20 /td /tr tr td height=20 class=bott
table width=65% border=0 cellspacing=0 cellpadding=0 align=center tr td
height=100 div align=left form name=form method=post onSubmit=return
check_com() ACTION=’okey.php’ ? if
($usename==1)//前面检查时如果没找到信息,则给$usename赋值为1,这里,用来判断是否需要用户身份校验。
{ echo 用户名:input 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=’username’ maxlength=’8′ size=’20’ 如果你还未注册,就来a
href=’reguse.php?action=xy’这里注册/abr; echo 密 码:input
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=’password’ name=’userpass’
size=’20’ maxlength=’8′ 忘了密码来这里a
href=’useinfo.php?c=pass’取回密码/a!p; } ? div align=center主 题:input
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=title size=40
maxlength=20/divbr div align=center帖子内容br textarea
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 wrap=VIRTUAL cols=75
rows=10/textarea input type=submit class=bott name=Submit
value=好了!提交 onClick=return checkSubmit()input type=reset class=bott
name=Submit2 value=擦了!重写 /div /form /div /td /tr /table /td /tr tr
bgcolor=#009999 td height=20/td /tr /table /body /html

repal.php回复用的页面,因为回复可以不必要是用户,所以没加用户身份校验
html head title回复论题:? echo $zt;?/title meta 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;$icount($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 echoscript 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/fontbr.$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=$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/fontbr.$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;$i10;$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=centera
href=reguse.php?action=xyimg src=images/top_register.gif width=74
height=21 border=0/a/div /td td height=20 width=10% div align=centera
href=useinfo.php?action=findimg src=images/top_members.gif width=74
height=21 border=0/a/div /td td height=20 width=10%a
href=useinfo.php?action=editimg src=images/top_profile.gif width=74
height=21 border=0/a/td td height=20 width=10%a href=okey.php?d=qimg
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 tddiv align=centera
href=foxbbs.phpimg src=images/index.gif width=70 height=20 border=0
align=middle/a/div /td td height=20 width=10% div align=centera
href=superuse.phpimg src=images/super.gif width=70 height=20 border=0
align=middle/a/div /td td height=20 width=10% div align=centera
href=reguse.php?action=xyimg src=images/dl.gif width=70 height=20
border=0 align=middle/a/div /td td height=20 width=10% div align=centera
href=../index.phpimg 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 (submitcount0){
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′ tddiv
align=centerfont 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=postdiv 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 表情brinput 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./textareabr; ?
input type=submit name=Submit value=确定 onClick=return checkSubmit()
input type=reset name=Submit2 value=重写/div/div/form /td /tr tr
bgcolor=’#eeeeee’//如果是引用原文就显示 tddiv align=center? if ($c==dd)
echo 原文如下brdiv align=’left’.$mess;?/div/td /tr /table /td /tr /table
/body /html