|
|
|
|
![]() ![]() |
Apr 24 2008, 10:34 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
I did create this topic mainly because I want to know everything about that configuration file. I will post other replies if I want to know more depending on your experience.
Is this code correct for that file: CODE <? $host="localhost"; $dbname="XXX"; $dbuser="XXX"; $dbpass="XXX"; $connection=mysql_connect($host, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); ?> Add your suggestions or improve it. |
|
|
|
Apr 24 2008, 01:47 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
CODE <? $host="localhost"; $dbname="XXX"; $dbuser="XXX"; $dbpass="XXX"; $connection=mysql_connect($host, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); ?> It looks like it is a "typical" configuration file, but you need to replace the "XXX" with the correct data for your account and MySql information. Localhost is correct for a trap17 account, the dbname and dbuser will be prefixed with your trap17 account name and an underscore so that it would become jlhaslip_ followed by the actual name of the database. The password would be specific to your database, too. You need to have the database built using the MySql selection in the cpanel and a user/password also needs to be previously created and allowed the privileges for the database. |
|
|
|
Apr 24 2008, 06:28 PM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
If there is a more stuff to write that configuration file based on security issue?
|
|
|
|
Apr 24 2008, 07:43 PM
Post
#4
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
Not really, that I am aware of.
Be sure to safe that file with a PHP file extension, though, in case someone links to it. When you use a php file extension, the contents can not be read in a Browser since there are not echo commands. You also might want to save it using the "common" inc.php file extension so you know that it is a file to be "included" and that it is a php file. file name would become: "mysql.inc.php" then include ("mysql.inc.php"); is what you would need in the php file which calls the include. Another security issue would be to store the "mysql.inc.php" file outside of the public_html folder so that it is not available via the web, only by the php parser. Then you would access it using include ("../mysql.inc.php"); (assuming the calling file is in the public_html folder. |
|
|
|
Apr 24 2008, 09:27 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
SO, you mean it's better to use like db.inc.php instead of confg.php?
|
|
|
|
Apr 24 2008, 11:49 PM
Post
#6
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
correct.
|
|
|
|
Apr 30 2008, 03:56 PM
Post
#7
|
|
|
Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 975 Joined: 25-September 05 From: The dungeon deep below the foundation of trap17 Member No.: 12,251 |
I wouldn't suggest putting this file in the public_html folder. Put it up one directory in your root folder. This should keep your password hidden if the php parser were to ever break.
|
|
|
|
May 3 2008, 11:32 AM
Post
#8
|
|
|
Newbie ![]() Group: Members Posts: 1 Joined: 3-May 08 Member No.: 61,665 |
CODE <?php $_CONFIG = array( 'hostname' => 'localhost', 'username' => 'xxxxx', 'password' => 'xxxxx', 'database' => 'xxxxx', 'persistent' => 0, 'driver' => 'mysql', ); ?> Wouldnt that be alrite for the config php aswell as thats what i use?? |
|
|
|
May 3 2008, 03:23 PM
Post
#9
|
|
|
Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 975 Joined: 25-September 05 From: The dungeon deep below the foundation of trap17 Member No.: 12,251 |
CODE <?php $_CONFIG = array( 'hostname' => 'localhost', 'username' => 'xxxxx', 'password' => 'xxxxx', 'database' => 'xxxxx', 'persistent' => 0, 'driver' => 'mysql', ); ?> Wouldnt that be alrite for the config php aswell as thats what i use?? well if you did that then you would have to connect to sql in every single file, just taking up your time every time you want to add a new file. |