BBS(php amp;amp;amp; mysql)完整版(一)
分类:面向对象

//此页面为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 htmldiv id=Layer2 z-index:1BRBRBRBWrangler; echo div id=Layer3 z-index:2img src=pic/3.gif width=15 height=15/div; echodiv ;echo pfont size=2 color=#FF33CC嘻嘻!! 请首先登场入/font/p; echopfont size=2 color=#FF33CCa href='.$PHP_SELF.?p=1&&table=$table'返回/a/font/p /div /html; exit(); } else $userid=$row[userid]; if($okState of Qatar { if($title==||$content==卡塔尔国 { echo B路虎极光请你添完整后交由; } 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;$i6;$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 titlexiaoyang/title meta 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.2fwLoadMenus();/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:7form name=form1 method=post action=? echo $PHP_SELF ? table width=98% border=1 cellspacing=0 cellpadding=0 bordercolor=#FF99FF trtd width=26% height=42div align=centerfont size=2 color=#FF33FF题目/font/div /td td width=74% height=42input 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 trtd width=26% height=172div align=centerfont size=2 color=#FF33FF内容/font/div /td td width=74% height=172textarea 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:8hr color=#ff9999 noshade /div div id=goback style=position:absolute; left:461px; top:23px; width:120px; height:16px; z-index:9div align=centera href=php3.php?p=1&&table=?echo $table ;? target=_self onMouseover=window.status='' ;return truefont size=2 color=#FF33FF返回/font/a/div /div p/p p/p /body /html

//此页面为look.php ? include signup/mysql.inc; $sql=select * from .$table. where id='$id'; $result=mysql_query($sql)or die(mysql_error()); $row=mysql_fetch_array($result); $number=++$row[number]; $sql=update $table set number='$number' where id='$id'; mysql_query($sql)or die(mysql_error()); ? html head titlexiaoyang/title meta content=text/html; charset=gb2312 ? include js/menuhead.php ? 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 ? include js/menu.php; ? div id=Layer6 style=position:absolute; left:409px; top:29px; width:118px; height:17px; z-index:1/div div id=Layer5 style=position:absolute; left:63px; top:61px; width:464px; height:303px; z-index:2table width=100% border=1 cellspacing=0 cellpadding=0 bordercolor=#FFCCFF trtd width=22% height=17div align=centerfont color=#FF3399 size=2题目/font/div /td td width=78% height=17 div align=centerfont size=2 color=#9966FF?echo $row[title] ;?/font /div /td /tr trtd width=22% height=24div align=centerfont color=#FF3399 size=2作者/font/div /td td width=78% height=24div align=centerfont size=2 color=#9966FF?echo $row[userid] ;?/font /div /td /tr trtd width=22%div align=centerfont color=#FF3399 size=2内容/font/div /td td width=78% div align=leftfont size=2 color=#9966FF? $file=explode(n,$row[content]); $num=count($file); for($i=0 ;$i$num;$i++) echo .$file[$i].B卡宴;?/font/div /td /tr /table ? for($j=1;$j6;$j++卡塔尔国//展现回复内容 { $re=r.$j; if($row[$re]) { $id2=$row[$re]; $sql=select * from bbs_re where id='$id2'; $result=mysql_query($sql)or die(mysql_error()); $row8=mysql_fetch_array($result); echo BR; echo table width=100% border=1 cellspacing=0 cellpadding=0bordercolor=#FFCCFFtr;echo td width=22% height=17div font color=#FF3399 size=2题目/font/div; echo /tdtd width=78% height=17; echo div font size=2 color=#9966FF.$row8[title]./font /div/td /trtr;echo td width=22% height=24;echo div font color=#FF3399 size=2作者/font/div/td; echo td width=78% height=24;echo div font size=2 color=#9966FF.$row8[userid]. /font /div/td /trtr;echo td width=22%div font color=#FF3399 size=2内容/font/div; echo /td td width=78%; echo div align=leftfont size=2 color=#9966FF; $file=explode(n,$row8[content]); $num=count($file); for($i=0 ;$i$num;$i++) echo .$file[$i].BR; echo /font/div; echo /td/tr/table; } } ? BRBR /div div id=back style=position:absolute; left:455px; top:30px; width:85px; height:3px; z-index:3hr color=#ff9999 noshade /div div id=goback style=position:absolute; left:461px; top:23px; width:120px; height:16px; z-index:2div align=centera href=php3.php?p=1&&table=?echo $table ;? target=_self onMouseOver=window.status=''; return truefont size=2 color=#FF33FF返回/font/a/div /div div id=Lay style=position:absolute; left:70px; top:30px; width:85px; height:3px; z-index:4 hr noshade color=#ff9999 /div div id=Laye style=position:absolute; left:78px; top:23px; width:120px; height:16px; z-index:1div align=centera href=say.php?id1=? echo $id.&&table=.$table ;? target=_self onMouseOver=window.status='';return truefont size=2 color=#FF33FF回复/font/a/div /div p/p p/p /body /html

