本页主题: [寻找]玩坛子的斑竹帮忙呀!!这个程序有什么问题??? 打印 | 加为IE收藏 | 复制链接 | 收藏主题 | 上一主题 | 下一主题

冲云霄
级别: 圣骑士


精华: 0
发帖: 208
威望: 58 点
金钱: 474 静电币
支持度: 0 点
在线时间:26(小时)
注册时间:2003-03-11
最后登录:2014-12-24

 [寻找]玩坛子的斑竹帮忙呀!!这个程序有什么问题???

我在CNVBB找到一个可以结合VBB的小的聊天室插件,安装后按照他的配置配置完后可以聊天了,但是总是显示页面文件有错误。现附上源码,给大家看一下。我的配置
-------------------------------------------------------------------------------------我的vbb的config.php文件全在这了[密码隐去]:


<?php
/////////////////////////////////////////////////////////////
// Please note that if you get any errors when connecting, //
// that you will need to email your host as we cannot tell //
// you what your specific values are supposed to be //
/////////////////////////////////////////////////////////////
// type of database running
// (only mysql is supported at the moment)
$dbservertype='mysql'
// hostname or ip of server
$servername='localhost'
// username and password to log onto db server
$dbusername='root'
$dbpassword='`123456;
// name of database
$dbname='vb232b'
// technical email address - any error messages will be emailed here
$technicalemail='web@dns008.com'
// use persistant connections to the database
// 0 = don't use
// 1 = use
$usepconnect=1;
?>
------------------------------------------------------------------------------------

