Hi all,
I want to have a configuration file for my webapplication where it will have some fields like Database name, DB username, DB pass and when submitting this it should be saved in a php file (configuration file) i tried trying but didn't get the code., if anyone knows plz let me know. Thanks
S
php configuration file
Moderator: General Moderators
- phdatabase
- Forum Commoner
- Posts: 83
- Joined: Fri May 28, 2010 10:02 am
- Location: Fort Myers, FL
Re: php configuration file
Create an config.ini file (a text file)
Then on each page read and process the config.ini file.
Code: Select all
TIME_LIMIT=0
TITLE=modbot
SERIAL_NO=
DATA_PATH=C:/htdocs/modbot/data/
LOG_PATH=C:/htdocs/modbot/logs/
MOD_PATH=C:/htdocs/modbot/Modules/
USE_DB=false
BROWSER_LIST=C:/htdocs/modbot/data/browsers.txt
REFERER_LIST=C:/htdocs/modbot/data/referer.txt
TARGET_LIST=C:/htdocs/modbot/data/targets.txtCode: Select all
$iniArray = parse_ini_file('config.ini');
foreach( $iniArray as $key=>$value) {
define( $key, $value);
}
-
azi.sathish
- Forum Newbie
- Posts: 2
- Joined: Wed Jun 02, 2010 6:39 am
Re: php configuration file
Dear my Friend
I am new to php, sorry i couldn't understand about that ini file...
please find the attached image file, you will get an idea about my requirement.
Thanks and waiting for your reply
sathish
I am new to php, sorry i couldn't understand about that ini file...
please find the attached image file, you will get an idea about my requirement.
Thanks and waiting for your reply
sathish
- Attachments
-
- my requirement explained in this file
- form.jpg (23.01 KiB) Viewed 568 times
-
pradeepgems
- Forum Newbie
- Posts: 4
- Joined: Thu Mar 11, 2010 10:52 am
Re: php configuration file
$username = "'" . $_POST["username"] . "'";
$usernameconst = "USERNAME''";
$string = "define($usernameconst,$username)";
file_put_content("c:\temp\config.php",$string);
try the above code.
$usernameconst = "USERNAME''";
$string = "define($usernameconst,$username)";
file_put_content("c:\temp\config.php",$string);
try the above code.