SYNCHRONIZE: no data received error

PerryM - October 28, 2008 - 05:36
Project:CHAT Users and Design Integrated (BoWoB)
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Installed the module fine and see my chat rooms on the left.

When I click one of them I get the error:

SYNCHRONIZE: no data received

#1

bowob - October 28, 2008 - 10:37

It seems you have installed bowob in a wrong path.

What is your website ?
What path have you installed bowob.module file ?

#2

PerryM - October 28, 2008 - 12:53

I never installed bowob.modile - I have no idea what that is.

I did move over bowob_drupal folder to my drupal/sites/all/modules/ directory.

Inside bowob_drupal I have 2 files:
bowob.info
bowob.module

The bowob.info file contains:

; $Id$
name = BoWoB
description = Chat Drupal Integrated
package = Chat
version = 1
dependencies[] = user
core = 6.x
php = 4.0

and the bowob.module file contains:

<?php
/* $ */

function bowob_chat_id(){
 
$bowob_chat_id = array(4217,4216);

  return
$bowob_chat_id;
}

function
bowob_chat_onlyreg(){
 
$bowob_chat_onlyreg = array(true,true);

  return
$bowob_chat_onlyreg;
}

function
bowob_chat_name(){
 
$bowob_chat_name = array("Resorts","Restaurants");

  return
$bowob_chat_name;
}

define('USERNAME_MAX_LENGTH', 60);

function
bowob_link_block(){
 
$bowob_chat_id = bowob_chat_id();
 
$bowob_chat_name = bowob_chat_name();

 
$items = array();
  for(
$i = 0; $i < sizeof($bowob_chat_id); $i++){
     
$items[] = l($bowob_chat_name[$i], 'bowob/'.($i + 1), array('title' => $bowob_chat_name[$i]));
  }

  if(
sizeof($items)){
   
$form['links'] = array('#value' => theme('item_list', $items));
  }

  return
$form;
}

function
bowob_login_block(){
 
$bowob_chat_id = bowob_chat_id();
 
$bowob_chat_onlyreg = bowob_chat_onlyreg();
 
$bowob_chat_name = bowob_chat_name();

  global
$user;
 
$bowob_username = "";

  if(
$user->uid){
   
$bowob_username = $user->name;
  }

 
$rooms_all = array();
 
$items = array();
 
$rooms_all_first = -1;
  for(
$i = 0; $i < sizeof($bowob_chat_id); $i++){
    if(
$bowob_chat_onlyreg[$i]){
     
$items[] = l($bowob_chat_name[$i], 'bowob/'.($i + 1), array('title' => $bowob_chat_name[$i]));
    }
    else{
      if(
$rooms_all_first == -1){
       
$rooms_all_first = $i;
      }
     
$rooms_all[$i] = $bowob_chat_name[$i];
    }
  }

  if(
sizeof($rooms_all) == 1){
   
$form = array(
     
'#action' => url('bowob/'.($rooms_all_first + 1)),
     
'#id' => 'bowob-login-form',
     
'#base' => 'bowob_login',
    );

   
$form['username'] = array(
     
'#type' => 'textfield',
     
'#title' => t('Username'),
     
'#maxlength' => USERNAME_MAX_LENGTH,
      (
$bowob_username == "") ? '#' : '#value' => $bowob_username,
     
'#size' => 15,
     
'#required' => TRUE,
     
'#prefix' => $bowob_chat_name[$rooms_all_first],
    );

   
$form['submit'] = array(
     
'#type' => 'submit',
     
'#value' => t('Chat'),
    );
  }
  else if(
sizeof($rooms_all) > 1){
   
$form = array(
     
'#action' => url('bowob/1'),
     
'#id' => 'bowob-login-form',
     
'#base' => 'bowob_login',
    );

   
$form['room'] = array(
     
'#type' => 'radios',
     
'#options' => $rooms_all,
     
'#default_value' => $rooms_all_first,
    );

   
$form['username'] = array(
     
'#type' => 'textfield',
     
'#title' => t('Username'),
     
'#maxlength' => USERNAME_MAX_LENGTH,
      (
$bowob_username == "") ? '#' : '#value' => $bowob_username,
     
'#size' => 15,
     
'#required' => TRUE,
    );

     
$submit_js = "for(var i = 0; i < document.getElementById('bowob-login-form').room.length; i++){";
     
$submit_js .= "   if(document.getElementById('bowob-login-form').room[i].checked){";
     
$submit_js .= "      document.getElementById('bowob-login-form').action = '".url("bowob")."/' + (parseInt(document.getElementById('bowob-login-form').room[i].value) + 1);";
     
$submit_js .= "   }";
     
$submit_js .= "}";

   
$form['submit'] = array(
     
'#type' => 'submit',
     
'#value' => t('Chat'),
     
'#attributes' => array('onclick' => $submit_js),
    );
  }

  if(
sizeof($items)){
   
$form['links'] = array('#value' => theme('item_list', $items));
  }

  return
$form;
}

