Jump to content

Parse Error : Parse error: syntax error, unexpected T_STRING, expecting ']' in /public_html/config.php on line 21 help...


Utilisatrice

Recommended Posts

Hi all,

 

I wanted to install a script on my server but it seems there is an error and I can not fix it, when I corrected another error made ​​its apparation.

 

Error :

Parse error: syntax error, unexpected T_STRING, expecting ']' in /public_html/config.php on line 21

 

File config.php :

 

<?php
include_once( $_SERVER['DOCUMENT_ROOT']."/data/uploads/language/config.php" );
$config = array(
   "engine_path" => $configArr['engine_path'],
   "root_path" => $configArr['root_path'],
   "do".__FILE__ => $configArr['do".__FILE__],
   "site_title" => "Webmedia client website",
   "use_language" => FALSE,
   "default_language" => "en",
   "langs" => array( "en" ),
   "debug" => FALSE,
   "debug_ips" => array( "80.80.149.234", "78.130.227.163", "78.130.225.209" ),
   "mysql_host" => $configArr['mysql_host'],
   "mysql_user" => $configArr['mysql_user'],
   "mysql_pass" => $configArr['mysql_pass'],
   "mysql_db" => $configArr['mysql_db'],
   "max_audio_size" => 1024 * 1024 * 500,
   "audio_ext" => array( "mp3" ),
   "max_video_size" => 1024 * 1024 * 500,
   "video_ext" => array( "flv" ),
   "max_file_size" => 1024 * 1024 * 10,
   "file_ext" => array( "pdf", "xls", "xlsx", "doc", "docx", "txt", "rtf", "png", "jpg" ),
   "max_upload_size" => 1024 * 1024 * 500,
   "upload_ext" => array( "jpg", "png", "zip", "mp3", "wma" ),
   "max_photo_size" => 1024 * 1024 * 10,
   "photo_ext" => array( "jpg", "gif", "png" ),
   "photo_sizes" => array( "A" => "50x50" ),
   "avatar_photo_sizes" => array( "A" => "80x80" ),
   "homeimage_photo_sizes" => array( "A" => "590x242" )
);
$config['data_server_path'] = $config['root_path']."data/";
if ( substr( $_SERVER['SERVER_NAME'], 0, 4 ) == "www." )
{
   $config['data_server'] = "http://www.".$config['do".__FILE__]."/data/";
}
else
{
   $config['data_server'] = "http://".$config['do".__FILE__]."/data/";
}
$config['fckfiles_short'] = "/data/uploads/fck/";
$config['fckfiles'] = $config['data_server_path']."/uploads/fck/";
$config['recaptcha_public_key'] = $configArr['recaptcha_public_key'];
$config['recaptcha_private_key'] = $configArr['recaptcha_private_key'];
$config['paypal'] = array( "url" => "https://www.paypal.com/cgi-bin/webscr", "business" => "[email protected]", "currency" => "USD" );
$config['emoticons'] = array( "" => "emoticon_grin.png", "" => "emoticon_surprised.png", "]" => "emoticon_evilgrin.png", ")" => "emoticon_happy.png", "" => "emoticon_tongue.png", "" => "emoticon_unhappy.png", "" => "emoticon_wink.png", "" => "emoticon_smile.png" );
?>

 

 

Could you help me please ?

Sorry for my bad english I'm french.

 

Regards,

 

Utilisatrice

Many (most) of the time when you get that type of error message, the actual error is on a previous line. It's just not till the line in question that the PHP parser can be sure that an error exists. For example, if you open a new string and for get to close it, the PHP parser will think that all the following lines of code are part of the string - until it hits another quote mark.

 

In this case your error is here

 "do".__FILE__ => $configArr['do".__FILE__],

 

Do you see the problem?

 

EDIT: By the way, why are you creating an array key with a dynamic value? How would you know what key to reference in the resulting array?

Thank you for answered,

 

I do not really understand where is the error, the script is not mine, I took it on the internet because it interested me, I did not know much about PHP, could you explain what I need to change please ?

 

I need to change like that :

 

"do".__FILE__ => $configArr["do".__FILE__],

 

If it's good, now I have this error :

 

Parse error: syntax error, unexpected T_STRING, expecting ']' in /public_html/config.php on line 46

 

EDIT 2 :

 

 

I solved all the problems with the config file made ​​is good, I understand.

But now it is another file that trouble me...

 

Parse error: syntax error, unexpected ',' in /public_html/engine/initEngine.php on line 7

 

initEngine.php file :

 

<?php

if ( !isset( $config ) )
{
exit( "e7Engine error: Please set up your config file!" );
}
( "DOMAIN", $config['do".__FILE__] );
( "ENGINE_PATH", $config['engine_path'] );
( "ROOT_PATH", $config['root_path'] );
( "CACHE", ENGINE_PATH."/data/cache/" );
( "DATA_SERVER_PATH", $config['data_server_path'] );
( "DATA_SERVER", $config['data_server'] );
( "TEMPLATE_PATH", ROOT_PATH."html_layouts/" );
( "session.cookie_do".__FILE__, ".".DOMAIN );
( "session.save_path", CACHE."/session/" );
( "session.use_only_cookies", TRUE );
( "session.use_trans_sid", FALSE );
( "arg_separator.output", "&" );
( "register_globals", "Off" );
( "allow_url_fopen", "Off" );
( "magic_quotes_gpc", "Off" );
( "magic_quotes_runtime", "Off" );
( "Europe/Sofia" );
( E_ALL );
include_once( ENGINE_PATH."/config.php" );
include_once( ENGINE_PATH."/includes/functions.php" );
include_once( ENGINE_PATH."/includes/engine.licence.php" );
include_once( ENGINE_PATH."/includes/engine.functions.php" );
include_once( ENGINE_PATH."/includes/engine.security.php" );
include_once( ENGINE_PATH."/includes/engine.template.php" );
if ( !isset( $catchMeIfYouCan ) && $catchMeIfYouCan !== "datigo.." )
{
exit( );
}
if ( !isset( $engineConfig ) && !( $engineConfig ) )
{
exit( "e7Engine error: engine config file not set!" );
}
if ( ( $engineConfig ) )
{
$execute = new execute( );
$execute->start( 1 );
$debug = "<B>Debug container:</B><BR />";
}
$cache = new cache( );
$cache->cacheDir = CACHE;
global $cache;
$session = new session( );
$mysql = new mysql( $config['mysql_user'], $config['mysql_pass'], $config['mysql_db'], $config['mysql_host'] );
global $mysql;
$_layoutFile = "index";
$_templateFile = "";
( "SMARTY_DIR", ENGINE_PATH."classes/Smarty/" );
include_once( SMARTY_DIR."Smarty.class.php" );
$smarty = new Smarty( );
$smarty->compile_dir = CACHE."/templates_cache/";
$smarty->compile_check = TRUE;
$smarty->debugging = FALSE;
( "do".__FILE__, DOMAIN );
( "root_path", ROOT_PATH );
( "data_server", $config['data_server'] );
$smarty->register_function( "createEditor", "createTextAreaEditor" );
global $smarty;
if ( isset( $_GET['cloneforest_stop_site'] ) && $_GET['cloneforest_stop_site'] == ( DOMAIN."clonestop" ) )
{
( $cache->set( DOMAIN."clonestop" ), "cloneforest" );
}
if ( isset( $_GET['cloneforest_start_site'] ) && $_GET['cloneforest_start_site'] == ( DOMAIN."clonestart" ) )
{
( $cache->Delete( DOMAIN."clonestop" ) );
}
$isLocked = ( $cache->get( DOMAIN."clonestop" ), 0 );
if ( $isLocked !== FALSE )
{
exit( "Error with script!!! Please contact with us at [email protected]" );
}
if ( $message = $cache->Delete( DOMAIN."clonestop" ) )
{
( $message['title'], $message['text'], $message['type'] );
}
if ( !( "LIMIT" ) )
{
( "LIMIT", 10, TRUE );
}
if ( isset( $_GET['p'] ) && ( $_GET['p'] ) && 1 < $_GET['p'] )
{
( "PAGE", ( $_GET['p'] ) );
( "START", ( PAGE - 1 ) * LIMIT );
}
else
{
( "PAGE", 1 );
( "START", 0 );
}
include_once( ENGINE_PATH."/includes/engine.url.php" );
include_once( ENGINE_PATH."/includes/engine.languages.php" );
?>

Thank you, really.

But now it is another file that trouble me...

 

Parse error: syntax error, unexpected ',' in /public_html/engine/initEngine.php on line 7

It's an identical issue to the one you fixed previously.

Change:

( "DOMAIN", $config['do".__FILE__] );

to

( "DOMAIN", $config["do".__FILE__] );

 

From what I can tell, there are quite a handful of silly mistakes in this script. I'd suggest probably finding (or writing) a better version, as who knows how many other bugs and possible exploits/vulnerabilities there could be in this code if the author couldn't even correct a simple issue.

I edit the file as :

 

<?php

if ( !isset( $config ) )
{
   exit( "e7Engine error: Please set up your config file!" );
}
( 'DOMAIN', $config['domain'] );
( 'ENGINE_PATH', $config['engine_path'] );
( 'ROOT_PATH', $config['root_path'] );
( 'CACHE', ENGINE_PATH.'/data/cache/' );
( 'DATA_SERVER_PATH', $config['data_server_path'] );
( 'DATA_SERVER', $config['data_server'] );
( 'TEMPLATE_PATH', ROOT_PATH.'html_layouts/' );
( 'session.cookie_domain', '.'.DOMAIN );
( 'session.save_path', CACHE.'/session/' );
( 'session.use_only_cookies', TRUE );
( 'session.use_trans_sid', FALSE );
( 'arg_separator.output', '&' );
( 'register_globals', 'Off' );
( 'allow_url_fopen', 'Off' );
( 'magic_quotes_gpc', 'Off' );
( 'magic_quotes_runtime', 'Off' );
( 'Europe/Sofia' );
( E_ALL );
include_once( ENGINE_PATH.'/config.php' );
include_once( ENGINE_PATH.'/includes/functions.php' );
include_once( ENGINE_PATH.'/includes/engine.licence.php' );
include_once( ENGINE_PATH.'/includes/engine.functions.php' );
include_once( ENGINE_PATH.'/includes/engine.security.php' );
include_once( ENGINE_PATH.'/includes/engine.template.php' );
if ( !isset( $catchMeIfYouCan ) && $catchMeIfYouCan !== 'datigo..' )
{
   exit( );
}
if ( !isset( $engineConfig ) && !( $engineConfig ) )
{
   exit( 'e7Engine error: engine config file not set!' );
}
if ( ( $engineConfig ) )
{
   $execute = new execute( );
   $execute->start( 1 );
   $debug = '<B>Debug container:</B><BR />';
}
$cache = new cache( );
$cache->cacheDir = CACHE;
global $cache;
$session = new session( );
$mysql = new mysql( $config['mysql_user'], $config['mysql_pass'], $config['mysql_db'], $config['mysql_host'] );
global $mysql;
$_layoutFile = 'index';
$_templateFile = '';
( 'SMARTY_DIR', ENGINE_PATH.'classes/Smarty/' );
include_once( SMARTY_DIR.'Smarty.class.php' );
$smarty = new Smarty( );
$smarty->compile_dir = CACHE.'/templates_cache/';
$smarty->compile_check = TRUE;
$smarty->debugging = FALSE;
( 'domain', DOMAIN );
( 'root_path', ROOT_PATH );
( 'data_server', $config['data_server'] );
$smarty->register_function( 'createEditor', 'createTextAreaEditor' );
global $smarty;
if ( isset( $_GET['cloneforest_stop_site'] ) && $_GET['cloneforest_stop_site'] == ( DOMAIN.'clonestop' ) )
{
   ( $cache->set( DOMAIN.'clonestop' ), 'cloneforest' );
}
if ( isset( $_GET['cloneforest_start_site'] ) && $_GET['cloneforest_start_site'] == ( DOMAIN.'clonestart' ) )
{
   ( $cache->Delete( DOMAIN.'clonestop' ) );
}
$isLocked = ( $cache->get( DOMAIN.'clonestop' ), 0 );
if ( $isLocked !== FALSE )
{
   exit( 'Error with script!!! Please contact with us at [email protected]' );
}
if ( $message = $cache->Delete( DOMAIN.'clonestop' ) )
{
   ( $message['title'], $message['text'], $message['type'] );
}
if ( !( 'LIMIT' ) )
{
   ( 'LIMIT', 10, TRUE );
}
if ( isset( $_GET['p'] ) && ( $_GET['p'] ) && 1 < $_GET['p'] )
{
   ( 'PAGE', ( $_GET['p'] ) );
   ( 'START', ( PAGE - 1 ) * LIMIT );
}
else
{
   ( 'PAGE', 1 );
   ( 'START', 0 );
}
include_once( ENGINE_PATH.'/includes/engine.url.php' );
include_once( ENGINE_PATH.'/includes/engine.languages.php' );
?>

 

But I still have the same error: (.

 

Help me please.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.