我的chat.php文件配置:
--------------------------------------------------------------------------------------------------------------------
<?
function ubb2html($string) {
$string = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $string);
$string = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $string);
$string = preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>", $string);
$string = preg_replace("/\[p\](.*?)\[\/p\]/si", "<p>\\1</p>", $string);
$string = preg_replace("/\[code\](.*?)\[\/code\]/si", "<blockquote><pre>\\1</pre></blockquote>", $string);
$string = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "<blockquote>\\1</blockquote>", $string);
$string = preg_replace("/\[url\](http|https|ftp)(:\/\/\S+?)\[\/url\]/si","<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>", $string);
$string = preg_replace("/\[url\](\S+?)\[\/url\]/si","<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $string);
$string = preg_replace("/\[url=(http|https|ftp)(:\/\/\S+?)\](.*?)\[\/url\]/si","<a href=\"\\1\\2\" target=\"_blank\">\\3</a>", $string);
$string = preg_replace("/\[url=(\S+?)\](\S+?)\[\/url\]/si","<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $string);
$string = preg_replace("/\[email\](\S+?@\S+?\\.\S+?)\[\/email\]/si","<a href=\"mailto:\\1\">\\1</a>", $string);
$string = preg_replace("/\[email=(\S+?)\](.*?)\[\/email\]/si","<a href=\"mailto:\\1\">\\2</a>", $string);
$string = preg_replace("/\[img\](\S+?)\[\/img\]/si","<img src=\"\\1\" border=0 alt=\"\\1\">", $string);
$string = preg_replace("/\[color=(\S+?)\](.*?)\[\/color\]/si","<font color=\"\\1\">\\2</font>", $string);
$string = preg_replace("/\[size=(\S+?)\](.*?)\[\/size\]/si","<font size=\"\\1\">\\2</font>", $string);
$string = preg_replace("/\[font=(\S+?)\](.*?)\[\/font\]/si","<font face=\"\\1\">\\2</font>", $string);
$string = preg_replace("/\[fly\](.*?)\[\/fly\]/si", "<marquee behavior=alternate scrollamount=3 width=\"90%\">\\1</marquee>", $string);
return $string;
}
if(!$HTTP_COOKIE_VARS['chatuser']){

$db = @mysql_connect("localhost"/mysql,"root","`123456");mysql_select_db("vb232b",$db); // 请根据您的实际情况设置好

           $result = mysql_query("SELECT username FROM user WHERE userid='".$HTTP_COOKIE_VARS['bbuserid']."'",$db);
           $myrow = mysql_fetch_row($result);
           $user = $myrow[0];
           $HTTP_COOKIE_VARS['chatuser'] = $user;

     if (isset($db) && $db) {
           @mysql_close($db);
     }
     if (isset($result) && $result ){
           @mysql_free_result($result);
     }
}else $user = $HTTP_COOKIE_VARS['chatuser'];
if($user != ""){
     $how = 20; //缓冲记录数,如:在线数*$refresh_time

     $refresh_time=60; //刷新间隔(秒)

     $msg_w_height = "80%"; //信息窗口高度

     $data_file = "data.txt"; //记录文件


     if(!$msg && $init != Ƈ'){
           $data = file($data_file);

           list($data[0]) = explode("*",$data[0]);
           if($data[0] > 0){
                 $i = $data[0];
           }else $i = 0;
           $msg = "<script>";
           $us = array();
           while($a = each($data)){
                 list($s,$u,$t,$m) = explode("#*#",$a[1]);
                 list($t_h,$t_i,$t_s) = explode(":",$t);
                 if(date("H") == $t_h && date("i") <= $t_i+3)
                       $us[$u] = 1;
                 if($i>= $at || !$at){
                       if($u != "")$msg .= "top.addmsg('[<font color=#808080>$t</font> <font color=blue>$u</font>] $m<br>');";
                 }
                 $i++;
           }

           echo '<meta http-equiv="refresh" content="'.$refresh_time.'url=?at='.$i.'">'
echo '<html><head><meta http-equiv="content-type" content="text/html; charset=gb2312"></head><style type="text/css">
BODY, TD, TR {
     SCROLLBAR-BASE-COLOR: #FF9900;
     SCROLLBAR-ARROW-COLOR: #000000;
     font-size: 9pt; font-family: 宋体; letter-spacing: 1pt;
}
A {
     COLOR: #000020;
     TEXT-DECORATION: none;
}
A:hover {
     COLOR: #FF4400;
     TEXT-DECORATION: link;
}
</style><body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" style="font-family:宋体; font-size:9pt;">'
           $msg .= "top.nowat('".$i."');</script>";
           echo $msg;
           echo "在线用户: ";
           while($p = each($us)){
                 echo $p[0]." ";
           }
     }else if($init != Ƈ'){
           $fp = fopen( $data_file, "a");
           flock($fp,3);
           $msg=HTMLSpecialChars($msg);

           $msg = str_replace(":)", "<img src=images/smilies/smile.gif align=absmiddle>", $msg);
           $msg = str_replace(":)", "<img src=images/smilies/smile.gif align=absmiddle>", $msg);

           $msg = str_replace(":(", "<img src=images/smilies/frown.gif align=absmiddle>", $msg);
           $msg = str_replace(":(", "<img src=images/smilies/frown.gif align=absmiddle>", $msg);

           $msg = str_replace(":o", "<img src=images/smilies/redface.gif align=absmiddle>", $msg);

           $msg = str_replace(":D", "<img src=images/smilies/biggrin.gif align=absmiddle>", $msg);

           $msg = str_replace(";)", "<img src=images/smilies/wink.gif align=absmiddle>", $msg);
           $msg = str_replace(";)", "<img src=images/smilies/wink.gif align=absmiddle>", $msg);

           $msg = str_replace(":p", "<img src=images/smilies/tongue.gif align=absmiddle>", $msg);
           $msg = str_replace(":cool:", "<img src=images/smilies/cool.gif align=absmiddle>", $msg);
           $msg = str_replace(":rolleyes:", "<img src=images/smilies/rolleyes.gif align=absmiddle>", $msg);
           $msg = str_replace(":mad:", "<img src=images/smilies/mad.gif align=absmiddle>", $msg);
           $msg = str_replace(":eek:", "<img src=images/smilies/eek.gif align=absmiddle>", $msg);
           $msg = str_replace(":confused:", "<img src=images/smilies/confused.gif align=absmiddle>", $msg);

           $msg = ubb2html($msg);
           fputs($fp,"\n168#*#".$user."#*#".date("H:i:s")."#*#$msg#*#");
           flock($fp,4);
           fclose($fp);

           $data = file($data_file);
           list($data[0]) = explode("*",$data[0]);
           if($data[0] > 0){
                 $size = sizeof($data)+$data[0];
           }else $size = sizeof($data);
           if(sizeof($data) > $how+1){
                 $fp = fopen( $data_file, "w");
                 flock($fp,3);
                 fputs($fp,($size-$how-1)."*\n");

                 for($j=$how;$j>0;$j--)
                       fputs($fp,$data[sizeof($data)-$j]);
                 flock($fp,4);
                 fclose($fp);
           }
           echo '<meta http-equiv="refresh" content="0;url=?at='.($at).'">'
     }else{
     ?>
     <html>
     <head>
     <meta http-equiv="content-type" content="text/html; charset=gb2312">
     <meta name="generator" content="Namo WebEditor v5.0">
     </head>
<style type="text/css">
BODY, TD, TR {
     SCROLLBAR-BASE-COLOR: #FF9900;
     SCROLLBAR-ARROW-COLOR: #000000;
     font-size: 9pt; font-family: 宋体; letter-spacing: 1pt;
}
SELECT {
     FONT-FAMILY: MS Shell Dlg,Tahoma,sans-serif,宋体;
     FONT-SIZE: 12px;
     COLOR: #000000;
     BACKGROUND-COLOR: #CFCFCF
}
TEXTAREA, .bginput {
     FONT-SIZE: 12px;
     FONT-FAMILY: MS Shell Dlg,Tahoma,sans-serif,宋体;
     COLOR: #000000;
     BACKGROUND-COLOR: #CFCFCF
}
A:link, A:visited, A:active {
     COLOR: #000020;
     TEXT-DECORATION: link;
}
A {
     COLOR: #000020;
     TEXT-DECORATION: none;
}
A:hover {
     COLOR: #FF4400;
     TEXT-DECORATION: link;
}
#cat A:link, #cat A:visited, #cat A:active {
     COLOR: #000000;
     TEXT-DECORATION: none;
}
#cat A:hover {
     COLOR: #000000;
     TEXT-DECORATION: underline;
}
#ltlink A:link, #ltlink A:visited, #ltlink A:active {
     COLOR: #000020;
     TEXT-DECORATION: none;
}
#ltlink A:hover {
     COLOR: #FF4400;
     TEXT-DECORATION: underline;
}
.thtcolor {
     COLOR: #000000;
}