//此页面为php3.php ? include signup/mysql.inc; switch($part卡塔尔国{ case 1 :$table=bbs_php;break; case 2 :$table=bbs_mysql;break; case 3 :$table=bbs_html;break; case 4 :$table=bbs_js; } //echo $part; ? html head titlexiaoyang/title meta 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.2fwLoadMenus();/script/div div id=Layer2 style=position:absolute; left:27px; top:41px; width:600px; height:15px; z-index:2 hr color=#ff9999 /div div id=Layer3 style=position:absolute; left:73px; top:10px; width:2px; height:330px; z-index:3; background-color: #ff9999; layer-background-color: #ff9999; border: 1px none #000000/div div id=Layer4 style=position:absolute; left:560px; top:10px; width:2px; height:330px; z-index:4; background-color: #ff9999; layer-background-color: #ff9999; border: 1px none #000000/div div id=Layer5 style=position:absolute; left:86px; top:58px; width:464px; height:273px; z-index:5table width=100% border=0 cellspacing=1 cellpadding=0 height=20 trtd width=10%div align=centerfont color=#CC33CC size=2人气/font/div /td td width=38%div align=centerfont color=#CC33CC size=2文章题目/font/div /td td width=26%div align=centerfont size=2 color=#CC33CC作者/font/div /td td width=26%div align=centerfont color=#CC33CC size=2日期/font/div /td /tr ?$sql=select * from .$table. order by row DESC; $result=mysql_query($sql)or die(mysql_error()); $row1=mysql_num_rows($result); $row_max_page=12;//分页总结 $page=ceil($row1/$row_max_page); $left_row=$row1-$p*$row_max_page; $pre_left_row=$left_row+12; $start_row=$left_row+$row_max_page+1; if($left_row=0) { $start_row=$pre_left_row+1; $left_row=0; } $sql=select * from .$table. where row'$start_row' and row'$left_row' order by row DESC; $result=mysql_query($sql)or die(mysql_error()); while($row=mysql_fetch_array($result)){ static $i=0; $i++; if($i%2) $color=CCCCFF; else $color=FFCCFF; echo tr;echo td width=10% bgcolor=#.$color. ; echo div font size=2 color=#3333FF.$row[number]./font/div; echo /td; echo td width=38% bgcolor=#.$color. ; echo div font size=2 color=#3333FFahref='look.php?id=.$row[id].&&table=.$table.'.$row[title]./a/font/div; echo /td; echo td width=26% bgcolor=#.$color. ; echo div font size=2 color=#3333FF.$row[userid]./font/div; echo /td; echo td width=26% bgcolor=#.$color. ; echo div font size=2 color=#3333FF.$row[date1]./font/div; echo /td/tr; } echo/table;echo BRdiv tabletrtdFONT SIZE=2 ; for($i=1;$i=$page;$i++) { echo a href='.$PHP_SELF.?p=.$i.&&table=.$table.'[.$i.]/a; } ? /FONT/td/tr /table/div /div div id=Layer6 style=position:absolute; left:409px; top:29px; width:118px; height:17px; z-index:6/div div id=Layer7 style=position:absolute; left:451px; top:28px; width:65px; height:12px; z-index:8a href=say.php?table=?echo $table ;? target=_self onMouseOver=window.status='';return truefont size=2 color=#FF33FF小编要发言/font/a/div p/p p/p /body /html

//第二页面 name=frame2.php ? include ../signup/mysql.php; header(Expires: Sun, 28 Dec 1996 09:32:45 链霉素T卡塔尔; header(Cache-Control: no-cache, must-revalidate卡塔尔(قطر‎; header(Pragma: no-cache卡塔尔(قطر‎; header(Content-Type: text/html; charset=${Charset}卡塔尔; $current_time=time(); $delete_time=$current_time-40; $sql=delete from chat_user where last_time.$delete_time; mysql_query($sql)or die( false again); $sql=update chat_user set last_time='$current_time' where userid='$userid'; mysql_query($sql) or die(false); $sql=select userid from chat_user; $result=mysql_query($sql)or die(fallse); $online=mysql_num_rows($result); ? html head titleuser list/title meta content=text/html; charset=gb2312 meta content=30; url=? echo $PHP_SELF; ??userid=?echo $userid? /head body bgcolor=#6699FF text=#000000 div id=Layer1 style=position:absolute; left:9px; top:37px; width:94px; height:21px; z-index:1div align=centerfont color=#FF9999b在眼线数/b/font/div /div div id=Layer2 style=position:absolute; left:14px; top:96px; width:105px; height:276px; z-index:2pifont size=2 color=#FF9999 ?$sql=select userid,id,sex from chat_user; $result=mysql_query($sql)or die(fallse); while($row=mysql_fetch_array($result)){ $user=$row['userid']; $user=a href='.$PHP_SELF.?userid=.$userid.' onCLick=parent.bottom.user('.$row[id].').$row[id]; echo $user./a(.$row[sex].)br; } ? /font/i/p p/p /div div id=Layer3 style=position:absolute; left:20px; top:62px; width:74px; height:11px; z-index:3div align=centerfont size=2 color=#FF9999(?echo $online ;?人)/font/div /div p/p p/p /body /html

本文由10bet手机官网发布于面向对象,转载请注明出处:BBS(php amp;amp;amp; mysql)完整版(一)

上一篇:用PHP和ACCESS写聊天室,隐藏密码 下一篇:正则表达式中的特殊字符,正则表达式详述
猜你喜欢
热门排行
精彩图文