Pagina 1 din 1

unexpected '['

Scris: Mar Iul 09, 2013 9:32 pm
de bresti
am erroare asta:
Parse error: syntax error, unexpected '[' in /home/traffixmedia/data/www/sqlfnc.php on line 187
iar linia 187 este :
$JABBER->server = explode("@",$jabber_sender)[1];

pe un alt server , nu aveam nici o problema .
acuma serverul are PHP Version 5.3.23
ceenou.ro/info.php

aici am tot codul:

Cod: Selectaţi tot

//########################################################################
//## >> JABBER FUNCTIONS
//########################################################################

function SendReport($report_msg){
   $jabber_on = GetOption("jabber_on");
   $jabber_sender = GetOption("jabber_sender");
   $jabber_password = GetOption("jabber_password");
   $jabber_port = GetOption("jabber_port");
   $jabber_recepient = GetOption("jabber_recepient");
   
   if($jabber_on == "on"){
      $JABBER = new Jabber;
      $JABBER->server = explode("@",$jabber_sender)[1];
      $JABBER->port = (int)$jabber_port;
      $JABBER->username = explode("@",$jabber_sender)[0];
      $JABBER->password = $jabber_password;
      $JABBER->resource = 'ClassJabberPHP';
      if($JABBER->Connect()){
         if($JABBER->SendAuth()){
            $JABBER->SendPresence(NULL,NULL,'online');
            $JABBER->SendMessage($jabber_recepient, 'chat', NULL, array( 'body' => $report_msg));
            $JABBER->Disconnect();
            return true;
         }
      }      
   }
   return false;
}

Re: unexpected '['

Scris: Mie Iul 10, 2013 12:38 am
de double-bit
Pentru ca pe celalalt server era php 5.4

Eroarea ta e de aici:

Cod: Selectaţi tot

$JABBER->server = explode("@",$jabber_sender)[1];


Trebuie sa inlocuiesti cu

Cod: Selectaţi tot

$sender = explode("@",$jabber_sender)
$JABBER->server = $sender[1];


Iar apoi

Cod: Selectaţi tot

$JABBER->username = explode("@",$jabber_sender)[0];


inlocuieste cu

Cod: Selectaţi tot

$JABBER->username = $sender[0];

Re: unexpected '['

Scris: Mie Iul 10, 2013 1:03 pm
de bresti
saru`mana, dar cred ca am sa revin la o alta versiune de php