function
bowob_block($op = 'list', $delta = 0){
  if(
$op == 'list'){
   
$blocks[0]['info'] = t('BoWoB Link');
   
$blocks[1]['info'] = t('BoWoB Login');

    return
$blocks;
  }
  else if(
$op == 'view' && arg(0) != "bowob"){
   
$block = array();
   
$block['subject'] = t('Chat');
    if(
$delta == 0){
     
$block['content'] = drupal_get_form('bowob_link_block');
    }
    else{
     
$block['content'] = drupal_get_form('bowob_login_block');
    }

    return
$block;
  }
}

function
bowob_menu(){
 
$items['bowob'] = array(
   
'title' => 'Chat',
   
'page callback' => 'drupal_get_form',
   
'page arguments' => array('bowob_login'),
   
'access callback' => true
 
);

 
$items['bowob_sync'] = array(
   
'page callback' => 'bowob_sync',
   
'access callback' => true
 
);

  return
$items;
}

function
bowob_db_install(){
  if(!
db_table_exists("bowob")){
 
   
$schema['bowob'] = array(
   
'fields' => array(
     
'bowob_id' => array(
       
'type' => 'serial',
       
'unsigned' => TRUE,
       
'not null' => TRUE),
     
'bowob_sync' => array(
       
'type' => 'varchar',
       
'length' => 50,
       
'not null' => TRUE,
       
'default' => ''),
     
'bowob_time' => array(
       
'type' => 'int',
       
'unsigned' => TRUE,
       
'not null' => TRUE,
       
'default' => 0),
     
'bowob_mode' => array(
       
'type' => 'int',
       
'unsigned' => TRUE,
       
'not null' => TRUE,
       
'default' => 0),
     
'bowob_id_chat' => array(
       
'type' => 'int',
       
'unsigned' => TRUE,
       
'not null' => TRUE,
       
'default' => 0),
     
'bowob_user' => array(
       
'type' => 'varchar',
       
'length' => 50,
       
'not null' => TRUE,
       
'default' => ''),
     
'bowob_type' => array(
       
'type' => 'int',
       
'unsigned' => TRUE,
       
'not null' => TRUE,
       
'default' => 0),
     
'bowob_lang' => array(
       
'type' => 'varchar',
       
'length' => 50,
       
'not null' => TRUE,
       
'default' => ''),
      ),
   
'primary key' => array('bowob_id'),
    );
 
   
$ret = array();
   
db_create_table($ret, "bowob", $schema['bowob']);
  }
}

function
bowob_synchronize($bowob_mode, $bowob_id_chat, $bowob_user, $bowob_type, $bowob_lang){
 
$bowob_time = time();
 
$bowob_pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
$bowob_sync = "";
  for(
$bowob_i = 0; $bowob_i < 50; $bowob_i++){
   
$bowob_sync .= $bowob_pattern[rand(0, 61)];
  }

 
bowob_db_install();

 
db_query("INSERT INTO {bowob} (bowob_sync, bowob_time, bowob_mode, bowob_id_chat, bowob_user, bowob_type, bowob_lang) VALUES ('%s', %d, %d, %d, '%s', %d, '%s')", $bowob_sync, $bowob_time, $bowob_mode, $bowob_id_chat, $bowob_user, $bowob_type, $bowob_lang);

 
$bowob_rs = db_query("SELECT bowob_id, bowob_sync, bowob_user FROM {bowob} WHERE bowob_sync='%s' AND bowob_time=%d AND bowob_mode=%d AND bowob_id_chat=%d AND bowob_user='%s' AND bowob_type=%d AND bowob_lang='%s'", $bowob_sync, $bowob_time, $bowob_mode, $bowob_id_chat, $bowob_user, $bowob_type, $bowob_lang);

  if(!
$bowob_rs){
    echo
"BoWoB: db error";
    exit();
  }

  while(
$bowob_fa = db_fetch_object($bowob_rs)){
    if(
$bowob_fa->bowob_sync == $bowob_sync && $bowob_fa->bowob_user == $bowob_user){ // Upper Lower Case
     
if($bowob_mode == 2){
       
header("location: http://www.bowob.com/chat.php?type=5&id_chat=".$bowob_id_chat."&id=".$bowob_fa->bowob_id."&sync=".$bowob_sync);
        exit();
      }
      else{
       
$bowob_data = array($bowob_fa->bowob_id, $bowob_sync);
        return
$bowob_data;
      }
    }
  }

  echo
"BoWoB: db error";
  exit();
}

