Location: PHPKode > projects > phpBible > phpbible/install.php
<?php

###
###
###    Copyright 2004, Danny Carlton. Permission is hereby granted to distribute 
###  copies of this software package as long as you do not charge for it, and the 
###  copyright notices remain intact. Permission is also granted to use the concepts 
###  in these scripts for other similar scripts, but you may not simply copy the scripts and claim them as your own.
###   
###


if(!$site_name_in)
  {
  reset ($HTTP_POST_VARS);
  while (list ($key, $val) = each ($HTTP_POST_VARS)) 
    {
    $$key=$value;
    }
  reset ($HTTP_GET_VARS);
  while (list ($key, $val) = each ($HTTP_GET_VARS)) 
    {
    $$key=$value;
    }
  }


if($site_name_in)
  {
  require("./config.php");

$out_data="<?php
\$site_name='$site_name_in';
\$main_url='$url_in';
\$script_name='index.php';
\$db_name='$db_name_in';
\$table_prefix='$table_prefix_in';
\$host='$host_in';
\$user='$user_in';
\$password='$password_in';
\$page_very_dark='$page_very_dark';
\$page_dark='$page_dark';
\$page_medium='$page_medium';
\$page_light='$page_light';
\$results_side='$results_side';
\$domain='$domain_in';
\$path='$path_in';
?>";

$fp = fopen("./config.php", "w");
fwrite ($fp, $out_data);
fclose ($fp);

$admin_password_out="<?php
$admin_password
?>";

$fp = fopen("./admin/admin_data.php", "w");
fwrite ($fp, $admin_password_out);
fclose ($fp);

  header("Location: install/populate_db.php"); /* Redirect browser */
  exit;
  }
else
  {

require("./config.php");
$server=$GLOBALS[SERVER_NAME];
$path=str_replace('/install.php', '', $GLOBALS[REDIRECT_URL]);
$path=str_replace('/', '', $path);
$path="$path/";

echo "<html>

<head>
<title>install</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"phpBible.css\">
</head>

<body leftmargin=\"5\" bgcolor=\"$page_light\">

<p align=\"center\"><b><font color=\"$page_dark\" size=\"7\" face=\"Georgia\">phpBible.org<br>
</font><font color=\"$page_dark\" face=\"Georgia\" size=\"4\">Online Study Bible</font></b></p>
<div align=\"center\">
  <center>
  <table border=\"0\" width=\"400\" cellpadding=\"3\" style=\"background-color: #FFFFFF; border: 2 solid $page_dark\">
    <tr>
      <td><font color=\"$page_dark\"><b><font face=\"Verdana\" size=\"3\">Installation: Step 1</font></b><br>
        <span class=\"small\"><font face=\"Georgia\" size=\"2\">Welcome to the phpBible.org Installation Script.<br>
        Please enter the information requested below :</font></span></font>
        <form method=\"POST\" id=\"setup\" name=\"setup\">
          <p><b><font face=\"Verdana\" size=\"1\" color=\"$page_dark\">Site Name:<br>
          </font></b><font face=\"Verdana\" size=\"1\" color=\"$page_dark\">The name that will be displayed in the line just below the header (which
          should contain your logo. This can be changed later in the administration section.)<br>
          <input type=\"text\" name=\"site_name_in\" size=\"30\" class=\"custom_input\"><br>
<b><font face=\"Verdana\" size=\"1\" color=\"$page_dark\">Admin Password:<br>
          </font></b><font face=\"Verdana\" size=\"1\" color=\"$page_dark\">This will be the password you use to access the admin.php script.<br>
          <input type=\"text\" name=\"admin_password\" size=\"30\" class=\"custom_input\"><br>
          <b>URL:<br>
          </b>The URL of the top page on your site, this is where the Site Name will be linked to. (this can also be changed in the administration section)<br>
          <input type=\"text\" name=\"url_in\" size=\"30\" class=\"custom_input\" value=\"http://$server/\"><br>
          <b>MySQL DataBase Name:</b><br>
          The script will look for the name you enter, and if not found, will attempt to create this database. If this is your server, then
          you could use phpBible as the database name. If you are on a shared server, then you will most likely have been assigned a
          database that already exists. You can use the Table prefix to distinguish the phpBible data from other data in your database.<br>
          <input type=\"text\" name=\"db_name_in\" size=\"30\" class=\"custom_input\"><br>
          <b>Table Prefix:</b><br>
          (Example: phpBible_)<br>
          <input type=\"text\" name=\"table_prefix_in\" size=\"30\" class=\"custom_input\"><br>
          <b>MySQL Host:</b><br>
          This is almost always 'localhost'<br>
          <input type=\"text\" name=\"host_in\" size=\"30\" class=\"custom_input\" value=\"localhost\"><br>
          <b>MySQL User:</b><br>
          <input type=\"text\" name=\"user_in\" size=\"30\" class=\"custom_input\"><br>
          <b>MySQL Password:</b><br>
          <input type=\"text\" name=\"password_in\" size=\"30\" class=\"custom_input\"><br>
          <b>Domain:<br>
          </b>The domain the script will be accessed from. Be sure to include the beginning 'http://'.<br>
          <input type=\"text\" name=\"domain_in\" size=\"30\" class=\"custom_input\" value=\"http://$server\"><br>
          <b>Path:</b><br>
          What's between the Domain and the Script Name in the complete URL of the main script. The trailing slash is needed.<br>
          <input type=\"text\" name=\"path_in\" size=\"30\" class=\"custom_input\" value=\"$path\"><br>
          <br>
          <input type=\"submit\" value=\"Submit\" name=\"B1\" class=\"custom_button\"></font></p>
        </form>
      </td>
    </tr>
  </table>
  </center>
</div>

</body>

</html>
";
  }

?>
Return current item: phpBible