plz fix it

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    plz fix it

    this is chatroom code. if i reload by browser then prev. msg is repeating. i dont want to repeat and by default 5 msg is showing in a page i want to 10 msg in a page. plz fix my both prob plzz.. i m waiting

    PHP Code:
    <?php 
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    /*                                                                                                                                               */     
    /*                            !!      !!    !!!    !!!!!!!!   !!!!!!   !!!!!!  !!!!!!!!  !!!! !!!!!!!!  !!!!!!!!  !!!!!!                         */  
    /*                            !!  !!  !!   !! !!   !!     !! !!    !! !!    !! !!     !!  !!  !!     !!    !!    !!    !!                        */
    /*                            !!  !!  !!  !!   !!  !!     !! !!       !!       !!     !!  !!  !!     !!    !!    !!                              */
    /*                            !!  !!  !! !!     !! !!!!!!!!   !!!!!!  !!       !!!!!!!!   !!  !!!!!!!!     !!     !!!!!!                         */
    /*                            !!  !!  !! !!!!!!!!! !!              !! !!       !!   !!    !!  !!           !!          !!                        */ 
    /*                            !!  !!  !! !!     !! !!        !!    !! !!    !! !!    !!   !!  !!           !!    !!    !!                        */ 
    /*                            !!!  !!!  !!     !! !!         !!!!!!   !!!!!!  !!     !! !!!! !!           !!     !!!!!!                          */
    /*                                                                                                                                               */
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    /*                                                               Illichat Ultimate Version                                                       */ 
    /*                                                     Script Tested on : www.TotHost.com Server on 15-05-2011                                   */
    /*                                                     FaceBook : http://www.facebook.com/pages/WapScriptsInfo/138532696171566                   */ 
    /*                                                        Email :  support@wapscripts.info                                                       */
    /*                                                      Twitter :  www.twitter.com/wapscripts                                                    */
    /*                                                      Website :  www.wapscripts.info                                                           */
    /*                                                         (c)Powered by WapTeams                                                                */ 
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    //  Note :                                                                                                                                       //
    //   We Have Provided This Script Without any Charge,. So Plz Click a ADs in www.wapscripts.info to keep our service alive..!!                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    /*                                                                                                                                               */     
    /*                            !!      !!    !!!    !!!!!!!!   !!!!!!   !!!!!!  !!!!!!!!  !!!! !!!!!!!!  !!!!!!!!  !!!!!!                         */  
    /*                            !!  !!  !!   !! !!   !!     !! !!    !! !!    !! !!     !!  !!  !!     !!    !!    !!    !!                        */
    /*                            !!  !!  !!  !!   !!  !!     !! !!       !!       !!     !!  !!  !!     !!    !!    !!                              */
    /*                            !!  !!  !! !!     !! !!!!!!!!   !!!!!!  !!       !!!!!!!!   !!  !!!!!!!!     !!     !!!!!!                         */
    /*                            !!  !!  !! !!!!!!!!! !!              !! !!       !!   !!    !!  !!           !!          !!                        */ 
    /*                            !!  !!  !! !!     !! !!        !!    !! !!    !! !!    !!   !!  !!           !!    !!    !!                        */ 
    /*                            !!!  !!!  !!     !! !!         !!!!!!   !!!!!!  !!     !! !!!! !!           !!     !!!!!!                          */
    /*                                                                                                                                               */
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    /*                                                               Illichat Ultimate Version                                                       */ 
    /*                                                     Script Tested on : www.TotHost.com Server on 15-05-2011                                   */
    /*                                                     FaceBook : http://www.facebook.com/pages/WapScriptsInfo/138532696171566                   */ 
    /*                                                        Email :  support@wapscripts.info                                                       */
    /*                                                      Twitter :  www.twitter.com/wapscripts                                                    */
    /*                                                      Website :  www.wapscripts.info                                                           */
    /*                                                         (c)Powered by WapTeams                                                                */ 
    /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
    //  Note :                                                                                                                                       //
    //   We Have Provided This Script Without any Charge,. So Plz Click a ADs in www.wapscripts.info to keep our service alive..!!                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    error_reporting(0);
    require_once
    "./includes/functions/gzip.php";
    include(
    'start.php');
    include(
    'config.php');
    include(
    './includes/' $ver '/banned');

    /*$bots = file("bots/bots.dat");
    $bots[0] = trim($bots[0]);
    $bots[1] = trim($bots[1]);
    $bots[2] = trim($bots[2]);
    $bots[3] = trim($bots[3]); //SYSTEM*/

    // CONFIGS
    $configs file('configs.dat');
    $adv $configs[1];
    $computer $configs[2];
    // INTERVALS
    /*$intervals = file('bots/intervals.dat');
    $intervals[0] = intval($intervals[0]);
    $intervals[1] = intval($intervals[1]);
    $intervals[2] = intval($intervals[2]);*/
    // VARIABLE FOR NO-CACHE PROTECTION
    $nocache rand(0999999999);

    list(
    $msec$sec) = explode(chr(32), microtime());
    $headtime $sec $msec;

    switch (
    $ver) {
        
    // //////////////////////////////////////////////////////
        // WML VERSION
        // //////////////////////////////////////////////////////
        
    case 'wml':
            
    header('Content-type:text/vnd.wap.wml; charset=utf-8');
            
    header('Last-Modified: ' gmdate('D, d M Y H:i:s') . ' GMT');
            
    header('Cache-Control: no-cache, must-revalidate');
            
    // AUTH
            
    $id $_SESSION['id'];
            
    $password $_SESSION['password'];
            
    $q mysql_query("SELECT nickname,smiles,translit,msgs,refresh,fsize,security,level,kick,moder,reason,emotions,sftky FROM `chat_users` WHERE `id` = '" $id "' AND `password` = '" md5($password) . "';");

            if (
    mysql_affected_rows() == 0) {
                echo 
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
                echo 
    "<card title=\"ERROR\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
                echo 
    "<small>Not logged in!<br/>\n";
                list(
    $msec$sec) = explode(chr(32), microtime());
                echo 
    "<br/>[" round(($sec $msec) - $headtime5) . "] sec<br/>\n";
                echo 
    "</small>";
                require_once 
    "includes/functions/gzip_foot.php";
                echo 
    "</p></card></wml>";
                
    ob_end_flush();
                exit();
            } else {
                
    $user mysql_fetch_array($q);
                
    $nickname $user['nickname'];
                
    $smiles $user['smiles'];
                
    $translit $user['translit'];
                
    $msgs $user['msgs'];
                
    $refresh $user['refresh'];
                
    $fsize $user['fsize'];
                
    $security $user['security'];
                
    $level $user['level'];
                
    $kick $user['kick'];
                
    $moder $user['moder'];
                
    $reason $user['reason'];
                
    $refresh $refresh 10;
                
    $emotions $user['emotions'];
                
    $buttons $user['sftky'];
            } 
            
    // END AUTH
            
    if (((strpos($ua"Opera") !== false) or (strpos($ua"Mozilla") !== false) or (strpos($ua"MSIE") !== false) or (strpos($ua"Netscape") !== false)) && $computer == && $level == 0) {
                echo 
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
                echo 
    "<card title=\"ERROR\" ontimer=\"menu.php?" SID "&amp;ver=wml\"><timer value=\"10\"/><p align=\"left\">\n";
                echo 
    "<small>Access to computers is prohibited.<br/>\n";
                list(
    $msec$sec) = explode(chr(32), microtime());
                echo 
    "<br/>[" round(($sec $msec) - $headtime5) . "] sec<br/>\n";
                echo 
    "</small>";
                require_once 
    "includes/functions/gzip_foot.php";
                echo 
    "</p></card></wml>";
                
    ob_end_flush();
                exit();
            } 

            
    $rid intval($_GET['rid']);

            
    $sql mysql_query("SELECT `topic`, `type` FROM `chat_rooms` WHERE `id` = '" $rid "';");

            if (
    mysql_num_rows($sql) == 0) {
                echo 
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
                echo 
    "<card title=\"ERROR\" ontimer=\"menu.php?" SID "&amp;ver=wml\"><timer value=\"10\"/><p align=\"left\">\n";
                echo 
    "<small>Room  does not exist.<br/>\n";
                list(
    $msec$sec) = explode(chr(32), microtime());
                echo 
    "<br/>[" round(($sec $msec) - $headtime5) . "] sec<br/>\n";
                echo 
    "</small>";
                require_once 
    "includes/functions/gzip_foot.php";
                echo 
    "</p></card></wml>";
                
    ob_end_flush();
                exit();
            } else {
                
    $topic mysql_result($sql0'topic');
                
    $type mysql_result($sql0'type');
            } 

            if (
    $level == && $type == 1) {
                echo 
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
                echo 
    "<card title=\"ERROR\" ontimer=\"menu.php?" SID "&amp;ver=wml\"><timer value=\"10\"/><p align=\"left\">\n";
                echo 
    "<small>Access Denied.<br/>\n";
                list(
    $msec$sec) = explode(chr(32), microtime());
                echo 
    "<br/>[" round(($sec $msec) - $headtime5) . "] sec<br/>\n";
                echo 
    "</small>";
                require_once 
    "includes/functions/gzip_foot.php";
                echo 
    "</p></card></wml>";
                
    ob_end_flush();
                exit();
            } 

            if (
    $kick time() && (($rid != $wicked_quiz && $rid != $unlim) or $moder == $bots[3])) {
                echo 
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
                echo 
    "<card title=\"Ошибка\" ontimer=\"rules.php?" SID "&amp;ver=wml\"><timer value=\"50\"/><p align=\"left\">\n";
                echo 
    "<small>you kicked out by <u>$moder</u> for <u>" . ($kick time()) . "</u> seconds<br/>\n";
                echo 
    "Reason: $reason<br/>\n";
                list(
    $msec$sec) = explode(chr(32), microtime());
                echo 
    "<br/>[" round(($sec $msec) - $headtime5) . "] sec<br/>\n";
                echo 
    "</small>";
                require_once 
    "includes/functions/gzip_foot.php";
                echo 
    "</p></card></wml>";
                
    ob_end_flush();
                exit();
            } 
            
    // ONLINE
            
    $online time() + 90;
            
    $update mysql_query("UPDATE `chat_users` SET `time` = '" $online "', `place` = '" $rid "', `ip` = '" getenv('REMOTE_ADDR') . "', `ua` = '" htmlspecialchars(getenv('HTTP_USER_AGENT')) . "' WHERE `id` = '" $id "';");
            
    // END ONLINE
            
    if (strpos($buttons"5") !== false) {
                
    $sql mysql_query("SELECT COUNT(*) FROM `chat_letters` WHERE `to` = '" $id "' AND `read` = 0 AND `id` = '" $id "';");
                
    $inbox mysql_result($sql0);
            } 
            echo 
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
            echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
            echo 
    "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
            echo 
    "<card id=\"chat\" title=\"$topic\" ontimer=\"" $_SERVER['PHP_SELF'] . "?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\">\n";
            echo 
    "<timer value=\"$refresh\"/>\n";
            if (
    strpos($buttons"1") !== false) echo "<do type=\"options\" name=\"add\" label=\"Say\"><go href=\"#add\" method=\"get\"/></do>\n";
            if (
    strpos($buttons"2") !== false) echo "<do type=\"options\" name=\"refresh\" label=\"Refresh\"><go href=\"room.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\" method=\"get\"/></do>\n";
            if (
    strpos($buttons"3") !== false) echo "<do type=\"options\" name=\"online\" label=\"Online\"><go href=\"online.php?" SID "&amp;ver=wml&amp;nocache=$nocache\" method=\"get\"/></do>\n";
            if (
    strpos($buttons"4") !== false) echo "<do type=\"options\" name=\"mood\" label=\"Mood\"><go href=\"mood.php?" SID "&amp;rid=$rid&amp;ver=wml&amp;nocache=$nocache\" method=\"get\"/></do>\n";
            if (
    strpos($buttons"5") !== false) echo "<do type=\"options\" name=\"letters\" label=\"Mailbox ($inbox)\"><go href=\"letters.php?" SID "&amp;ver=wml&amp;nocache=$nocache&amp;mod=inbox\" method=\"get\"/></do>\n";
            if (
    strpos($buttons"6") !== false) echo "<do type=\"options\" name=\"menu\" label=\"Menu\"><go href=\"menu.php?" SID "&amp;ver=wml&amp;nocache=$nocache\" method=\"get\"/></do>\n";
            echo 
    "<p align=\"left\">\n";

           
    // include "bots/joker.php";

           // if ($rid == 1) {
            //    include "bots/bot.php";
            //    mysql_query("UPDATE `chat_users` SET `time` = '" . $online . "', `place` = 1 WHERE `id` = 3;");
           // } 

           // if ($rid == 3) {
             //   include "bots/boor.php";
             //   include "bots/second_bot.php";
            //    mysql_query("UPDATE `chat_users` SET `time` = '" . $online . "', `place` = 3 WHERE `id` = 4;");
           // } 

            
    if ($fsize == 0) {
                
    $open_tag "<small>";
                
    $close_tag "</small>";
            } 
            if (
    $fsize == 1) {
                
    $open_tag "";
                
    $close_tag "";
            } 
            if (
    $fsize == 2) {
                
    $open_tag "<big>";
                
    $close_tag "</big>";
            } 

            echo 
    $open_tag;

            echo 
    "<a href=\"#add\">Say</a><br/>\n";
            echo 
    "<a href=\"room.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\">Refresh</a><br/>\n";
           
    // if ($rid == 1) echo "<a href=\"ansbuy.php?" . SID . "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\">Купить ответ</a><br/>\n";
           // if ($rid == 3) echo "<a href=\"ansbuy.php?" . SID . "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\">Купить ответ</a><br/>\n";
            
    if (isset($_POST['msg'])) {
                
    mysql_query("SELECT * FROM `chat" $rid "` WHERE `aid` = '" $id "' AND `seconds` > " . (time() - 5) . ";");
                if (
    mysql_affected_rows() > 3) {
                    
    $reason "You have been automatically kicked by system for the flood (repeatedly messages).";
                    
    mysql_query("UPDATE `chat_users` SET `kick` = " . (time() + 180) . ", `moder` = '" $bots[3] . "', `reason` = '" $reason "' WHERE `id` = '" $id "';");
                } 

                
    $msg trim($_POST['msg']);

                if (isset(
    $_POST['uid'])) {
                    
    $sql mysql_query("SELECT `nickname` FROM `chat_users` WHERE `id` = " intval($_POST['uid']) . ";");
                    
    $nick mysql_result($sql0);
                } else {
                    
    $nick "";
                } 

                
    $msg stripslashes($msg);

                
    $msg htmlspecialchars($msg);

                unset(
    $smiles_array);
                unset(
    $smile);

                if (!empty(
    $nick)) {
                    
    $msg "$nick$msg";
                } 

              
    //  $msg = iconv('utf-8', 'windows-1251', $msg);
                
    $msg substr($msg01000);
               
    // $msg = iconv('windows-1251', 'utf-8', $msg);
                
    $msg str_replace("$""$$"$msg);

                
    $emotions intval($_POST['emotions']);

               
    /* switch ($emotions) {
                    case 1:
                        $msg = "[Joyfully] $msg";
                        break;

                    case 2:
                        $msg = "[Sadly] $msg";
                        break;

                    case 3:
                        $msg = "[Surprise] $msg";
                        break;

                    case 4:
                        $msg = "[Affectionately] $msg";
                        break;

                    case 5:
                        $msg = "[Confusedly] $msg";
                        break;

                    case 6:
                        $msg = "[Coquettishly] $msg";
                        break;

                    case 7:
                        $msg = "[Resentfully] $msg";
                        break;

                    case 8:
                        $msg = "[forstoychivo] $msg";
                        break;

                    case 9:
                        $msg = "[Whisper] $msg";
                        break;

                    case 10:
                        $msg = "[Meditatively] $msg";
                        break;

                    case 11:
                        $msg = "[Malignantly] $msg";
                        break;
                } */

                
    if ($level 0) {
                    
    $attributs $_POST['attributs'];
                    
    $post_fsize = (int)$_POST['fsize'];

                    if (
    substr_count($attributs"underline") != 0$msg "<u>$msg</u>";

                    if (
    $level 2) {
                        if (
    substr_count($attributs"bold") != 0$msg "<b>$msg</b>";
                    } 

                    if (
    $level == 4) {
                        if (
    substr_count($attributs"italic") != 0$msg "<i>$msg</i>";
                        if (
    $post_fsize == 0$msg "<small>$msg</small>";
                        if (
    $post_fsize == 2$msg "<big>$msg</big>";
                    } 
                } 
                
    // REMOVING ADVERTS
                
    if ($adv == && $level 4) {
                    
    $msg eregi_replace("((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)""censored"$msg);
                } 
                
    // SMILES
                
    include "smiles.php";
                
    $msg preg_replace($smiles_array$smile$msg2);

                if (
    $level == 4) {
                    
    $msg preg_replace("|\*\((.*)\)\*|isU""<b>\\1</b>"$msg);
                } 

                
    $msg mysql_escape_string($msg);

                
    $sql mysql_query("SELECT `msg` FROM `chat" $rid "` WHERE `aid` = '" $id "' ORDER BY `id` DESC LIMIT 1;");
                
    $last_msg mysql_escape_string(mysql_result($sql0));

                
    // INSERTING MESSAGE
                
    if ($last_msg != $msg && !empty($msg)) {
                    
    $to = (int)$_POST['to'];
                    
    $sql mysql_query("INSERT INTO `chat" $rid "` VALUES(0, '" $id "', '" $nickname "', '<beginning>" $msg "', '" $to "', '" date("H:i") . "'," time() . ");");
                    
    //CLearing rooms
                    
    if (mysql_insert_id() > 4000000000) {
                        
    mysql_query("TRUNCATE TABLE `chat" $rid "`;");
                        
    $message "Db flooded with messages.";
                        
    $sql mysql_query("SELECT `id` FROM `chat_rooms`;");
                        while (
    $room_id mysql_fetch_array($sql)) {
                            
    mysql_query("INSERT INTO `chat" $rid "` VALUES(0, '5', '" $bots[3] . "', '" $message "', '0', '" date("H:i") . "'," time() . ");");
                        } 
                    }
                    
    //END of CLearing rooms
                    
    if (!$sql) {
                        
    $sql mysql_query("INSERT INTO `chat" $rid "` VALUES(0, '" $id "', '" $nickname "', '<beginning>" $msg "', '" $to "', '" date("H:i") . "', " time() . ");");
                    } 
                    
    mysql_query("UPDATE `chat_users` SET `posts` = `posts` + 1 WHERE `id` = '" $id "';");
                   
    // if ($rid == 1) include "bots/answer.php";
                   // if ($rid == 3) include "bots/second_answer.php";
                
    }
                
    // END of INSERTING MESSAGE
            


            
    $sql mysql_query("SELECT COUNT(*) FROM `chat" $rid "`;");
            
    $all mysql_result($sql0);

            if (isset(
    $_GET['s'])) $s intval($_GET['s']);
            else 
    $s 0;
            if (
    $s 0$s 0;
            if (
    $s $all$s 0;

            
    $ignor "";

            
    $sql mysql_query("SELECT * FROM `chat_ignor` WHERE `id` = '" $id "';");
            while (
    $ignor_arr mysql_fetch_array($sql)) {
                
    $ignor .= " `aid` != '" $ignor_arr['uid'] . "' AND ";
            } 

            if (
    $id != 1$sql mysql_query("SELECT * FROM `chat" $rid "` WHERE " $ignor " (`to` = 0 OR `to` = '" $id "' OR `aid` = '" $id "') ORDER BY `id` DESC LIMIT $s$msgs;");
            else 
    $sql mysql_query("SELECT * FROM `chat" $rid "` WHERE " $ignor " `aid` != 0 ORDER BY `id` DESC LIMIT $s$msgs;");
            
            
    // POSTS LISTING
            
    while ($post mysql_fetch_array($sql)) {
                
    $post['msg'] = str_replace("<usersid>"SID$post['msg']);
                
    $post['msg'] = str_replace('<beginning>'.$nickname.',''<u>'.$nickname.'</u>,'$post['msg']);//UNDERLINING USER'S NICKNAME
                
    $post['msg'] = str_replace('<beginning>'''$post['msg']);
                if (
    $post['to'] != 0) echo "<b>[P!]</b>";
                echo 
    "<a href=\"addto.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache&amp;uid=" $post['aid'] . "\">" $post['nickname'] . "</a>(" $post['time'] . ")";
                
    $post['msg'] = stripslashes($post['msg']);
                if (
    $smiles == 0$post['msg'] = preg_replace("|<img[^>]+>|isU""*smile*"$post['msg']);
                echo 
    $post['msg'] . "<br/>\n";
            } 
            
    // END of POSTS LISTING
            
            
    if ($all $s $msgs) print "<a href=\"room.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache&amp;s=" . ($s $msgs) . "\">&gt;&gt;&gt;</a><br/>\n";
            if (
    $s 0) print "<a href=\"room.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache&amp;s=" . ($s $msgs) . "\">&lt;&lt;&lt;</a><br/>\n";

            echo 
    "<a href=\"mood.php?" SID "&amp;ver=wml&amp;nocache=$nocache\">Mood</a><br/>\n";
            echo 
    "<a href=\"menu.php?" SID "&amp;ver=wml&amp;nocache=$nocache\">Hall</a><br/>\n";

            echo 
    $close_tag;

            list(
    $msec$sec) = explode(chr(32), microtime());
            echo 
    "<br/><small>[" round(($sec $msec) - $headtime5) . "] sec</small><br/>\n";
            echo 
    "</p></card><card id=\"add\" title=\"Say\"><p align=\"left\">";
            echo 
    "Say:<br/>\n";
            echo 
    "<input type=\"text\" name=\"msg$nocache\" maxlength=\"300\" value=\"\"/><br/>\n";


            if (
    $level 0) {
                echo 
    "Attributes:<br/>\n";
                echo 
    "<select name=\"attributs$nocache\" multiple=\"true\">\n";
                if (
    $level 2) echo "<option value=\"bold\">bold</option>\n";
                echo 
    "<option value=\"underline\">underline</option>\n";
                if (
    $level == 4)echo "<option value=\"italic\">italic</option>\n";
                echo 
    "</select><br/>\n";
            } 


          
    /*  if ($emotions == 1) {
                echo "Эмоции:<br/>\n";
                echo "<select name=\"emotions$nocache\" value=\"0\">\n";
                echo "<option value=\"0\">Без эмоций</option>\n";
                echo "<option value=\"1\">Радостно</option>\n";
                echo "<option value=\"2\">Sadly</option>\n";
                echo "<option value=\"3\">Surprise</option>\n";
                echo "<option value=\"4\">Ласково</option>\n";
                echo "<option value=\"5\">Смущенно</option>\n";
                echo "<option value=\"6\">Кокетливо</option>\n";
                echo "<option value=\"7\">Обиженно</option>\n";
                echo "<option value=\"8\">forстойчиво</option>\n";
                echo "<option value=\"9\">Шепотом</option>\n";
                echo "<option value=\"10\">Задумчиво</option>\n";
                echo "<option value=\"11\">Злобно</option>\n";
                echo "</select><br/>\n";
            } */

            
    echo "<anchor>[Say]<go href=\"room.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\" method=\"post\">\n";
            echo 
    "<postfield name=\"msg\" value=\"$(msg$nocache)\"/>\n";
            echo 
    "<postfield name=\"translit\" value=\"$(translit$nocache)\"/>\n";
            echo 
    "<postfield name=\"attributs\" value=\"$(attributs$nocache)\"/>\n";
            echo 
    "<postfield name=\"fsize\" value=\"$(fsize$nocache)\"/>\n";
            echo 
    "<postfield name=\"emotions\" value=\"$(emotions$nocache)\"/>\n";
            echo 
    "</go></anchor><br/>\n";
            echo 
    "<a href=\"room.php?" SID "&amp;ver=wml&amp;rid=$rid&amp;nocache=$nocache\">back to room</a><br/>\n";
            require_once 
    "includes/functions/gzip_foot.php";
            echo 
    "</p></card></wml>";
            
    ob_end_flush();
            break;
        
    // //////////////////////////////////////////////////////
        // HTML VERSION
        // //////////////////////////////////////////////////////
        
    case 'html':
            
    // VARS
            
    $id $_SESSION['id'];
            
    $password $_SESSION['password'];
            
    $rid intval($_GET['rid']);

            
    $error "";
            
    // AUTH
            
    $q mysql_query("SELECT nickname,smiles,translit,msgs,refresh,security,level,kick,moder,reason FROM `chat_users` WHERE `id` = '" $id "' AND `password` = '" md5($password) . "';");
            if (
    mysql_affected_rows() == 0) {
                
    $error .= "Not logged in!<br/>\n";
            } else {
                
    $user mysql_fetch_array($q);
                
    $nickname $user['nickname'];
                
    $smiles $user['smiles'];
                
    $translit $user['translit'];
                
    $msgs $user['msgs'];
                
    $refresh $user['refresh'];
                
    // $fsize = $user['fsize'];
                
    $security $user['security'];
                
    $level $user['level'];
                
    $kick $user['kick'];
                
    $moder $user['moder'];
                
    $reason $user['reason'];
            } 
            
    // END AUTH
            // COMP
            
    if (((strpos($ua"Opera") !== false) or (strpos($ua"Mozilla") !== false) or (strpos($ua"MSIE") !== false) or (strpos($ua"Netscape") !== false)) && $computer == && $level == 0) {
                
    $error .= 'Access to computers is prohibited.<br/>';
            } 
            
    // END COMP
            // CHECK ROOM
            
    $sql mysql_query("SELECT `topic`, `type` FROM `chat_rooms` WHERE `id` = '" $rid "';");

            if (
    mysql_num_rows($sql) == 0) {
                
    $error .= 'Room  does not exist.<br/>';
            } else {
                
    $my_title mysql_result($sql0'topic');
                
    $type mysql_result($sql0'type');
            } 
            
    // END CHECK ROOM
            // CHECK TYPE
            
    if ($level == && $type == 1) {
                
    $error .= 'Access Denied.<br/>';
            } 
            
    // END CHECKTYPE
            // KICK
            
    if ($kick time() && ($rid != $wicked_quiz && $rid != $unlim)) {
                
    $error .= 'you kicked <u>' $moder '</u> for <u>' . ($kick time()) . '</u> seconds<br/>';
                
    $error .= 'Reason: ' $reason '<br/>';
            } 
            
    // END KICK
            
    if (!empty($error)) {
                
    $my_title 'Error';
                if (!isset(
    $_COOKIE['theme'])) $_COOKIE['theme'] = 1;
                include_once 
    'themes/' intval($_COOKIE['theme']) . '/index.php';
                echo 
    $error;
                include_once 
    'themes/' intval($_COOKIE['theme']) . '/foot.php';
            } else {
                
    // если forблюдаются проблемы удалите этот блок
                
    function avto($s)
                {
                    global 
    $refresh;
                    global 
    $rid;
                    global 
    $nocache;
                    
    $s str_replace('<title>'"<meta http-equiv=\"refresh\" content=\"$refresh;url=" $_SERVER['PHP_SELF'] . "?" SID "&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\"/>\n<title>"$s);
                    return 
    $s;
                } 
                
    ob_start('avto');
            } 

            if (!isset(
    $_COOKIE['theme'])) $_COOKIE['theme'] = 1;
            include_once 
    "themes/" intval($_COOKIE['theme']) . "/index.php";
            
    // ONLINE
            
    $online time() + 90;
            
    $update mysql_query("UPDATE `chat_users` SET `time` = '" $online "', `place` = '" $rid "', `ip` = '" getenv('REMOTE_ADDR') . "', `ua` = '" htmlspecialchars(getenv('HTTP_USER_AGENT')) . "' WHERE `id` = '" $id "';");
            
    // END ONLINE
            
    if($fsize == 0)
    {
    $fsize "small";
    }
    if(
    $fsize == 1)
    {
    $fsize "normal";
    }
    if(
    $fsize == 2)
    {
    $fsize "large";
    }


           
    // include 'bots/joker.php';

          //  if ($rid == 1) {
             ///   include 'bots/bot.php';
             //   mysql_query("UPDATE `chat_users` SET `time` = '" . $online . "', `place` = 1 WHERE `id` = 2;");
           // } 

           // if ($rid == 3) {
            //    include "bots/boor.php";
             //   include "bots/second_bot.php";
            //    mysql_query("UPDATE `chat_users` SET `time` = '" . $online . "', `place` = 3 WHERE `id` = 4;");
           // } 

            
    echo "<a href=\"add.php?" SID "&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\">Say</a> | \n";
            echo 
    "<a href=\"room.php?" SID "&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\">Refresh</a> | \n";
         
    //   if (($rid == 1) || ($rid == 3)) echo "<a href=\"ansbuy.php?" . SID . "&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\">Купить ответ</a> |\n";
            
    echo "<a href=\"online.php?" SID "&amp;ver=html&amp;nocache=$nocache\">Online</a><br/><br/>\n";
            if (isset(
    $_POST['msg'])) {
                
    mysql_query("SELECT * FROM `chat" $rid "` WHERE `aid` = '" $id "' AND `seconds` > " . (time() - 20) . ";");
                if (
    mysql_affected_rows() > 3) {
                    
    $reason "You have been automatically kicked system for the flood (repeatedly messages).";
                    
    mysql_query("UPDATE `chat_users` SET `kick` = " . (time() + 180) . ", `moder` = '" $bots[3] . "', `reason` = '" $reason "' WHERE `id` = '" $id "';");
                } 

                
    $msg trim($_POST['msg']);

                if (isset(
    $_POST['uid'])) {
                    
    $sql mysql_query("SELECT `nickname` FROM `chat_users` WHERE `id` = " intval($_POST['uid']) . ";");
                    
    $nick mysql_result($sql0);
                } else {
                    
    $nick "";
                } 

                
    $msg stripslashes($msg);

                 
    $msg htmlspecialchars($msg);

                if (!empty(
    $nick)) {
                    
    $msg "$nick$msg";
                } 

              
    //  $msg = iconv('utf-8', 'windows-1251', $msg);
                
    $msg substr($msg01000);
               
    // $msg = iconv('windows-1251', 'utf-8', $msg);
                
    $msg str_replace("$""$$"$msg);

                
    $emotions intval($_POST['emotions']);

              
    /*  switch ($emotions) {
                    case 1:
                        $msg = "[Радостно] $msg";
                        break;

                    case 2:
                        $msg = "[Sadly] $msg";
                        break;

                    case 3:
                        $msg = "[Surprise] $msg";
                        break;

                    case 4:
                        $msg = "[Ласково] $msg";
                        break;

                    case 5:
                        $msg = "[Смущенно] $msg";
                        break;

                    case 6:
                        $msg = "[Кокетливо] $msg";
                        break;

                    case 7:
                        $msg = "[Обиженно] $msg";
                        break;

                    case 8:
                        $msg = "[forстойчиво] $msg";
                        break;

                    case 9:
                        $msg = "[Шепотом] $msg";
                        break;

                    case 10:
                        $msg = "[Задумчиво] $msg";
                        break;

                    case 11:
                        $msg = "[Злобно] $msg";
                        break;
                } */

                
    if ($level 0) {
                    
    $attributs $_POST['attributs'];
                    
    $post_fsize = (int)$_POST['fsize'];

                    if (
    substr_count($attributs"underline") != 0$msg "<u>$msg</u>";

                    if (
    $level 2) {
                        if (
    substr_count($attributs"bold") != 0$msg "<b>$msg</b>";
                    } 

                    if (
    $level == 4) {
                        if (
    substr_count($attributs"italic") != 0$msg "<i>$msg</i>";
                        if (
    $post_fsize == 0$msg "<small>$msg</small>";
                        if (
    $post_fsize == 2$msg "<big>$msg</big>";
                    } 
                } 
                
    // REMOVING ADVERTS
                
    if ($adv == && $level 4) {
                    
    $msg eregi_replace("((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)""censored"$msg);
                } 
                
    // SMILES
                
    include "smiles.php";
                
    $msg preg_replace($smiles_array$smile$msg2);

                if (
    $level == 4) {
                    
    $msg preg_replace("|\*\((.*)\)\*|isU""<b>\\1</b>"$msg);
                } 

                
    $msg mysql_escape_string($msg);

                
    $sql mysql_query("SELECT `msg` FROM `chat" $rid "` WHERE `aid` = '" $id "' ORDER BY `id` DESC LIMIT 1;");
                
    $last_msg mysql_escape_string(mysql_result($sql0));

                
    // INSERTING MESSAGE
                
    if ($last_msg != $msg && !empty($msg)) {
                    
    $to = (int)$_POST['to'];
                    
    $sql mysql_query("INSERT INTO `chat" $rid "` VALUES(0, '" $id "', '" $nickname "', '<beginning>" $msg "', '" $to "', '" date("H:i") . "'," time() . ");");
                    
    //CLearing rooms
                    
    if (mysql_insert_id() > 4000000000) {
                        
    mysql_query("TRUNCATE TABLE `chat" $rid "`;");
                        
    $message "Db flooded with messages.";
                        
    $sql mysql_query("SELECT `id` FROM `chat_rooms`;");
                        while (
    $room_id mysql_fetch_array($sql)) {
                            
    mysql_query("INSERT INTO `chat" $rid "` VALUES(0, '5', '" $bots[3] . "', '" $message "', '0', '" date("H:i:s") . "'," time() . ");");
                        } 
                    }
                    
    //END of CLearing rooms
                   // if (!$sql) {
                     //   $sql = mysql_query("INSERT INTO `chat" . $rid . "` VALUES(0, '" . $id . "', '" . $nickname . "', '<beginning>" . $msg . "', '" . $to . "', '" . date("H:i") . "', " . time() . ");");
                   // } 
                    
    mysql_query("UPDATE `chat_users` SET `posts` = `posts` + 1 WHERE `id` = '" $id "';");
                 
    //   if ($rid == 1) include "bots/answer.php";
                  //  if ($rid == 3) include "bots/second_answer.php";
                
    }
                
    // END of INSERTING MESSAGE
            


            
    $sql mysql_query("SELECT COUNT(*) FROM `chat" $rid "`;");
            
    $all mysql_result($sql0);

            if (isset(
    $_GET['s'])) $s intval($_GET['s']);
            else 
    $s 0;
            if (
    $s 0$s 0;
            if (
    $s $all$s 0;

            
    $ignor '';

            
    $sql mysql_query("SELECT * FROM `chat_ignor` WHERE `id` = '" $id "';");
            while (
    $ignor_arr mysql_fetch_array($sql)) {
                
    $ignor .= " `aid` != '" $ignor_arr['uid'] . "' AND ";
            } 

            if (
    $id != 1$sql mysql_query("SELECT * FROM `chat" $rid "` WHERE " $ignor " (`to` = 0 OR `to` = '" $id "' OR `aid` = '" $id "') ORDER BY `id` DESC LIMIT $s$msgs;");
            else 
    $sql mysql_query("SELECT * FROM `chat" $rid "` WHERE " $ignor " `aid` != 0 ORDER BY `id` DESC LIMIT $s$msgs;");
            
    // POSTS LISTING
            
    while ($post mysql_fetch_array($sql)) {
                
    $post['msg'] = str_replace("<usersid>"SID$post['msg']);
                
    $post['msg'] = str_replace('<beginning>'.$nickname.',''<u>'.$nickname.'</u>,'$post['msg']);//UNDERLINING USER'S NICKNAME
                
    $post['msg'] = str_replace('<beginning>'''$post['msg']);
                
    // FONTCOLOR
                
    $colq mysql_query("SELECT color FROM `chat_users` WHERE `id` = '".$post['aid']."';");
                
    $usercolor mysql_result($colq0);
                if (!empty(
    $usercolor)) $post['msg'] = "<font color='".$usercolor."'>".$post['msg']."</font>";
                
    // END FONTCOLOR
                
    if ($post['to'] != 0) echo "<b>[P!]</b>";
                echo 
    "<a href=\"addto.php?" SID "&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache&amp;uid=".$post['aid']."\">" $post['nickname'] . "</a> [" $post['time'] . "]";
                
    $post['msg'] = str_replace('$$''$'$post['msg']);
                
    $post['msg'] = stripslashes($post['msg']);
                if (
    $smiles == 0$post['msg'] = preg_replace("|<img[^>]+>|isU""*smile*"$post['msg']);
                echo 
    $post['msg'] . "<br/>\n";
            }
            
    // END of POSTS LISTING
            
            // SAY
            
    echo "<br/>\n";
            echo 
    "<form action=\"room.php?" SID "&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\" method=\"post\">\n";
            echo 
    "Say:<br/>\n";
            echo 
    "<input type=\"text\" name=\"msg\" maxlength=\"300\" value=\"\"/><br/>\n";
            echo 
    "<input type=\"hidden\" name=\"fsize\" value=\"1\" />\n";
            echo 
    "<input type=\"submit\" value=\"Say\" /></form>\n";
            
    // HISTORY
            
    if ($all $s $msgs) print '<a href="room.php?' SID '&amp;ver=html&amp;rid=' $rid '&amp;nocache=' $nocache '&amp;s=' . ($s $msgs) . '">&gt;&gt;&gt;</a><br/>';
            if (
    $s 0) print '<a href="room.php?' SID '&amp;ver=html&amp;rid=' $rid '&amp;nocache=' $nocache '&amp;s=' . ($s $msgs) . '">&lt;&lt;&lt;</a><br/>';
            
    //MOOD AND MENU
            
    echo '<a href="mood.php?' SID '&amp;ver=html&amp;nocache=' $nocache '">Mood</a> | ';
            echo 
    '<a href="menu.php?' SID '&amp;ver=html&amp;nocache=' $nocache '">Menu</a>';
            include_once 
    "themes/" intval($_COOKIE['theme']) . "/foot.php";
            break;
    }
    ?>
    Last edited by arnage; 02.05.12, 10:42.

    #2
    It is a basic problem when processes are written one after other in the file. That room.php is not a page it is a file and in it needs to be defined dynamic pages for every process like listing messages or adding new... Im not sure that there is some good quick fix.
    So basicly it needs GETting pages with for example $do var:

    PHP Code:
    $do = empty($_GET['do']) ? '' htmlentities($_GET['do'], ENT_QUOTES'UTF-8'); 
    ... and add structure for example like:

    PHP Code:
    if ($do == '') {

    // list messages

    } elseif ($do == 'add_new_message') {

    // adding new message

    } else {

    // for example:
    exit('Page not found');

    }

    // And so on... 
    With headers and exit;'s added.
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    Comment


      #3
      bro i didnt get.. plz give me full code. so that i can put that code in my site direct. plz bro

      Comment


        #4
        No, i wont. This is coding forum and i told you how to code it. Its stupid to even ask something like that.
        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

        Comment


          #5
          i m sorry bro bt i dont know php.. so i m telling. plz bro plz no one iz helping plz bro

          Comment


            #6
            Perfect moment to start learning, because if you don't learn this basics, well, you are most probably stuck with script which repeats last post on refresh.
            <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

            Comment


              #7
              Originally posted by arnage View Post
              Perfect moment to start learning, because if you don't learn this basics, well, you are most probably stuck with script which repeats last post on refresh.
              murderer ... i'm laughing with tears )))))) ...

              God's great garden and all the guys jump the fence with the gate open lol
              This is ten percent luck, twenty percent skill
              Fifteen percent concentrated power of will
              Five percent pleasure, fifty percent pain

              And a hundred percent reason to remember the name!

              Comment


                #8
                clues:
                PHP Code:
                $sql mysql_query("SELECT `msg` FROM `chat" $rid "` WHERE `aid` = '" $id "' ORDER BY `id` DESC LIMIT 1;"); 
                            
                $last_msg mysql_escape_string(mysql_result($sql0)); 

                            
                // INSERTING MESSAGE 
                            
                if ($last_msg != $msg && !empty($msg)) { 
                it needs an extra AND statement after the WHERE statement eg:
                PHP Code:
                WHERE `aid` = '" . $id . "' AND nick='".$nickname."' 
                //i cant see sql so just guessing at the names 
                as for number of messages seen it will be in the users sql
                eg:
                PHP Code:
                number_of_messages int(1) default 5
                //just guessing at sql names (they will be different) 
                which will need to be changed to:
                PHP Code:
                number_of_messages int(2) default 10
                //again just guessing at sql names 

                Comment


                  #9
                  PHP Code:
                  $sql mysql_query("SELECT `msg` FROM `chat" $rid "` WHERE `aid` = '" $id "' ORDER BY `id` DESC LIMIT 1;"); 
                              
                  $last_msg mysql_escape_string(mysql_result($sql0)); 

                              
                  // INSERTING MESSAGE 
                              
                  if ($last_msg != $msg && !empty($msg)) { 
                  also you may want to remove mysql_escape_string() as its not doing you any favors in the above code :/

                  Comment


                    #10
                    bro something else. u have told me in to msgs. so i m cnfused. bro i know this prob is little for u. so plz give me ur 2 mints plz bro. bro plz complete the code and give me code so that i can copy from here full code. i dont know php so i didnt do. plz give me full code moded by u plz bro plz.. i m using illichat script.
                    Last edited by livemax; 05.05.12, 19:32.

                    Comment


                      #11
                      i cant see the sql names so i cant

                      Comment


                        #12
                        bro which code i should put here to know the sql name??? plz tell me bro


                        i went to cpanel>mysqldatabases and write the database name. is it sql name??

                        mysql database:


                        mysqluser:
                        Last edited by arnage; 09.05.12, 15:17.

                        Comment


                          #13
                          plz bro plz help

                          Comment


                            #14
                            bro something else i know u r ignoring me. I can give u my c panel id and paswrd for fix the problem. Bt u r ignoring me. No prob bro. I'm happy. I think u r nt frm india bro. Bcoz only indian can feel what is the curse of poorness. Now this time i m poor so i cant study php. Bt aftr 4 years when i will be an computer engineer then i will know all thing. Then i will come here and i will tell about my error free site. Before 4 years i will learn a lil bit of php here. Thanks bro thanks...
                            Last edited by livemax; 08.05.12, 18:14.

                            Comment


                              #15
                              Originally posted by livemax View Post
                              bro something else i know u r ignoring me. I can give u my c panel id and paswrd for fix the problem. Bt u r ignoring me. No prob bro. I'm happy. I think u r nt frm india bro. Bcoz only indian can feel what is the curse of poorness. Now this time i m poor so i cant study php. Bt aftr 4 years when i will be an computer engineer then i will know all thing. Then i will come here and i will tell about my error free site. Before 4 years i will learn a lil bit of php here. Thanks bro thanks...
                              First time iv read this topic again...
                              seriously i dont think running a php site is for you. your not willing to learn, you have all the codes above and just have to swap over a few simple sql names. you will not learn anything if you dont try and do this for your self.

                              Comment

                              Working...
                              X