function
bowob_sync(){

  if(!@
is_numeric(arg(1)) || arg(2) == ""){
    echo
"BoWoB: GET: no data received";
    exit();
  }

 
bowob_db_install();

 
db_query("DELETE FROM {bowob} WHERE bowob_time < %d", time() - 300);

 
$bowob_rs = db_fetch_object(db_query("SELECT bowob_sync, bowob_mode, bowob_id_chat, bowob_user, bowob_type, bowob_lang FROM {bowob} WHERE bowob_id = %d AND bowob_sync = '%s'", arg(1), arg(2)));

  if(!
$bowob_rs || $bowob_rs->bowob_sync != arg(2)){
    echo
"BoWoB: GET: bad data received";
    exit();
  }

 
db_query("DELETE FROM {bowob} WHERE bowob_id = %d", arg(1));

 
header('Cache-Control: no-cache');
 
header('Content-Type: text/html; charset=utf-8');

  echo
utf8_encode("bowob_mode: ").$bowob_rs->bowob_mode.utf8_encode("\n");
  echo
utf8_encode("bowob_id_chat: ").$bowob_rs->bowob_id_chat.utf8_encode("\n");
  echo
utf8_encode("bowob_user: ").$bowob_rs->bowob_user.utf8_encode("\n");
  echo
utf8_encode("bowob_type: ").$bowob_rs->bowob_type.utf8_encode("\n");
  echo
utf8_encode("bowob_lang: ").$bowob_rs->bowob_lang.utf8_encode("\n");

}

function
bowob_login(){

 
$bowob_chat_id = bowob_chat_id();
 
$bowob_chat_onlyreg = bowob_chat_onlyreg();
 
$bowob_chat_name = bowob_chat_name();

 
$rooms_all = array();
 
$items = array();
 
$rooms_all_first = -1;
  for(
$i = 0; $i < sizeof($bowob_chat_id); $i++){
    if(
$bowob_chat_onlyreg[$i]){
     
$items[] = l($bowob_chat_name[$i], 'bowob/'.($i + 1), array('title' => $bowob_chat_name[$i]));
    }
    else{
      if(
$rooms_all_first == -1){
       
$rooms_all_first = $i;
      }
     
$rooms_all[$i] = $bowob_chat_name[$i];
    }
  }

  if(!@
is_numeric(arg(1)) || $bowob_chat_id[arg(1) - 1] == NULL){
    if(
sizeof($rooms_all)){
     
drupal_goto('bowob/'.($rooms_all_first + 1));
    }
    else if(
sizeof($items)){
     
drupal_goto('bowob/1');
    }
    else{
     
drupal_goto('');
    }
  }

  if(isset(
$_POST["username"])){
   
bowob_login_submit("bowob_login", $_POST);
  }

  if(
$bowob_chat_onlyreg[arg(1) - 1]){ // Only reg users

   
bowob_login_submit("bowob_login", NULL);

  }
  else{
// All users

   
global $user;
   
$bowob_username = "";

    if(
$user->uid){
     
$bowob_username = $user->name;
    }

    if(
sizeof($rooms_all) == 1){
     
$form = array(
       
'#action' => url('bowob/'.($rooms_all_first + 1)),
       
'#id' => 'bowob-login-form',
       
'#base' => 'bowob_login',
      );

     
$form['username'] = array(
       
'#type' => 'textfield',
       
'#weight' => 2,
       
'#title' => t('Username'),
       
'#maxlength' => USERNAME_MAX_LENGTH,
        (
$bowob_username == "") ? '#' : '#value' => $bowob_username,
       
'#size' => 60,
       
'#required' => TRUE,
       
'#prefix' => $bowob_chat_name[$rooms_all_first],
       
'#description' => t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal'))),
      );

     
$form['submit'] = array(
       
'#type' => 'submit',
       
'#value' => t('Chat'),
       
'#weight' => 3,
      );
    }
    else if(
sizeof($rooms_all) > 1){
     
$form = array(
       
'#action' => url('bowob/1'),
       
'#id' => 'bowob-login-form',
       
'#base' => 'bowob_login',
      );

     
$form['room'] = array(
       
'#type' => 'radios',
       
'#weight' => 2,
       
'#options' => $rooms_all,
       
'#default_value' => (arg(1) - 1),
      );

     
$form['username'] = array(
       
'#type' => 'textfield',
       
'#weight' => 3,
       
'#title' => t('Username'),
       
'#maxlength' => USERNAME_MAX_LENGTH,
        (
$bowob_username == "") ? '#' : '#value' => $bowob_username,
       
'#size' => 60,
       
'#required' => TRUE,
       
'#description' => t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal'))),
      );

       
$submit_js = "for(var i = 0; i < document.getElementById('bowob-login-form').room.length; i++){";
       
$submit_js .= "   if(document.getElementById('bowob-login-form').room[i].checked){";
       
$submit_js .= "      document.getElementById('bowob-login-form').action = '".url("bowob")."/' + (parseInt(document.getElementById('bowob-login-form').room[i].value) + 1);";
       
$submit_js .= "   }";
       
$submit_js .= "}";

     
$form['submit'] = array(
       
'#type' => 'submit',
       
'#weight' => 4,
       
'#value' => t('Chat'),
       
'#attributes' => array('onclick' => $submit_js),
      );
    }

    if(
sizeof($items)){
     
$form['links'] = array(
       
'#weight' => 5,
       
'#value' => theme('item_list', $items)
      );
    }

   
$form['link_powered'] = array(
     
'#type' => 'item',
     
'#weight' => 6,
     
'#value' => '<br><br>Module by <a href="http://www.bowob.com/" target="_blank">BoWoB Chat for Drupal</a>'
   
);

    return
$form;

  }
}

