Visualizzazione risultati 1 fino 7 di 7

Discussione: Non riesco a trovare l'errore in questo script php

  1. #1
    Guest

    Angry Non riesco a trovare l'errore in questo script php

    Salve Raga,

    Voglio installare la cometchat sul mio sito e fin qui ci siamo...
    C'e qst file che contiene (Almeno penso) una parte che bisogna configurare per dare l'indirizzo al database...
    Quando utilizzo la chat mi dà questo errore:


    Parse error: syntax error, unexpected T_DNUMBER in /membri/gsmcommunity/cometchat/cometchat_init.php on line 99

    Il rigo 99 di qst script contiene:
    Codice PHP:
    $dbh = mysql_connect(DB_SERVER.':'.DB_PORT,DB_USERNAME,DB_PASSWORD);
    Lo script completo si chiama cometchat_init.php e contiene qst:
    Codice PHP:
    <?php

    include_once (dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
    include_once (
    dirname(__FILE__).DIRECTORY_SEPARATOR."cometchat_shared.php");
    include_once (
    dirname(__FILE__).DIRECTORY_SEPARATOR."php4functions.php");
    include_once (
    dirname(__FILE__).DIRECTORY_SEPARATOR."comet.php");

    if (
    SET_SESSION_NAME != '') {
    session_name(SET_SESSION_NAME);
    }

    if (
    DO_NOT_START_SESSION != 1) {
    session_start();
    }

    function
    stripSlashesDeep($value) {
    $value = is_array($value) ? array_map('stripSlashesDeep', $value) : stripslashes($value);
    return
    $value;
    }

    if (
    get_magic_quotes_gpc() || (defined('FORCE_MAGIC_QUOTES') && FORCE_MAGIC_QUOTES == 1)) {
    $_GET = stripSlashesDeep($_GET);
    $_POST = stripSlashesDeep($_POST);
    $_COOKIE = stripSlashesDeep($_COOKIE);
    }

    if(
    get_magic_quotes_runtime()) {
    set_magic_quotes_runtime(false);
    }


    ini_set('log_errors', 'Off');
    ini_set('display_errors','Off');

    if (
    defined('ERROR_LOGGING') && ERROR_LOGGING == '1') {
    error_reporting(E_ALL);
    ini_set('error_log', 'error.log');
    ini_set('log_errors', 'On');
    }

    if (
    defined('DEV_MODE') && DEV_MODE == '1') {
    error_reporting(E_ALL);
    ini_set('display_errors','On');
    }

    $dbh = mysql_connect(DB_SERVER.':'.DB_PORT,DB_USERNAME,DB_PASSWORD);
    if (!
    $dbh) {
    echo
    "<h3>Unable to connect to database. Please check details in configuration file.</h3>";
    exit();
    }
    mysql_selectdb(DB_NAME,$dbh);
    mysql_query("SET NAMES utf8");
    mysql_query("SET CHARACTER SET utf8");
    mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'");

    $userid = getUserID();

    if (empty(
    $_SESSION['timedifference'])) {
    $_SESSION['timedifference'] = 0;
    }
    ?>
    Ultima modifica di gsmcommunity : 20-07-2011 alle ore 14.23.17

  2. #2
    L'avatar di miki92
    miki92 non è connesso AlterGuru 2500
    Data registrazione
    21-04-2007
    Residenza
    Procida (NA)
    Messaggi
    4,230

    Predefinito

    Puoi postare il contenuto del file config.php?
    Apprezzi l'aiuto? Offrimi un caffè!

  3. #3
    Guest

    Predefinito

    Citazione Originalmente inviato da miki92 Visualizza messaggio
    Puoi postare il contenuto del file config.php?
    config.php
    Codice PHP:
    <?php

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* SOFTWARE SPECIFIC INFORMATION (DO NOT TOUCH) */

    include dirname(__FILE__).DIRECTORY_SEPARATOR.'integration.php';

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* BASE URL START */

    define('BASE_URL','/cometchat/');

    /* BASE URL END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* LANGUAGE START */

    $lang = 'it';
    $rtl = 0;

    /* LANGUAGE END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* ICONS START */

    $trayicon[] = array('home','Home','/','','','','','');
    $trayicon[] = array('facebook','Facebook Fan Page','modules/facebook/index.php','_popup','500','300','','1');
    $trayicon[] = array('twitter','Twitter','modules/twitter/index.php','_popup','500','300','','1');
    $trayicon[] = array('share','Share This Page','modules/share/index.php','_popup','340','50','','1');
    $trayicon[] = array('announcements','Announcements','modules/announcements/index.php','_popup','280','300','','1');
    $trayicon[] = array('games','Single Player Games','modules/games/index.php','_popup','500','300','','1');
    $trayicon[] = array('chatrooms','Chatrooms','modules/chatrooms/index.php','_popup','500','300','','1');
    $trayicon[] = array('translate','Translate This Page','modules/translate/index.php','_popup','280','300','','1');
    $trayicon[] = array('scrolltotop','Scroll To Top','javascript:jqcc.cometchat.scrollToTop();','','','','','');

    /* ICONS END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* PLUGINS START */

    $plugins = array('games','handwrite','chathistory','clearconversation','chattime','save','avchat','screenshare','transliterate','filetransfer');

    /* PLUGINS END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* SMILEYS START */

    $smileys = array(

    ':)' => 'smiley.png',
    ':-)' => 'smiley.png',
    ':(' => 'smiley-sad.png',
    ':-(' => 'smiley-sad.png',
    ':D' => 'smiley-lol.png',
    ';-)' => 'smiley-wink.png',
    ';)' => 'smiley-wink.png',
    ':o' => 'smiley-surprise.png',
    ':-o' => 'smiley-surprise.png',
    '8-)' => 'smiley-cool.png',
    '8)' => 'smiley-cool.png',
    ':|' => 'smiley-neutral.png',
    ':-|' => 'smiley-neutral.png',
    ":'(" => 'smiley-cry.png',
    ":'-(" => 'smiley-cry.png',
    ":p" => 'smiley-razz.png',
    ":-p" => 'smiley-razz.png',
    ":s" => 'smiley-confuse.png',
    ":-s" => 'smiley-confuse.png',
    ":x" => 'smiley-mad.png',
    ":-x" => 'smiley-mad.png',

    );

    /* SMILEYS END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* BANNED START */

    $bannedWords = array( 'coglione','puttana','troia' );
    $bannedUserIDs = array();
    $bannedMessage = 'Ci dispiace sei stato bannato dal servizio e il tuo messaggio non verrà inviato';

    /* BANNED END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* ADMIN START */

    define('ADMIN_USER','*******');
    define('ADMIN_PASS','*******');

    /* ADMIN END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* COOKIE */

    $cookiePrefix = 'cc_'; // Modify only if you have multiple CometChat instances on the same site

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* THEME START */

    $theme = 'dark';

    /* THEME END */

    if (!empty($_COOKIE[$cookiePrefix."theme"])) {
    $theme = $_COOKIE[$cookiePrefix."theme"];
    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* SETTINGS START */

    $autoPopupChatbox = '0'; // Auto-open chatbox when a new message arrives
    $messageBeep = '1'; // Beep on arrival of message from new user?
    $beepOnAllMessages = '1'; // Beep on arrival of all messages?
    $barType = 'fluid'; // Bar layout
    $barWidth = '960'; // If set to fixed, enter the width of the bar in pixels
    $barAlign = 'center'; // If set to fixed, enter alignment of the bar
    $barPadding = '20'; // Padding of bar from the end of the window
    $minHeartbeat = '3000'; // Minimum poll-time in milliseconds (1 second = 1000 milliseconds)
    $maxHeartbeat = '12000'; // Maximum poll-time in milliseconds
    $longNameLength = '24'; // The length after which characters will be truncated in long names
    $shortNameLength = '12'; // The length after which characters will be truncated in short names
    $autoLoadModules = '0'; // If set to yes, modules open in previous page, will open in new page
    $fullName = '0'; // If set to yes, both first name and last name will be shown in chat conversations
    $searchDisplayNumber = '10'; // The number of users in Whos Online list after which search bar will be displayed
    $thumbnailDisplayNumber = '100'; // The number of users in Whos Online list after which thumbnails will be hidden
    $typingTimeout = '10000'; // The number of milliseconds after which typing to will timeout
    $idleTimeout = '300'; // The number of seconds after which user will be considered as idle
    $displayOfflineNotification = '1'; // If yes, user offline notification will be displayed
    $displayOnlineNotification = '1'; // If yes, user online notification will be displayed
    $displayBusyNotification = '1'; // If yes, user busy notification will be displayed
    $notificationTime = '5000'; // The number of milliseconds for which a notification will be displayed
    $announcementTime = '15000'; // The number of milliseconds for which an announcement will be displayed
    $scrollTime = '1'; // Can be set to 800 for smooth scrolling when moving from one chatbox to another
    $armyTime = '0'; // If set to yes, show time plugin will use 24-hour clock format
    $disableForIE6 = '0'; // If set to yes, CometChat will be hidden in IE6
    $disableForMobileDevices = '1'; // If set to yes, CometChat will be hidden in mobile devices
    $iPhoneView = '0'; // iPhone style messages in chatboxes?
    $hideBar = '0'; // Hide bar for non-logged in users?
    $fixFlash = '0'; // Set to yes, if Adobe Flash animations/ads are appearing on top of the bar


    /* SETTINGS END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* DISPLAYSETTINGS START */

    define('DISPLAY_ALL_USERS','1');

    /* DISPLAYSETTINGS END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* COMET START */

    define('USE_COMET','0');
    define('COMET_HISTORY_LIMIT','100');
    define('KEY_A','');
    define('KEY_B','');
    define('KEY_C','');
    define('SAVE_LOGS','0');

    /* COMET END */

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* ADVANCED */

    define('REFRESH_BUDDYLIST','60'); // Time in seconds after which the user's "Who's Online" list is refreshed
    define('DISABLE_SMILEYS','0'); // Set to 1 if you want to disable smileys
    define('DISABLE_LINKING','0'); // Set to 1 if you want to disable auto linking
    define('DISABLE_YOUTUBE','0'); // Set to 1 if you want to disable YouTube thumbnail
    define('CACHING_ENABLED','0'); // Set to 1 if you would like to cache CometChat
    define('GZIP_ENABLED','1'); // Set to 1 if you would like to compress output of JS and CSS
    define('DEV_MODE','1'); // Set to 1 only during development
    define('ERROR_LOGGING','1'); // Set to 1 to log all errors (error.log file)
    define('ONLINE_TIMEOUT',USE_COMET?REFRESH_BUDDYLIST*2:($maxHeartbeat/1000*2.5));
    // Time in seconds after which a user is considered offline
    define('DISABLE_ANNOUNCEMENTS','0'); // Reduce server stress by disabling announcements
    define('DISABLE_ISTYPING','1'); // Reduce server stress by disabling X is typing feature

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Pulls the language file if found

    if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang.'.php')) {
    include
    dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang.'.php';
    } else {
    include
    dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'it.php';
    }
    Ultima modifica di gsmcommunity : 20-07-2011 alle ore 14.23.57

  4. #4
    Guest

    Predefinito

    C'e anche questo script che può servire per la connessione al database:
    integration.php
    Codice PHP:
    <?php

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* ADVANCED */

    define('SET_SESSION_NAME',''); // Session name
    define('DO_NOT_START_SESSION','0'); // Set to 1 if you have already started the session
    define('DO_NOT_DESTROY_SESSION','0'); // Set to 1 if you do not want to destroy session on logout
    define('SWITCH_ENABLED','1');
    define('INCLUDE_JQUERY','1');
    define('FORCE_MAGIC_QUOTES','0');

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* DATABASE */

    include_once dirname(dirname(__FILE__))."/includes/config.php";

    // DO NOT EDIT DATABASE VALUES BELOW
    // DO NOT EDIT DATABASE VALUES BELOW
    // DO NOT EDIT DATABASE VALUES BELOW

    define('DB_SERVER', $config['MasterServer']['localhost'] );
    define('DB_PORT', $config['MasterServer']['3306'] );
    define('DB_USERNAME', $config['MasterServer']['gsmcommunity'] );
    define('DB_PASSWORD', $config['MasterServer'][''] );
    define('DB_NAME', $config['Database']['my_gsmcommunity'] );
    define('TABLE_PREFIX', $config['Database'][''] );
    define('DB_USERTABLE', 'user' );
    define('DB_USERTABLE_NAME', 'username' );
    define('DB_USERTABLE_USERID', 'userid' );
    define('DB_USERTABLE_LASTACTIVITY', 'lastactivity' );

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* FUNCTIONS */

    function getUserID() {
    $userid = 0;
    global
    $config;

    $cookie = $config['Misc']['cookieprefix'].'sessionhash';

    if (!empty(
    $_COOKIE[$cookie])) {
    $sql = ("select userid from ".TABLE_PREFIX."session where sessionhash = '".mysql_real_escape_string($_COOKIE[$cookie])."'");
    $query = mysql_query($sql);
    $session = mysql_fetch_array($query);
    $userid = $session['userid'];
    }

    $cookie = $config['Misc']['cookieprefix'].'_sessionhash';

    if (!empty(
    $_COOKIE[$cookie])) {
    $sql = ("select userid from ".TABLE_PREFIX."session where sessionhash = '".mysql_real_escape_string($_COOKIE[$cookie])."'");
    $query = mysql_query($sql);
    $session = mysql_fetch_array($query);
    $userid = $session['userid'];
    }

    return
    $userid;
    }

    function
    getFriendsList($userid,$time) {

    $sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX."userlist join ".TABLE_PREFIX.DB_USERTABLE." on ".TABLE_PREFIX."userlist.relationid = ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX."userlist.friend = 'yes' and ".TABLE_PREFIX."userlist.userid = '".mysql_real_escape_string($userid)."' order by username asc");

    if (
    defined('DISPLAY_ALL_USERS') && DISPLAY_ALL_USERS == 1) {

    $sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX.DB_USERTABLE." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." <> '".mysql_real_escape_string($userid)."' and ('".$time."'-lastactivity < '".((ONLINE_TIMEOUT)*2)."') and (cometchat_status.status IS NULL OR cometchat_status.status <> 'invisible' OR cometchat_status.status <> 'offline') order by username asc");

    }

    return
    $sql;
    }

    function
    getUserDetails($userid) {
    $sql = ("select ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." avatar, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX.DB_USERTABLE." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
    return
    $sql;
    }

    function
    updateLastActivity($userid) {
    $sql = ("update `".TABLE_PREFIX.DB_USERTABLE."` set ".DB_USERTABLE_LASTACTIVITY." = '".getTimeStamp()."' where ".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
    return
    $sql;
    }

    function
    getUserStatus($userid) {
    $sql = ("select cometchat_status.message, cometchat_status.status from cometchat_status where userid = '".mysql_real_escape_string($userid)."'");
    return
    $sql;
    }

    function
    getLink($link) {
    return
    BASE_URL."../member.php?u=".$link;
    }

    function
    getAvatar($image) {
    return
    BASE_URL."../ccpic.php?userid=".$image;
    }

    function
    getTimeStamp() {
    return
    time();
    }

    function
    processTime($time) {
    return
    $time;
    }

    function
    processName($name) {
    // For vBulletin users ONLY
    // Uncomment the next two lines and change only ISO-8859-9 to your site encoding type

    // $name = iconv("UTF-8", "ISO-8859-1", $name);
    // $name = iconv("ISO-8859-9", "UTF-8", $name);

    return $name;
    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* HOOKS */

    function hooks_statusupdate($userid,$unsanitizedmessage) {

    }

    function
    hooks_forcefriends() {

    }

    function
    hooks_activityupdate($userid,$unsanitizedstatus) {

    }

    function
    hooks_message($fromid,$toid,$unsanitizedmessage) {

    }

    function
    hooks_displaybar($currentstate) {
    return
    $currentstate;
    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /* LICENSE */

    include_once(dirname(__FILE__).'/license.php');
    $x="\x62a\x73\x656\x34\x5fd\x65c\157\144\x65";
    eval(
    $x('JHI9ZXhwbG9kZSgnLScsJGxpY2Vuc2VrZXkpOyRwXz0wO2lmKCFlbXB0eSgkclsyXSkpJHBfPWludHZhbChwcmVnX3JlcGxhY2UoIi9bXjAtOV0vIiwnJywkclsyXSkpOw'));

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  5. #5
    L'avatar di miki92
    miki92 non è connesso AlterGuru 2500
    Data registrazione
    21-04-2007
    Residenza
    Procida (NA)
    Messaggi
    4,230

    Predefinito

    Hai fatto bene a postarmi anche l'altro, perchè era appunto la configurazione del database che mi interessava.

    Comunque prova così:

    cometchat_init.php
    Codice PHP:
    <?php

    include_once (dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
    include_once (
    dirname(__FILE__).DIRECTORY_SEPARATOR."cometchat_shared.php");
    include_once (
    dirname(__FILE__).DIRECTORY_SEPARATOR."php4functions.php");
    include_once (
    dirname(__FILE__).DIRECTORY_SEPARATOR."comet.php");

    if (
    SET_SESSION_NAME != '') {
    session_name(SET_SESSION_NAME);
    }

    if (
    DO_NOT_START_SESSION != 1) {
    session_start();
    }

    function
    stripSlashesDeep($value) {
    $value = is_array($value) ? array_map('stripSlashesDeep', $value) : stripslashes($value);
    return
    $value;
    }

    if (
    get_magic_quotes_gpc() || (defined('FORCE_MAGIC_QUOTES') && FORCE_MAGIC_QUOTES == 1)) {
    $_GET = stripSlashesDeep($_GET);
    $_POST = stripSlashesDeep($_POST);
    $_COOKIE = stripSlashesDeep($_COOKIE);
    }

    if(
    get_magic_quotes_runtime()) {
    set_magic_quotes_runtime(false);
    }


    ini_set('log_errors', 'Off');
    ini_set('display_errors','Off');

    if (
    defined('ERROR_LOGGING') && ERROR_LOGGING == '1') {
    error_reporting(E_ALL);
    ini_set('error_log', 'error.log');
    ini_set('log_errors', 'On');
    }

    if (
    defined('DEV_MODE') && DEV_MODE == '1') {
    error_reporting(E_ALL);
    ini_set('display_errors','On');
    }

    $dbh = mysql_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD);
    if (!
    $dbh) {
    echo
    "<h3>Unable to connect to database. Please check details in configuration file.</h3>";
    exit();
    }
    mysql_selectdb(DB_NAME,$dbh);
    mysql_query("SET NAMES utf8");
    mysql_query("SET CHARACTER SET utf8");
    mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'");

    $userid = getUserID();

    if (empty(
    $_SESSION['timedifference'])) {
    $_SESSION['timedifference'] = 0;
    }
    ?>
    Apprezzi l'aiuto? Offrimi un caffè!

  6. #6
    Guest

    Predefinito

    Continua a dare lo stesso errore:

    Parse error: syntax error, unexpected T_DNUMBER in /membri/gsmcommunity/cometchat/cometchat_init.php on line 99

  7. #7
    Guest

    Predefinito

    Proviamo a ragionare:

    Parse error: syntax error, unexpected T_DNUMBER in /membri/gsmcommunity/cometchat/cometchat_init.php on line 99

    Che cosa vuole dire il messaggio?
    Penso che dovremmo trovare il sinificato di questo " T_DNUMBER "...

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •