Code2Design.com

User login

The Layout

Programming

Graphic Design

Resources

Navigation

C2D Projects

Unsystematic Affiliates

Tutorial Mix Tutorial Database AOM Designs DNSandIP 

Change Language

Who's online

There are currently 0 users and 5 guests online.

CMS install file

Well, building a CMS is a great learning experiance. However, I have spent the past year building a new CMS/Framework that can render pages within .004 of a second and has all the features someone could need. So if you wait to wait another month you can download it ;P

Anyway, here is how you would make a install file. You can also download phpBB and look at their install file.

<?php
/*
If someone pressed the "submit" button
(which can only happen if they have seen and filled out the form!)
*/
if(isset($_POST['submit'])) {

   
// Put the $_POST/form data into the file text
   
$text '<?php'"\n".
           
'$db_name = "'$_POST['db_name']. '";'"\n".
           
'$db_user = "'$_POST['db_user']. '";'"\n".
           
'$db_pass = "'$_POST['db_pass']. '";'"\n".
           
'$db_host = "'$_POST['db_host']. '";'"\n".
           
'$admin_name = "'$_POST['admin_name']. '";'"\n".
           
'$admin_pass = "'$_POST['admin_pass']. '";'"\n".
            '
?>
';


// 1) Store the file name in a string (this is the file handle).
$filename = "config.php";
// 2) Open the file
$filehandle = fopen($filename, 'w')
// 3) Write the text above to the file
fwrite($filehandle, $text);
// 4) Close the file handle
fclose($filehandle);

//Now you have a file called "config.php" in the same place as the install.php file.
}
?>


Please Enter your Site Information:
<form action="" method="post">
Database Name: <input name="db_name" type="text" value=""><br />
Database User: <input name="db_user" type="text" value=""><br />
Database Pass: <input name="db_pass" type="text" value=""><br />
Database Host: <input name="db_host" type="text" value="localhost"><br />
<br />
Admin Name: <input name="admin_name" type="text" value=""><br />
Admin Pass: <input name="admin_pass" type="text" value=""><br />

<input name="submit" type="submit" value="Submit">
</form>


Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br /> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will be automatically converted to links
More information about formatting options



Like what you see?

Why not add more? C2D is looking for other Christian Web Masters who would like to help write articles for this site. If you have expericance in FLASH, CSS/HTML, PHP/MySQL, PhotoShop/GIMP, Blender, Javascript, or just General Design - our users would love to hear what you have to say. Contact Us

delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   technorati