Will this code work? [PHP]

Status
Not open for further replies.

Deviant

Member
Jan 21, 2012
174
8
Hey guys!

Will this code work? It's a simple config.php file for Habbo.

I will probably be updating this thread keep coming back!

For those who are wondering, this my way of learning, code something, if it's wrong i can correct it the next time.

 

Adil

DevBest CEO
May 28, 2011
1,276
714
No. Remove the equals between element 1 and element 2 of each $_CONF.
PHP:
<?php
 
 
//This is the MySQL configuration
 
$config ['MySQL']['hostname'] = 'Localhost';
$config ['MySQL']['Port'] = '3360';
$config ['MySQL']['Password'] = 'Password';
$config ['MySQL']['database'] = 'database';
 
//This is the site configuration
$config['Site']['Path'] = 'Http://localhost';
$config['Site']['Name'] = 'Habbo';
$config['Site']['Desc'] = 'Join now!';
$config['Site']['fig'] = '-';
$config['Site']['Vip'] = 'Insert a sentence about how VIP will cost';
$config['Site']['Maint'] = 'false';
//This is the loader configuration
 
$config['Loader']['texts'] = 'localhost/r63/external_texts.txt';
$config['Loader']['vars'] = 'localhost/r63/external_vars.txt'
$config['Loader']['furni'] = 'localhost/63/furnidata.txt'
$config['Loader']['product'] = 'localhost/r63/productdata.txt';
//End of Config
 
?>
 

Deviant

Member
Jan 21, 2012
174
8
No. Remove the equals between element 1 and element 2 of each $_CONF.
PHP:
<?php
 
 
//This is the MySQL configuration
 
$config ['MySQL'] = ['hostname'] = 'Localhost';
$config ['MySQL'] = ['Port'] = '3360';
$config ['MySQL'] = ['Password'] = 'Password';
$config ['MySQL'] = ['database'] = 'database';
 
//This is the site configuration
$config['Site']['Path'] = 'Http://localhost';
$config['Site']['Name'] = 'Habbo';
$config['Site']['Desc'] = 'Join now!';
$config['Site']['fig'] = '-';
$config['Site']['Vip'] = 'Insert a sentence about how VIP will cost';
$config['Site']['Maint'] = 'false';
//This is the loader configuration
 
$config['Loader']['texts'] = 'localhost/r63/external_texts.txt';
$config['Loader']['vars'] = 'localhost/r63/external_vars.txt'
$config['Loader']['furni'] = 'localhost/63/furnidata.txt'
$config['Loader']['product'] = 'localhost/r63/productdata.txt';
//End of Config
 
?>
Ah, thanks! BTW, whats the code for require once?
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
PHP:
<?php
 
 
//This is the MySQL configuration
 
$config['MySQL']['hostname'] = 'Localhost';
$config['MySQL']['Port'] = '3360';
$config['MySQL']['Password'] = 'Password';
$config['MySQL']['database'] = 'database';
 
//This is the site configuration
 
$config['Site']['Path'] = 'Http://localhost';
$config['Site']['Name'] = 'Habbo';
$config['Site']['Desc'] = 'Join now!';
$config['Site']['fig'] = '-';
$config['Site']['Vip'] = 'Insert a sentence about how VIP will cost';
$config['Site']['Maint'] = 'false';
 
//This is the loader configuration
 
$config['Loader']['texts'] = 'localhost/r63/external_texts.txt';
$config['Loader']['vars'] = 'localhost/r63/external_vars.txt'
$config['Loader']['furni'] = 'localhost/63/furnidata.txt'
$config['Loader']['product'] = 'localhost/r63/productdata.txt';
 
//End of Config
 
?>
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
You also don't need to do
PHP:
$config['MySQL']['Port'] = '3360';

You could just do
PHP:
$config['MySQL']['Port'] = 3360;

I know it doesn't seem like that much of a big deal, but PHP has to parse everything in quote marks, if you don't surround numbers with quote marks, it takes less time to parse your script thus making script-execution and page-loading time faster.
 

LethalEdward

Member
Sep 2, 2010
119
22
Also u need to connect the site to the db using mysql_connect();

if you want your page title then it will be

PHP:
<title><?php echo $config['Site']['Name']; ?></title>
 
Status
Not open for further replies.

Users who are viewing this thread

Top