Discuz Thai

 ลืมรหัสผ่าน
 สมัครสมาชิก

ข้อตกลงการใช้งานกระดานข่าวดิสคัสไทย DiscuzThai Agreement (English Version) ประกาศดิสคัสไทย - ทำเนียบดิสคัสภาษาไทย

Discuz! X3.5 Thai R20231001 Rev.8 (NEW) [วิดีโอช่วยสอน] อัปเกรด Discuz! X3.4 เป็น X3.5 Discord ของ Discuz! Thai Community อย่างเป็นทางการ

Discuz! X3.4 Thai R20220811 (REV.75) สิ้นสุดการสนับสนุน Discuz! X3.4 ภาษาไทยตั้งแต่วันนี้เป็นต้นไป (ขอแนะนำให้อัปเกรดเป็น X3.5 แทน)

ค้นหา
แท็กยอดนิยม: ดิสคัสภาษาไทย Discuz Thai
เจ้าของ: Natz

[Plugin6.0] Shoutbox 2.1 by ROA Update 15/11/2007

 ปิด [คัดลอกลิงก์]
xman โพสต์ 2007-11-15 12:14:18
help  me


table>
Discuz! info: MySQL Query Error

User: admin
Time: 2007-11-15 1:09pm
Script: /shoutbox.php

SQL: SELECT s.*, m.uid, m.groupid,m.username, u.color AS groupcolor FROM [Table]shoutbox s
LEFT JOIN [Table]members m ON m.uid=s.uid
LEFT JOIN [Table]usergroups u ON u.groupid=m.groupid WHERE s.last_time > Cache List ORDER BY s.id ASC LIMIT 0,50
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'List ORDER BY s.id ASC LIMIT 0,50' at line 3
Errno.: 1064

Similar error report has beed dispatched to administrator before.

: settings usergroup_1 style_
Caches successfully created, please refresh.
suthida โพสต์ 2007-11-15 12:39:17
  รองลบฐานข้อมูลตัวเก่า และลงใหม่ยังค่ะ เคยเป็นเหมือนกันค่ะแบบเนี่ย ลบฐานและลงใหม่ก็หายนะคะ
xman โพสต์ 2007-11-15 13:04:18
ลบ-ลงหลายรอบแล้ว  ก็ยังไม่หายครับ งงจริงๆ

MySQL client version: 5.0.45

[ แก้ไขล่าสุด xman เมื่อ 2007-11-15 13:06 ]
ntf โพสต์ 2007-11-15 13:08:58
shoutbox.js :
change to
function handle_response(request) {
        var LastMsgInfo = '';
        Element.hide('loading');
        var response = request.responseText;
        LastMsgInfo = response.substring(0, 10);
        if (LastMsgInfo == 'shoutError') {
               

                 error = response.substring(10 , response.length);
                 Element.show('shout_error');
                 var shoutbox = $('shout_error_msg');
                 shoutbox.innerHTML = error + '\n';
                         Element.hide('shout_error');
                 
                shout_msg.innerHTML='System:'+error+'\n <br />'+shout_msg.innerHTML;
                 
                 
        } else if (LastMsgInfo == 'PostedInDB') {
                get_messages();
        } else if (LastMsgInfo != LastMsg) {
                LastMsg = LastMsgInfo;
                messages = response.substring(10, response.length);
                var shoutbox = $('shout_msg');
                shout_display(shoutbox.innerHTML);
                shoutbox.innerHTML = messages + shoutbox.innerHTML +'\n';
        }
        if (posting == true) {
                setTimeout('input_disable(false)', 500);
                if (LastMsgInfo != 'shoutError') $('req_message').value = '';
                $('req_message').focus();
                posting = false;
        }
        $('shout_msg').scrollTop = 0;
}