input{
height: 18px;
font-size:9pt;
}
.input_button{
     border-right: 1px solid #FFA500;
     height: 19px;
     position:relative; top:0; left:-2;
     background: url('images/button_bk.gif') no-repeat fixed;
     border-bottom: 1px solid #FFA500;
     padding-top: 2px; border-left-width:0px; border-top-width:0px
}
.input_text{
height: 18px;
border: 1px solid #FFA500; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1
}
select{
background-color: #FFA500; height:18; font-size:9pt; position:relative; top:2
}
.input_textarea{
border: 1px solid #FFA500
}
.bi {
     height: 18px;
     border: 1px solid #FFA500; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1;
     font-style: italic;
     font-weight: bold;
}
.b {
     height: 18px;
     border: 1px solid #FFA500; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1;
     font-weight: bold;
}
.i {
     height: 18px;
     border: 1px solid #FFA500; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1;
     font-style: italic;
}
</style>
<script>
function killErrors() {return true;}
window.onerror = killErrors;
</script>
     <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
     <IFRAME name=msgs
                       src="" frameBorder=0 width=100% scrolling=no
                       height=<?echo $msg_w_height;?>> <span class="sitestext"><font color="#FFFFFF">Sorry your browser
                       does not support IFRAMES. Go for a pint while you download a newer
                       browser!</font></span></IFRAME>
     <script>
           var b='',be='',i='',ie=''
           function cc(c){
                 f1.colors.value=c;
                 f1.msga.style.color=c;
                 f1.msga.focus();
           }
           function tb(){
                 if(b != '' && i != '')f1.msga.className="bi";
                 else if(b != '')f1.msga.className="b";
                 else if(i != '')f1.msga.className="i";
                 else f1.msga.className="input_text";
           }
     </script>
     <form name=f1 target="chat" method="post" action="chat.php" onsubmit="if(f1.msga.value==''){alert('不能发空白信息!');return false;}else{f1.msg.value=b+i+'[color='+f1.colors.value+']'+f1.msga.value+''+ie+be;f1.msga.value='' return true;}"><input type="text" name="msga" style="width=90%" maxlength="1024" class="input_text"><input type="submit" name="submit" value="发送" style="width=10%" class="input_button"><input type=hidden name=at id=at value=""><input type=hidden name=colors id=colors value="#000000"><input type=hidden name=msg value=""><table border="0" cellspacing="0" cellpadding="0" style="cursor:hand;">
