Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter JibsouX

    (@jibsoux)

    Okey the thing is if i click on o link the page wont load before quick chat send it’s ajax request to check message list and user list
    Why that ?

    anyone have an idea ?

    Thread Starter JibsouX

    (@jibsoux)

    Ok i have found the bug :

    in plugin : secure invite :

    function secure_invite_check_secure_page() {
    	if (!headers_sent()) session_start();
    	// set the invite code
    	if (isset($_POST["invite_code"])) {
    		$_SESSION["invite_code"] = trim($_POST["invite_code"]);
    		header("Location: " . $_SERVER['REQUEST_URI']);
    		exit();
    	}

    and the conflict is with (in quick chat) :

    $startTime = time();

    in :

    public function update_messages_ajax_handler(){
            global $wpdb;
            $quick_chat_messages_table_name = $wpdb->prefix . 'quick_chat_messages';
    
            ob_start();
            header( "Content-Type: application/json" );
            header("Cache-Control: no-cache, must-revalidate");
            header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    
            $rooms = implode('", "', esc_sql((array)$_POST['rooms']));
    
            $startTime = time();
            while((time()-$startTime)<=20){
                $sql = 'SELECT id, wpid, room, timestamp, UNIX_TIMESTAMP(timestamp) AS unix_timestamp, alias, status, message FROM '
                                                        .$quick_chat_messages_table_name.' WHERE room IN ("'.$rooms.'") '
                                                        .' AND timestamp > FROM_UNIXTIME('.esc_sql($_POST['last_timestamp']).') '
                                                        .' ORDER BY unix_timestamp ASC';
    
                $messages = $wpdb->get_results($sql);
                if($messages){
                    foreach($messages as $v){
                        $v->timestring = date_i18n($this->date_format.' - '.$this->time_format, $v->unix_timestamp+$this->gmt_offset);
    
                        if (function_exists('get_simple_local_avatar')) {
                            $v->avatar = get_simple_local_avatar($v->wpid, $this->options['avatar_size'], '', $v->alias);
                        } else {
                            $v->avatar = get_avatar($v->wpid, $this->options['avatar_size'], '', $v->alias);
                        }
                    }
                    $response = json_encode(array('no_participation' => $this->no_participation, 'success'=> 1,'messages'=>$messages));
    
                    echo $response;
                    ob_flush(); flush();
                    exit;
                }else{
                    sleep($this->options['timeout_refresh_messages']);
                }
            }
    
            $response = json_encode(array('no_participation' => $this->no_participation, 'success'=> 0));
    
            echo $response;
            ob_flush(); flush();
            exit;
        }

    Anyone ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘conflic quick chat Secure Invites’ is closed to new replies.