<?php
if($_POST['Submit'] != NULL){
// Config
$info = '<?php
/************* Recipe *****************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/************* Recipe *****************************/
// Site Name
$SITE_NAME = \''.$_POST[SITE_NAME].'\';
// Site URL
$SITE_URL = \''.$_POST[SITE_URL].'\';
/*
Meta Tags Information
*/
$META_TITLE = \''.$_POST[META_TITLE].'\';
$META_KEYS = \''.$_POST[META_KEYS].'\';
$META_DESCRIPTION = \''.$_POST[META_DESCRIPTION].'\';
// Admin Email
$ADMIN_EMAIL = \''.$_POST[ADMIN_EMAIL].'\';
// Ad page 468x60
$ADS_PAGE = \''.$_POST[ADS_PAGE].'\';
// Ad Page 720x90
$ADS_PAGE_XL = \''.$_POST[ADS_PAGE_XL].'\';
// Page Width
$PAGE_WIDTH = \''.$_POST[PAGE_WIDTH].'\';
// Display per page (Recipes per page)
$display_limit = \''.$_POST[display_limit].'\';
// Columns (categories per ine)
$table_cloumns = '.$_POST[table_cloumns].';
?>';
$f = fopen('includes/configs.php','w') or die('Unable to open includes/configs.php for editing, please update it with config information manually.');
fwrite($f,$info);
fclose($f);
// Database creating
$info = '<?php
/************* Recipe *****************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/************* Recipe *****************************/
function connect(){
$DB_USER = "'.$_POST['username'].'";
$DB_PASSWORD = "'.$_POST['password'].'";
$DB_HOST = "'.$_POST['hostname'].'";
$dbc = mysql_connect ($DB_HOST, $DB_USER, $DB_PASSWORD) or $error = mysql_error();
mysql_select_db("'.$_POST['dataname'].'") or $error = mysql_error();
mysql_query("SET NAMES `utf8`");
return $error;
}
function disconnect_data(){
@mysql_close($dbc);
@mysql_close();
}
?>';
$f = fopen('includes/database.php','w') or die('Unable to open includes/database.php for editing, please update it with database information manually, then upload includes/database1.sql / includes/database2.sql to the database.');
fwrite($f,$info);
fclose($f);
include('includes/database.php');
connect();
$f = fopen('includes/database1.sql','r');
while($t = fread($f,1024657)){ $sql .= $t;}
fclose($f);
$lines = explode(';',$sql);
foreach($lines as $line){
if(trim($line)){
mysql_query($line) or die(mysql_error());
}
}
unset($line,$lines,$t,$sql);
$line = NULL;$lines=NULL;$t=NULL;$sql=NULL;
/*
$f = fopen('includes/database2.sql','r');
while($t = fread($f,1024)){
$t = $lasttemp[0].$t;
$temp = explode(";\n",$t);
unset($t);
$t = NULL;
$x=0;
while($x < count($temp)-2){
$sqlline = $temp[$x];
if(trim($sqlline)){
mysql_query($sqlline) or die(mysql_error());
}
$x++;
}
$lasttemp[0] = $temp[count($temp)-1];
unset($temp);
$temp = NULL;
}
fclose($f);
*/
disconnect_data();
$add_data = '<?php
$db_server = \''.$_POST[hostname].'\';
$db_name = \''.$_POST[dataname].'\';
$db_username = \''.$_POST[username].'\';
$db_password = \''.$_POST[password].'\';
';
$f = fopen('bigdump.php','r');
while($t = fread($f,102654)){ $bigdump .= $t;}
fclose($f);
$f = fopen('bigdump.php','w');
fwrite($f,$add_data.$bigdump);
fclose($f);
header("Location: bigdump.php");
exit();
}
?>
<p>URLManagement By www.AwesomePHP.com:</p>
<p>To start installation, all we need to do is edit a file <strong>includes/database.php</strong> [<a href="http://free-php.net/?CHMOD">CHMODED</a> 700] and insert it database information (as well as putting in default tables/test data).</p>
<form name="isntall" id="install" method="post" action="install.php" style="display:inline;">
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<tr>
<td width="50%">Database Host Name: [Usually "localhost" or Server IP] </td>
<td width="50%"><input name="hostname" type="text" id="hostname"></td>
</tr>
<tr>
<td width="50%">Database Name: </td>
<td width="50%"><input name="dataname" type="text" id="dataname"></td>
</tr>
<tr>
<td width="50%">Database User Name: </td>
<td width="50%"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td width="50%">Database User Password: </td>
<td width="50%"><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td colspan="2"><div align="center"><strong>SITE OPTIONS (can be changed in includes/configs.php)</strong></div></td>
</tr>
<tr>
<td>Site Name: </td>
<td width="50%"><input name="SITE_NAME" type="text" id="SITE_NAME" value="Recipe Website"></td>
</tr>
<tr>
<td>Site URL: </td>
<td width="50%"><input name="SITE_URL" type="text" id="SITE_URL" value="http://localhost/Recipe/"></td>
</tr>
<tr>
<td>Meta Title: </td>
<td width="50%"><input name="META_TITLE" type="text" id="META_TITLE" value="Recipe Websites, Over 38,000 Recipes"></td>
</tr>
<tr>
<td>Meta Keys: </td>
<td width="50%"><input name="META_KEYS" type="text" id="META_KEYS" value="Cooking, Recipe, Recipes, Dinning, Cook, Cheese, Ice Cream, Desserts"></td>
</tr>
<tr>
<td>Meta Description: </td>
<td width="50%"><input name="META_DESCRIPTION" type="text" id="META_DESCRIPTION" value="Recipe Website provide the largest recipe database on the internet."></td>
</tr>
<tr>
<td>Admin Email: </td>
<td width="50%"><input name="ADMIN_EMAIL" type="text" id="ADMIN_EMAIL" value="hide@address.com"></td>
</tr>
<tr>
<td>Ad Page 468x60: </td>
<td width="50%"><input name="ADS_PAGE" type="text" id="ADS_PAGE" value="ads_show.php"></td>
</tr>
<tr>
<td>Ad Page 720x90: </td>
<td width="50%"><input name="ADS_PAGE_XL" type="text" id="ADS_PAGE_XL" value="ads_show_xl.php"></td>
</tr>
<tr>
<td>Page Width: </td>
<td width="50%"><input name="PAGE_WIDTH" type="text" id="PAGE_WIDTH" value="790">
</td>
</tr>
<tr>
<td>Display Limit (receipes per page): </td>
<td width="50%"><input name="display_limit" type="text" id="display_limit" value="10"></td>
</tr>
<tr>
<td>Category listings per line:</td>
<td><input name="table_cloumns" type="text" id="table_cloumns" value="3"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Submit">
</div></td>
</tr>
</table>
</form>
<p><em><font color="#FF0000">If the above automatic installation doesn't work. Open includes/database.php and includes/configs.php and enter your database information, then query includes/database1.sql / includes/database2.sql into the database. </font></em></p>