function
bowob_login_submit($form_id, $form_values){

 
$bowob_chat_id = bowob_chat_id();
 
$bowob_chat_onlyreg = bowob_chat_onlyreg();

  if(
$bowob_chat_onlyreg[arg(1) - 1]){ // Only reg users
   
global $user;

    if(
$user->uid){ // Logued
     
global $locale;

     
//CHAT REG
     
$bowob_data = bowob_synchronize(1, $bowob_chat_id[arg(1) - 1], str_replace("'", "\'", str_replace("\\", "\\\\", $user->name)), 0, $locale);

     
$output = "<br>\n";
     
$output .= "<center>\n";
     
$output .= "<script type=\"text/javascript\" src=\"http://www.bowob.com/chat.php?type=1&id_chat=".$bowob_chat_id[arg(1) - 1]."&id=".$bowob_data[0]."&sync=".$bowob_data[1]."\"></script>\n";
     
$output .= "<noscript>NOSCRIPT: This content requires JavaScript.</noscript>\n";
     
$output .= "</center>\n";
      print
theme('page', $output);

      exit();
    }

   
drupal_goto('user');
  }
  else{
// All users

   
$form_values['username'] = trim($form_values['username']);

    if(
$form_values['username'] == ""){
     
form_set_error('username', t('!name field is required.', array('!name' => t('Username'))));
    }

   
// Validate the username:
   
if (user_is_blocked($form_values['username'])) {
     
form_set_error('username', t('The username %name has not been activated or is blocked.', array('%name' => $form_values['username'])));
    }
    else if (
drupal_is_denied('user', $form_values['username'])) {
     
form_set_error('username', t('The name %name is a reserved username.', array('%name' => $form_values['username'])));
    }

    global
$user;
    global
$locale;

    if(
$user->uid){ // Logued
     
if(strtolower($form_values["username"]) == strtolower($user->name)){

       
//CHAT REG
       
$bowob_data = bowob_synchronize(1, $bowob_chat_id[arg(1) - 1], str_replace("'", "\'", str_replace("\\", "\\\\", $user->name)), 0, $locale);

       
$output = "<br>\n";
       
$output .= "<center>\n";
       
$output .= "<script type=\"text/javascript\" src=\"http://www.bowob.com/chat.php?type=1&id_chat=".$bowob_chat_id[arg(1) - 1]."&id=".$bowob_data[0]."&sync=".$bowob_data[1]."\"></script>\n";
       
$output .= "<noscript>NOSCRIPT: This content requires JavaScript.</noscript>\n";
       
$output .= "</center>\n";
        print
theme('page', $output);

        exit();
      }
      else{
        if(
db_result(db_query("SELECT COUNT(*) FROM {users} WHERE LOWER(name) = LOWER('%s')", $form_values["username"])) > 0){
         
form_set_error('username', t('The name %name is already taken.', array('%name' => $form_values["username"])));
        }
        else if(
drupal_is_denied('user', $form_values["username"])){
         
form_set_error('username', t('The name %name has been denied access.', array('%name' => $form_values["username"])));
        }
        else{
         
//CHAT GUEST
         
$bowob_data = bowob_synchronize(1, $bowob_chat_id[arg(1) - 1], $form_values["username"], 1, $locale);

         
$output = "<br>\n";
         
$output .= "<center>\n";
         
$output .= "<script type=\"text/javascript\" src=\"http://www.bowob.com/chat.php?type=1&id_chat=".$bowob_chat_id[arg(1) - 1]."&id=".$bowob_data[0]."&sync=".$bowob_data[1]."\"></script>\n";
         
$output .= "<noscript>NOSCRIPT: This content requires JavaScript.</noscript>\n";
         
$output .= "</center>\n";
          print
theme('page', $output);

          exit();
        }
      }
    }
    else{
// Guest

     
if(db_result(db_query("SELECT COUNT(*) FROM {users} WHERE LOWER(name) = LOWER('%s')", $form_values["username"])) > 0){
       
form_set_error('username', t('The name %name is already taken.', array('%name' => $form_values["username"])));
      }
      else if(
drupal_is_denied('user', $form_values["username"])){
       
form_set_error('username', t('The name %name has been denied access.', array('%name' => $form_values["username"])));
      }
      else{
       
//CHAT GUEST
       
$bowob_data = bowob_synchronize(1, $bowob_chat_id[arg(1) - 1], $form_values["username"], 1, $locale);

       
$output = "<br>\n";
       
$output .= "<center>\n";
       
$output .= "<script type=\"text/javascript\" src=\"http://www.bowob.com/chat.php?type=1&id_chat=".$bowob_chat_id[arg(1) - 1]."&id=".$bowob_data[0]."&sync=".$bowob_data[1]."\"></script>\n";
       
$output .= "<noscript>NOSCRIPT: This content requires JavaScript.</noscript>\n";
       
$output .= "</center>\n";
        print
theme('page', $output);

        exit();
      }
    }
  }

}

