General Statistics
390 Tutorials
202 Total Votes
11 User(s) Online
777317 Views Total
3000 Registered Members
24534 Posts Total
Rooneyfeld is our newest member
About this Tutorial: Creating your Own Configuration File
Creating your Own Configuration File
Rated 4 / 1 Votes

Creating your Own Configuration File

Storing information has never became so fun. Set information in a php file with settings to use later without you ever editing the file by hand!


Date Added: November 20, 2005 [ 7815 Views - 1 Votes ] [ Rate ]

Author: Chaos King [ PHP Coding ] [ 3 Comment(s) ]

Creating your Own Configuration File
Using this little guide, You will learn how forum software such as Invision Power Board and vBulletin create their config files which seem to have all the info nessesary without you editing it.

I will give you the code and then exlpain it line by line.

CODE
<form action="" method="post" name="write" id="write">
 Name
 <input name="name" type="text" id="name">
 <br>
 Password
 <input name="password" type="text" id="password">
 <br>
 Email
 <input name="email" type="text" id="email">
 <br>
 Database User
 <input name="db_user" type="text" id="db_user">
 <br>
 Database Password
 <input name="db_pass" type="text" id="db_pass">
 <br>
 Database
 <input name="db_data" type="text" id="db_data">
 <br>
 Host
 <input name="db_host" type="text" id="db_host">
 <br>
 <input type="submit" name="Submit" value="Submit">
</form>
<?php

if ($_POST['Submit']) {

extract($_POST);

$file_to_write = 'config.php';

$content .="<?phpn";
$content .="$config['name'] = '$name';n";
$content .="$config['password'] = '$password';n";
$content .="$config['email'] = '$email';n";
$content .="$config['db_user'] = '$db_user';n";
$content .="$config['db_pass'] = '$db_pass';n";
$content .="$config['db_data'] = '$db_data';n";
$content .="$config['db_host'] = '$db_host';n";
$content .="?>";

$fp = fopen($file_to_write, 'w');
fwrite($fp, $content);
fclose($fp);
echo "Successn";
echo "$file_to_writen";
echo "Has been written";
}
?>



Total Pages (4)
[1] 2 3 4 Next>>

Welcome User
Welcome Guest
( Login | Register )

Latest Tutorial Index - RSS Feed
Latest Resources - RSS Feed
Latest Tutorials - RSS Feed
Vote for Us
  • VixxIMG.com - Free Image Hosting, Free Myspace Image Hosting, Free Image Uploads
  • PageRank Plus - Google PageRank checking, with a twist.
Random Affilaites