shoutbox.php
  1. <?php
  2. // Designed by ROA
  3. // Edited by ntf
  4.        
  5. require_once './include/common.inc.php';
  6. require_once DISCUZ_ROOT.'./include/discuzcode.func.php';


  7. session_start();
  8. header('Expires: Thu, 21 Jul 1977 07:30:00 GMT+8');
  9. header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT+8');
  10. header('Cache-Control: post-check=0, pre-check=0', false);
  11. header('Pragma: no-cache');
  12. header('Content-type: text/html; charset='.$charset);

  13. $msg_max = 15;
  14. $msg_maxlength = 180;

  15. function utf8RawUrlDecode ($source) {
  16.     $decodedStr = "";
  17.     $pos = 0;
  18.     $len = strlen ($source);
  19.     while ($pos < $len) {
  20.         $charAt = substr ($source, $pos, 1);
  21.         if ($charAt == '%') {
  22.             $pos++;
  23.             $charAt = substr ($source, $pos, 1);
  24.             if ($charAt == 'u') {
  25.                 $pos++;
  26.                 $unicodeHexVal = substr ($source, $pos, 4);
  27.                 $unicode = hexdec ($unicodeHexVal);
  28.                 $entity = "&#". $unicode . ';';
  29.                 $decodedStr .= utf8_encode ($entity);
  30.                 $pos += 4;
  31.             }
  32.             else {
  33.                 $hexVal = substr ($source, $pos, 2);
  34.                 $decodedStr .= chr (hexdec ($hexVal));
  35.                 $pos += 2;
  36.             }
  37.         } else {
  38.             $decodedStr .= $charAt;
  39.             $pos++;
  40.         }
  41.     }
  42.     return $decodedStr;
  43. }

  44. function chatfunction($functioncode,$isforadmin=''){
  45.          global $adminid,$req_message;
  46.                if($adminid!='1' && $isforadmin=='1'){
  47.                 return false;
  48.                }
  49.                
  50.             $codelong=strlen($functioncode);
  51.         if(substr($req_message, 0,$codelong+1)=="/{$functioncode}"){
  52.         return true;
  53.         }else{
  54.         return false;
  55.         }
  56. }

  57. if (isset($ajax)) {
  58.         if (!$discuz_uid){
  59.                 if(isset($_POST['ajax'])){
  60.                 exit('shoutError'.'??????????.');
  61.                 }else{
  62.                 exit;
  63.                 }
  64.     }
  65.         if (isset($_POST['ajax'])) {
  66.                 $uid = $discuz_uid;
  67.                 $timer = gmdate("$dateformat $timeformat", $timestamp + $timeoffset * 3600);
  68.                 $deltime = $timestamp;
  69.                 $req_message = utf8RawUrlDecode($req_message);
  70.                
  71.                 $req_message=mb_convert_encoding($req_message,"BIG5","UTF-8");
  72.                
  73. $req_message = preg_replace('#(^|\s)([a-z]+://([^\s\w/]?[\w/])*)#is', '\\1[url]\\2[/url]', $req_message);
  74. $req_message = preg_replace('#(^|\s)((www|ftp)\.([^\s\w/]?[\w/])*)#is', '\\1[url]\\2[/url]', $req_message);
  75. $req_message = preg_replace('#(^|\s)(([a-z0-9._%+-]+)@(([.-]?[a-z0-9])*))#is', '\\1[email]\\2[/email]', $req_message);
  76. $req_message = preg_replace('#(^|\s)((www|ftp)\.([^\s\w/]?[\w/])*)#is', '\\1[url]\\2[/url]', $req_message);

  77.                 $req_message=dhtmlspecialchars($req_message);

  78.                 if (!$uid){
  79.                         exit('shoutError'.'You do not have enough posts required to use the Shoutbox.');
  80.                 }else if ($req_message == ''){
  81.                      exit('shoutError'.'???????????');
  82.                 }else if (strlen($req_message) > $msg_maxlength){
  83.                         exit('shoutError'.'??????????');
  84.         }
  85.         
  86.         if(substr($req_message, 0, 1)=='/'){ // Chat Function
  87.         
  88.         if(chatfunction('PM')){ //PM
  89.    $explodemessage=explode(' ',$req_message);
  90. $query = $db->query("SELECT uid FROM `{$tablepre}members` Where `username`='$explodemessage[1]' LIMIT 1");
  91. $sentuser = $db->fetch_array($query);
  92. if(!$sentuser[uid]){
  93. exit('shoutError'.'??????'); }

  94. $sqlmsg='';
  95. foreach($explodemessage as $key => $value){
  96.                 if(in_array($key,array('0','1'))){continue;}
  97.                 $sqlmsg.=' '.$value;
  98. }

  99.         $db->query("INSERT INTO {$tablepre}shoutbox (uid, message, color, timer, deltime, msgtoid ) VALUES ('$uid', '$sqlmsg', 'blue', '$timer', '$deltime','$sentuser[uid]')");
  100.         
  101.         }elseif(chatfunction('SYSTEMECHO','1')){ // SYSTEM MESSAGE

  102.                $explodemessage=explode(' ',$req_message);
  103.                $sqlmsg='';
  104. foreach($explodemessage as $key => $value){
  105.                 if(in_array($key,array('0'))){continue;}
  106.                 $sqlmsg.=' '.$value;
  107. }
  108.        $db->query("INSERT INTO {$tablepre}shoutbox (uid, message, color, timer, deltime, msgtoid ) VALUES ('0', '$sqlmsg', 'red', '$timer', '$deltime','-1')");
  109.         
  110.        }elseif(chatfunction('CLEAR','1')){ // SYSTEM MESSAGE
  111.         $db->query("TRUNCATE TABLE `cdb_shoutbox` ");
  112.          
  113.          exit('shoutError'.'[??]????????');
  114.          
  115.        }elseif(chatfunction('DELETEUIDMSG','1')){ // SYSTEM MESSAGE
  116.                  
  117.                     $explodemessage=explode(' ',$req_message);
  118.          $db->query("DELETE FROM `{$tablepre}shoutbox` WHERE  `uid`='$explodemessage[1]' LIMIT 1");
  119.         
  120.          exit('shoutError'.'UID:'.$explodemessage[1].' Message clear.');
  121.        }elseif(chatfunction('SHOWONLINE','1')){ // SHOW ONLINE
  122.                  
  123.                $onlines=$comm='';
  124.                 $onlines='User Online List: ';
  125.         $query = $db->query("SELECT s.*, m.uid, m.groupid,m.username, u.color AS groupcolor FROM {$tablepre}shoutbox s
  126.                 LEFT JOIN {$tablepre}members m ON m.uid=s.uid
  127.                 LEFT JOIN {$tablepre}usergroups u ON u.groupid=m.groupid GROUP BY m.uid");
  128.         while($onlineuesr = $db->fetch_array($query)) {
  129.                 if($onlineuesr['username']==''){continue;}
  130.                 $onlines .=$comm;
  131.                 $onlines .=$onlineuesr['groupcolor'] ? '<font color="'.$onlineuesr['groupcolor'].'">'.$onlineuesr['username'].'</font>' : $onlineuesr['username'];
  132.                 $comm=',';
  133.         }

  134.            $db->query("INSERT INTO {$tablepre}shoutbox (uid, message, color, timer, deltime, msgtoid ) VALUES ('0', '$onlines', 'blue', '$timer', '$deltime','$discuz_uid')");
  135.        }else{
  136.          
  137.             exit('shoutError'.'???????????` / `???????');
  138.         }
  139.         }else{ //FUNCTION END
  140.         
  141.                 $db->query("INSERT INTO {$tablepre}shoutbox (uid, message, color, timer, deltime) VALUES ('$uid', '$req_message', '$req_color', '$timer', '$deltime')");
  142.                 }
คัดลอกไปที่คลิปบอร์ด

[ แก้ไขล่าสุด ntf เมื่อ 2007-11-15 14:10 ]
ntf โพสต์ 2007-11-15 13:10:27
  1.                
  2.                
  3.                 $num = $db->result($db->query("SELECT COUNT(id) FROM {$tablepre}shoutbox"), 0);
  4.                 $msg_limit = ($num-$msg_max <= 0) ? 0 : ($num-$msg_max);

  5.                 if($msg_limit>0){
  6.                 $query = $db->query("SELECT * FROM {$tablepre}shoutbox  ORDER BY id ASC LIMIT ".$msg_limit);
  7.                                $ids=$comm='';
  8.                 while ($del_msg = $db->fetch_array($query)) {
  9.                 //        if(!in_array($del_msg[msgtoid],array('0',$discuz_uid))){ continue; }
  10.                         $ids.=$comm.'\''.$del_msg['id'].'\'';
  11.                         $comm=',';
  12.                 }

  13.                         if($ids){        $db->query("DELETE FROM `{$tablepre}shoutbox` WHERE  `id`IN($ids) LIMIT 1");}
  14.                 }
  15.                 exit('PostedInDB');
  16.         }

  17.         $response = '';
  18.         $cur_msg_txt = '';
  19.         $new_msg_time = false;
  20.         $last_msg_time = $last_msg;
  21.     $last_msg=intval($last_msg);
  22.    

  23.         if ($last_msg) {
  24.                 $query = "WHERE s.deltime > ".$last_msg_time." AND (s.msgtoid IN('0','$discuz_uid','-1') or s.uid IN('$discuz_uid')) ORDER BY s.id ASC LIMIT 0,50";
  25.         } else {
  26.                 $new_msg_time = true;
  27.                 $query = "WHERE (s.msgtoid IN('0','$discuz_uid','-1') or s.uid IN('$discuz_uid')) ORDER BY s.id DESC LIMIT $msg_max";
  28.         }
  29.        

  30.    
  31.         $query = $db->query("SELECT s.*, m.uid, m.groupid,m.username, u.color AS groupcolor FROM {$tablepre}shoutbox s
  32.                 LEFT JOIN {$tablepre}members m ON m.uid=s.uid
  33.                 LEFT JOIN {$tablepre}usergroups u ON u.groupid=m.groupid ".$query);
  34.         while($cur_msg = $db->fetch_array($query)) {
  35.                
  36.                
  37.                 if ($new_msg_time == true) {
  38.                         $last_msg_time = $cur_msg['deltime'];
  39.                         $new_msg_time = false;
  40.                 } else if ($last_msg) {
  41.                         $last_msg_time = $cur_msg['deltime'];
  42.                 }
  43.                 $name = $cur_msg['groupcolor'] ? '<font color="'.$cur_msg['groupcolor'].'">'.$cur_msg['username'].'</font>' : $cur_msg['username'];
  44.                 $message = $cur_msg['message'];
  45.                 $message=str_replace(' ','&nbsp', $message);
  46.                 $message = ($cur_msg['color']=='default') ? $message : '<span style="color:'.$cur_msg['color'].'">'.$message.'</span>';


  47.                 $cur_msg_txt = '(<timer>) <b><username></b> : <message>
  48. ';
  49.                 $cur_msg_txt = str_replace('<timer>', $cur_msg['timer'], $cur_msg_txt);
  50.                 if($cur_msg['msgtoid']=='-1'){ // system
  51.                 $cur_msg_txt = str_replace('<username>', '<span style="color:'.$cur_msg['color'].'">[??]</span>', $cur_msg_txt);
  52.                 }elseif($cur_msg['msgtoid']==$discuz_uid && !$cur_msg['uid']){ // User System Message
  53.         $cur_msg_txt = str_replace('<username>', 'From <span style="color:'.$cur_msg['color'].'">[??]</span>', $cur_msg_txt);
  54.                 }elseif($cur_msg['msgtoid']>0 && $cur_msg[uid]!=$discuz_uid){ // pm
  55.                 $cur_msg_txt = str_replace('<username>', '[??]  From <a href="space.php?action=viewpro&uid='.$cur_msg['uid'].'" style="color:'.$cur_msg['color'].'">'.$name.'</a>', $cur_msg_txt);
  56.         }elseif($cur_msg['msgtoid']>0 && $cur_msg[uid]==$discuz_uid){ // pm to other
  57.                 $cur_msg_txt = str_replace('<username>', '[??]  To <a href="space.php?action=viewpro&uid='.$cur_msg['msgtoid'].'" style="color:'.$cur_msg['color'].'">UID '.$cur_msg['msgtoid'].'</a>', $cur_msg_txt);

  58.                 }else{
  59.                 $cur_msg_txt = str_replace('<username>', '<a href="space.php?action=viewpro&uid='.$cur_msg['uid'].'">'.$name.'</a>', $cur_msg_txt);
  60.                 }
  61.                 $cur_msg_txt = str_replace('<message>', discuzcode($message, 0, 0, 1), $cur_msg_txt);
  62.                
  63.                 $response .= "<div id='shout_msg_".$last_msg_time."'>".$cur_msg_txt . "</div>\n";
  64.         }
  65.         if (!$response){
  66.                 $response = $last_msg_time;
  67.         }else{
  68.                 $response = $last_msg_time.$response;
  69.         }
  70.        
  71. //        $response=@mb_convert_encoding($response, "BIG5", "UTF-8");
  72.        
  73.         exit($response);
  74. }



  75. if (isset($smilies_list)) {
  76.         require_once DISCUZ_ROOT.'./forumdata/cache/cache_post.php';
  77.         require_once DISCUZ_ROOT.'./include/post.func.php';
  78.         $smile = isset($_DCOOKIE['smile']) ? explode('D', $_DCOOKIE['smile']) : array();
  79.         $stypeid = intval($stypeid ? $stypeid : $smile[0]);
  80.         $stypeid = isset($_DCACHE['smileytypes'][$stypeid]) ? $stypeid : (isset($_DCACHE['smileytypes'][STYPEID]) ? STYPEID : key($_DCACHE['smileytypes']));
  81.         $smilies = $_DCACHE['smilies_display'][$stypeid];
  82.      $smcols='10';
  83.         $page = max(1, intval(isset($_GET['page']) ? $_GET['page'] : (!isset($_GET['stypeid']) || $_GET['stypeid'] == $smile[0] ? $smile[1] : 1)));
  84.         $spp = $smcols * $smrows;
  85.         //$multipage = multi(count($smilies), $spp, $page, 'post.php?action=smilies&stypeid='.$stypeid, 0, 10, FALSE, TRUE);
  86.        // $smilies = arrayslice($smilies, $spp * ($page - 1), $spp);

  87.         dsetcookie('smile', $stypeid.'D'.$page, 86400 * 365);
  88. ?>

  89. <h4>??</h4>

  90. <table summary="smilies" cellpadding="0" cellspacing="0">
  91. <tr align="center"><? $i=0; if(is_array($smilies)) { foreach($smilies as $key => $smiley) { ?>        
  92.         <? if(!($i % $smcols)) { if($i) { ?></tr><? } ?><tr height="<? echo ($smthumb + 6);; ?>"><? }
  93.         
  94.         $thissmiliescode=preg_replace('/\//','',$_DCACHE['smilies']['searcharray'][$key]); ?>

  95.         
  96.         <td align="center" id="smilie_<?=$key?>_parent" onclick="addText('<?=$thissmiliescode?>')"><img src="images/smilies/<?=$_DCACHE['smileytypes'][$_DCACHE['smilies']['typearray'][$key]]['directory']?>/<?=$smiley['url']?>" id="smilie_<?=$key?>" alt="<?=$smiley['code']?>" title="<?=$smiley['lw']?>" width="<?=$smiley['w']?>" height="<?=$smiley['h']?>" border="0" /></td>
  97.         <? $i++; } } ?></tr>
  98. <? if(ceil($i/$smcols) < $smrows) { echo str_repeat('<tr height="'.($smthumb + 6).'"><td colspan="'.$smrows.'"></td></tr>', $smrows - ceil($i/$smcols));; } ?>
  99. </table>
  100. <?


  101. /*
  102.         $smilies = '';
  103.                 foreach($_DCACHE['smilies']['replacearray'] AS $key => $img) {
  104.                 $thissmiliescode=preg_replace('/\//','',$_DCACHE['smilies']['searcharray'][$key]);
  105.                 $smilies .= "\t\t\t\t\t\t\t".'<a href="javascript:addText(\''.$thissmiliescode.'\');">'.$img.'</a>'."\n";
  106.         }

  107.         exit($smilies);
  108.         */
  109. }
  110. ?>
คัดลอกไปที่คลิปบอร์ด
xman โพสต์ 2007-11-15 13:26:21


plzz  upload file hack

 เจ้าของ| Natz โพสต์ 2007-11-15 13:48:59

ตอบกลับโพสของ 31# xman

เข้า  Admin CP -> Tools -> Update Caches
xman โพสต์ 2007-11-15 13:51:16

ตอบกลับโพสของ 37# ROA

Update Caches แล้วครับ   
 เจ้าของ| Natz โพสต์ 2007-11-15 13:53:24

ตอบกลับโพสของ 38# xman

ทำไมผมไม่เปงหว่า เดี๋ยวลองเชกดูอีกที
suthida โพสต์ 2007-11-15 13:56:18
ต้นฉบับโพสโดย xman เมื่อ 2007-11-15 13:51
Update Caches แล้วครับ   


อย่าลืม Up ข้อมูลจากไฟลล์ discuz_plugin_shoutbox.txt เข้า Admincp > Extended Conf ด้วยนะคะนี่รองติด 2.1 ไม่มีปัญหาน๊า..
ขออภัย! คุณไม่ได้รับสิทธิ์ในการดำเนินการในส่วนนี้ กรุณาเลือกอย่างใดอย่างหนึ่ง ลงชื่อเข้าใช้ | สมัครสมาชิก

รายละเอียดเครดิต

รายชื่อผู้กระทำผิด|Archiver|ดิสคัส ไทย Follow us: Become a fan on facebook. Follow us on Twitter.

GMT+7, 2024-5-6 05:46

Powered by Discuz! X3.4, Rev.66

Copyright © 2001-2021 Tencent Cloud. Licensed

ตอบกระทู้ ขึ้นไปด้านบน ไปที่หน้ารายการกระทู้