Jump to content

Recommended Posts

Posted

;) I am having trouble with a header.inc.php file. It requires that all variables (ie. databasename, user, passwd, host) are entered into an array. when I simply assign strings and connect to database,, it works. but know in an array format it continues to say that

 

Error: You must set your correct database access info in `inc/header.inc.php`.

but I am pretty sure the syntax is right. Unless synta is different for an array. this is what I have:

<?php

 

 

 

 

 

// Bold is changed

 

//just to simplify N= name

 

$db = array('host' => 'localhost',

 

'user' => "cpnelN_userN",

 

'pass' => "XXXXX",

 

'name' => "cpanelN_databaseNdb" );

 

$db['prefix'] = 'dotsilver_';

 

$mysql = new MySql( $db );

 

$mysql -> connect();

 

$_conf = $mysql -> get_conf_array();

 

$mysql -> close();

 

if( $_SERVER['QUERY_STRING'] != 'first')

foreach( $_conf as $value )

{

if( !$value ) Header('Location: configs.php?first');

}

 

$_dir = array

(

'0' => $_conf['home_dir'],

'inc' => $_conf['home_dir'].'inc/',

'smarty' => $_conf['home_dir'].'smarty/',

'layouts' => $_conf['home_dir'].'layouts/',

'langs' => $_conf['home_dir'].'langs/',

);

 

$_site = array(

'pid' => $_conf['site_ID'],

'layout' => $_conf['layout_name'],

'theme' => $_conf['color_theme'],

'app_name' => 'dating',

'bizname' => $_conf['bizname'],

'brand' => $_conf['brand'],

'mail_support' => $_conf['mail_support'],

'mail_links' => $_conf['mail_links'],

'mail_info' => $_conf['mail_info'],

'mail_ads' => $_conf['mail_ads'],

'age_start' => 18,

'age_end' => 75,

'online_time' => 10,

);

 

$_sock = array(

'domain' => 'dating-remote.dotsilver.com',

'domain_img' => 'dating-img.dotsilver.com',

);

 

$_url = array(

'site_url' => $_conf['site_url'],

'site' => $_conf['site_url'],

'_remote_lc_img' => "http://{$_sock'>http://{$_sock['domain_img']}/photo.php",

'_remote_lc_img_up'=> "http://{$_sock['domain_img']}/photo_up.php",

'flash_server' => 'rtmp://dotsilver.com/',

'im_xml' => 'http://dating-im.dotsilver.com/',

'anti_scam' => 'http://www.dotsilver.com/antiscam/public/dating/',

'faq_scammers'=>'http://www.dotsilver.com/antiscam/'

);

 

$_url['js'] = $_url['site'].'inc/js/';

$_url['member'] = $_url['site'].'member/';

$_url['layouts'] = $_url['site'].'layouts/';

$_url['tour'] = $_url['site'].'tour/';

$_url['img'] = $_url['layouts'].$_site['layout'].'/themes/'.$_site['theme'].'/img/';

$_url['image_upload'] = "{$_url['site_url']}member/photos.php";

 

$_langs = array(

'English',

);

 

?>

Posted

:clapping: Carbonize, I appreciate you takin a look at this for me. here is that file, it is called db_funcs.class.php. I am know expert but it seems like it is calling the ($db)array correctly......do you think I could have done something wrong in the input of connection strings(in the header)? maybe 'localhost' doesn't work in an array? I don't know. but here it is....and thanks again:

 

 

 

class MySql

{

 

function MySql( $db )

{

$this->host = $db['host'];

$this->user = $db['user'];

$this->pass = $db['pass'];

$this->name = $db['name'];

$this->prefix = $db['prefix'];

}

 

function connect()

{

$host = $this->host;

$user = $this->user;

$pass = $this->pass;

$name = $this->name;

 

@mysql_connect($host, $user, $pass)or die( '<code><b>Error:</b> You must set your correct database access info in `<b>inc/header.inc.php</b>`.' );

 

mysql_select_db($name)or die( '<code><b>Error:</b> You must set your correct database access info in `<b>inc/header.inc.php</b>`.' );

}

 

function query( $query )

{

return mysql_query($query);

}

 

function fetch_array( $result, $type = MYSQL_ASSOC )

{

return mysql_fetch_array( $result, $type );

}

 

function close()

{

mysql_close();

}

 

function get_conf_array()

{

 

$prefix = $this->prefix;

 

$result = $this->query( "SELECT name, value FROM `".$prefix."config`" );

 

if( $result )

{

 

while( $row = $this -> fetch_array( $result ) )

{

$_conf[$row['name']] = $row['value'];

}

 

}

elseif( $_SERVER['QUERY_STRING'] != 'first' && $_SERVER['QUERY_STRING'] != 'action=save')

{

Header( 'Location: configs.php?first' );

exit;

};

 

return $_conf;

}

 

}

 

?>

Posted (edited)

;) got it ...you were correct...on array for database I added the "db" to the end . it was rejecting it.....of course now I get a new message from configs file.....what does

 

Warning: Cannot modify header information - headers already sent by (output started at /home/alcfuo/public_html/DRV/inc/header.inc.php:97) in /home/alcfuo/public_html/DRV/configs.php on line 348 mean?

 

 

sorry...it is supposed to call file from my directory to install...if that help.

Edited by jmack772003

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...