function
bowob_disable(){
  if(
db_table_exists("bowob")){
   
$ret = array();
   
db_drop_table($ret, "bowob");
  }
}

function
bowob_footer($main = 0){
  return
"<br><center><div style=\"clear: both; font-size: 10px; text-align: center;\">Chat module by <a href=\"http://www.bowob.com/\" target=\"_blank\">BoWoB Chat for Drupal</a></div></center>";
}

?>

#3

PerryM - October 28, 2008 - 13:04

I did try moving the 2 files bowob.module and bowob.info to the folder:

/sties/all/modules/bowob/

And got even worse errors, if the folder is named /sites/all/modules/bowob_drupal things seem to work better.

#4

bowob - October 28, 2008 - 16:22

Log in www.bowob.com, "Website Administration":

"Edit Data":
- Your website address is wrong, it should be "www.xxxxxxxxxxx.com/drupal".

"Install":
- Redownload the module.
- Be careful with:

File must locate:
"http://#YOUR_WEBSITE#/sites/all/modules/bowob/bowob.module"
"http://#YOUR_WEBSITE#/sites/all/modules/bowob/bowob.info"

#5

PerryM - October 28, 2008 - 20:21

Getting closer.

I now see a "Chat" page and my rooms on the left login. When I select the room I now see a weird page - it is not graphic but a few lines:

Name of the chat room
Main
User name
B
U
I
[ box to enter text]
Send

BWBBYJLP

I don't know what to do next.

#6

bowob - October 29, 2008 - 00:21

You must install the BoWoB Theme:

Log in www.bowob.com, "Website Administration", "Customize" (Be careful with the path).

#7

bowob - November 5, 2008 - 11:56
Status:active» closed

#8

danman28 - January 17, 2009 - 13:53

Hello,

I have a problem with the chat module on my site for drupal.

I followed the guide and filled in a webaddress were bowob is located

eg, /sites/all/modules/bowob/

the webaddress i use on your site for setup: www.princeton26.co.cc (subdomain)

but that didn't work i got a message saying: SYNCHRONIZE: no data received

so i tried other address princeton.byethost14.com (where files are stored on server)

but still same message SYNCHRONIZE: no data received

i tried these addresses but still got SYNCHRONIZE: no data received

I updated the files everytime i tried to change the webaddres

but still same, i disabled the module when update took place and re-enabled it after update

but still same message and no chat is seen.

Hope it will work love the chat if it's working.

hope to hear from you soon

best regards

#9

danman28 - January 17, 2009 - 13:51
Status:closed» active

#10

bowob - January 17, 2009 - 21:44

Try deleting your website in bowob.com and create a new one, doing all the steps.

This is a personal issue, for more support use bowob.com support.

#11

bowob - January 18, 2009 - 22:58
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.