<tr>
  <td width="2" bgcolor="#0000CC" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#336699" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#666666" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#66CC66" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#990000" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#CC6600" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#FF6600" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#990066" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#CC0066" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#FF6666" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#990099" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#FF3399" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#669900" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#CC6600" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#FF9900" onclick="cc(this.bgColor);"> </td>
  <td width="2" bgcolor="#000000" onclick="cc(this.bgColor);"> </td>
     <td width="2" > </td>
     <td bgcolor="#808080" onclick="if(b==''){b=''be=''this.bgColor='#c0c0c0'tb();}else{b=''be=''this.bgColor='#808080'tb();}"> B </td>
     <td width="2" > </td>
     <td bgcolor="#808080" onclick="if(i==''){i=''ie=''this.bgColor='#c0c0c0'tb();}else{i=''ie=''this.bgColor='#808080'tb();}"> I </td>
</tr>
</table></form>

     <script>
     msgs.document.write('<html><head><meta http-equiv="content-type" content="text/html; charset=gb2312"><meta name="generator" content="Namo WebEditor v5.0"></head><body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" style="font-family:宋体; font-size:9pt;line-height: 1.5;">');
     function addmsg(msg){
           msgs.document.write(msg+"\n");
     }
     function scroll(){
           msgs.window.scroll(0,msgs.document.body.scrollTop+100);
     }
     setInterval("scroll()",100);
     function nowat(at){
           f1.at.value=at;
     }
     </script>
     <IFRAME name=chat
                       src="chat.php" frameBorder=0 width=100% scrolling=no
                       height=18> <span class="sitestext"><font color="#FFFFFF">Sorry your browser
                       does not support IFRAMES. Go for a pint while you download a newer
                       browser!</font></span></IFRAME>
     </body>
     </html>
     <?
     }
}else{
     echo "你还未登录 , 请登录后再试:)";
}
?>
---------------------------------------------------------------------------------------------------------------------
关于chat.php页面的错误提示

——————————————————————————————————————————————


我的第22行:
if(!$HTTP_COOKIE_VARS['chatuser']){

我的第48行:
if(!$msg && $init != Ƈ'){

我的第59行:
list($s,$u,$t,$m) = explode("#*#",$a[1]);

我的第59行:
list($t_h,$t_i,$t_s) = explode(":",$t);

印象中也出过问题的第62行:
if($i>= $at || !$at){

————————————————————————————————————————————————

本人绝对菜鸟,看不出有什么问题。我说的是实话,别见笑。
Posted: 2004-04-02 09:28 | [楼 主]
小神
我不要头衔
级别: 贵宾


精华: 14
发帖: 15287
威望: 2803 点
金钱: 6689 静电币
支持度: 4413 点
在线时间:348(小时)
注册时间:2002-08-29
最后登录:2008-03-14

 

232的config.php原来这么复杂啊,我用3.0的说,很简单的
Posted: 2004-04-02 20:33 | 1 楼
帖子浏览记录 版块浏览记录
狗狗静电BBS - wwW.DoGGiEhoMe.CoM » 电脑全方位 Computer Guide

沪ICP备05008186号
Powered by PHPWind Styled by MagiColor