I have checked the code in the setup.php, hear it is:
<?php
/**
- Simple Admin System
- Version 1.
*/
// some hosting accounts dont have default session settings that work :-/
// if you get session errors try setting the full path to a temp directory like this:
//ini_set(“error_reporting”,0);
//error_reporting(E_ALL);
//ini_set(“session.save_handler”, “files”);
//session_save_path (get_cwd() . “/tmp/”);
function stripslashes_deep(&$value){
$value = is_array($value) ? array_map(‘stripslashes_deep’, $value) : stripslashes($value);
return $value;
}
// oldschool setups:
if(get_magic_quotes_gpc()){
stripslashes_deep($_GET);
stripslashes_deep($_POST);
}
session_start();
ini_set(“display_errors”,false);
if(is_file(“includes/config.php”)){
echo “The file includes/config.php already exists, please remove this file first before running setup again.”;
exit;
}else{
require_once("includes/database.php");
require_once("includes/session.php");
// modules
require_once("includes/plugin.php");
$plugins = $plugins_unsorted = $plugin_positions = array();
foreach(glob("includes/plugin_*") as $plugin_dir){
$plugin_name = str_replace("plugin_", "", basename($plugin_dir));
if(is_dir($plugin_dir) && is_file($plugin_dir."/".$plugin_name.".php")){
require_once($plugin_dir."/".$plugin_name.".php");
eval('$plugins_unsorted$plugin_name] = new module_'.$plugin_name.'();');
$plugins_unsorted$plugin_name]->init();
$plugin_positions$plugins_unsorted$plugin_name]->module_position] = $plugin_name;
}
}
// now we need to sort these plugins.
ksort($plugin_positions);
foreach($plugin_positions as $plugin_name){
$plugins$plugin_name] =& $plugins_unsorted$plugin_name];
}
unset($plugins_unsorted);
// end modules.
require_once("design_header.php");
$errors = array();
$sqlerrors = array();
if($_REQUEST'build']){
$install_sql = $_REQUEST'install_sql'];
// check database connection.
if($_REQUEST'db_host'] && $_REQUEST'db_user'] && $_REQUEST'db_pass'] && $_REQUEST'db_name']){
$dbcnx = @mysql_connect($_REQUEST'db_host'],$_REQUEST'db_user'],$_REQUEST'db_pass']);
if(!$dbcnx){
$errors ] = "Unable to connect to database, please ensure your database connection information is correct";
}else{
$db = @mysql_select_db($_REQUEST'db_name']);
if(!$db){
$errors ] = "Connection successful, but unable to select your database. Is your database name correct?";
}
}
}else{
$errors ] = "Please enter all your database connection details";
}
if(!$errors){
// build the config file.
$config_file = '<?php ' ."
";
ob_start();
?>
/* DATABASE CONFIGURATION VARIABLES */
define("_DB_SERVER","<?php echo $_REQUEST’db_host’]; ?>");
define("_DB_NAME","<?php echo $_REQUEST’db_name’]; ?>");
define("_DB_USER","<?php echo $_REQUEST’db_user’]; ?>");
define("_DB_PASS","<?php echo $_REQUEST’db_pass’]; ?>");
define("_DB_PREFIX","<?php echo $_REQUEST’db_prefix’]; ?>");
/* GENERAL CONFIG STUFF */
// this means 10% tax in the payment module.
define("_DEFAULT_TAX","<?php echo $_REQUEST’tax’]; ?>");
// date format for printing dates to the screen (uses php date syntax)
define("_DATE_FORMAT","<?php echo $_REQUEST’date_format’]; ?>");
// date format for inputting dates into the system
// 1 = DD/MM/YYYY
// 2 = YYYY/MM/DD
// 3 = MM/DD/YYYY
define("_DATE_INPUT",<?php echo (int)$_REQUEST’date_input’]; ?>);
switch(_DATE_INPUT){
case 1: define(’_DATE_INPUT_HELP’,‘DD/MM/YYYY’); break;
case 2: define(’_DATE_INPUT_HELP’,‘YYYY/MM/DD’); break;
case 3: define(’_DATE_INPUT_HELP’,‘MM/DD/YYYY’); break;
}
// used in outgoing emails for links, set this to something custom if you have problems.
define("_ADMIN_HOSTNAME",$_SERVER’HTTP_HOST’]);
// the folder (eg: internal/widget_admin) where the admin system is installed.
define("_ADMIN_DIRECTORY",dirname($_SERVER’REQUEST_URI’]));
// title that appears at the top of admin system and on home page.
define("_ADMIN_SYSTEM_NAME","<?php echo $_REQUEST’admin_system_name’]; ?>");
// subject of email that gets sent to customer on payment request.
define("_PAYMENT_EMAIL_SUBJECT","<?php echo $_REQUEST’paypal_subject’]; ?>");
// set this to your email, if there are errors (like with paypal) you will be notified here.
define("_ERROR_EMAIL","<?php echo $_REQUEST’admin_email’]; ?>");
// should generally always be 1, this is the id for “admin guy” who we use details for when emailing.
define("_ADMIN_USER_ID",1);
// show alerts 15 days in the future.
define("_ALERT_DAY_LIMIT",15);
// currency code
define("_CURRENCY_CODE",’<?php echo $_REQUEST’currency_code’]; ?>’);
define("_CURRENCY_NAME",’<?php echo $_REQUEST’currency_name’]; ?>’);
// currency location (before / after) the amount
define("_CURRENCY_LOCATION",’<?php echo $_REQUEST’currency_location’]; ?>’);
// default language code. the corresponding includes/lang/CODE.php file must exist
define("_DEFAULT_LANGUAGE",’<?php echo $_REQUEST’default_language’]; ?>’);
// default hourly rate
define("_DEFAULT_RATE",’<?php echo $_REQUEST’default_rate’]; ?>’);
/* PAYPAL SETTINGS */
define("_PAYPAL_BUSINESS_EMAIL","<?php echo $_REQUEST’paypal_email’]; ?>"); // email payment goes to.
define("_PAYPAL_SANDBOX_MODE",false); // only set to try if you know what ur doing…
/* ONLY REALLY USED FOR DEVELOPING */
define("_DEMO_MODE",false);
<?
$config_file .= ob_get_clean();
$config_file .= ‘?>’;
}
if(!$errors && $config_file){
// insert the database
define("_DB_PREFIX",$_REQUEST'db_prefix']);
$mysql = '';
//pull the sql in from the modules.
foreach($plugins as $plugin_name => &$plugin){
if($plugin->is_installed()){
$sqlerrors ] ="It looks like the '$plugin_name' plugin is already installed. Please remove it to re-install from scratch.";
}
$mysql .= $plugin -> get_install_sql();
}
// check if table already exists..
/*$sql = "SELECT * FROM `".$_REQUEST'db_prefix'] . "users`";
$res = @mysql_query($sql);
if(!$res){
// good! it threw an error that table doesnt' exist.
}else{
$errors] = "We detected the table `".$_REQUEST'db_prefix'] . "users` already exists in your database, please remove (DROP) the database tables if you wish to re-install. Note: You will loose any previous information if you drop your database tables";
}*/
if(!$sqlerrors && $install_sql){
// run the mysql
$sql_bits = explode(";",$mysql);
foreach($sql_bits as $sql){
$sql = trim($sql);
if(!$sql)continue;
$res = mysql_query($sql);
if(!$res){
$sqlerrors] = "Mysql Error: $sql - " . mysql_error();
}
}
}
} // if no errors
}
@include("includes/config.sample.php");
?>
<h2><?php echo _ADMIN_SYSTEM_NAME; ?> - Setup</h2>
<?php if($errors){
?>
<h4>Errors:</h4>
<?php foreach($errors as $error){
?>
<span style="color:#FF0000;"><?php echo $error; ?></span> <br/>
<?
}
}
if(!isset($_REQUEST'build']) || $errors){
?>
<form action="?build=true" method="post">
<h3>Step 1: Setup a database</h3>
<p>
First step is to create a MySQL database, and a database user. This process is explained in great detail on many websites. Once you have a database, please enter it's details below:
</p>
<table cellpadding="4">
<tr>
<td>Database Host:</td>
<td><input type="text" name="db_host" value="<?php echo ($_REQUEST'db_host'])?$_REQUEST'db_host']:_DB_SERVER; ?>"></td>
</tr>
<tr>
<td>Database Name:</td>
<td><input type="text" name="db_name" value="<?php echo ($_REQUEST'db_name'])?$_REQUEST'db_name']:_DB_NAME; ?>"></td>
</tr>
<tr>
<td>Database Username:</td>
<td><input type="text" name="db_user" value="<?php echo ($_REQUEST'db_user'])?$_REQUEST'db_user']:_DB_USER; ?>"></td>
</tr>
<tr>
<td>Database Password:</td>
<td><input type="text" name="db_pass" value="<?php echo ($_REQUEST'db_pass'])?$_REQUEST'db_pass']:_DB_PASS; ?>"></td>
</tr>
<tr>
<td>Table Prefix:</td>
<td><input type="text" name="db_prefix" value="<?php echo ($_REQUEST'db_prefix'])?$_REQUEST'db_prefix']:_DB_PREFIX; ?>" size="5"> <em>Useful if you are re-using an existing database</em></td>
</tr>
<tr>
<td>Install Database:</td>
<td><input type="checkbox" name="install_sql" value="yes" checked> <em>Try to install database automatically, untick to get SQL code and do it manually.</em></td>
</tr>
</table>
<h3>Step 2: PayPal</h3>
<p>
If you would like to use the PayPal features of this system, please enter your PayPal email address below. This is where payments will be made:
</p>
<table cellpadding="5">
<tr>
<td>PayPal Email Address:</td>
<td><input type="text" name="paypal_email" value="<?php echo ($_REQUEST'paypal_email'])?$_REQUEST'paypal_email']:_PAYPAL_BUSINESS_EMAIL; ?>"></td>
</tr>
<tr>
<td>PayPal Email Subject:</td>
<td><input type="text" name="paypal_subject" value="<?php echo ($_REQUEST'paypal_subject'])?$_REQUEST'paypal_subject']:_PAYMENT_EMAIL_SUBJECT; ?>">
<em>The email subject for 'payment requests' sent to your customers.</em>
</td>
</tr>
</table>
<h3>Step 3: General Config</h3>
<p>
Please fill in the below information, the "Admin Email Address" is where payment notifications and error messages get sent.
</p>
<table cellpadding="5">
<tr>
<td>Admin Email Address:</td>
<td><input type="text" name="admin_email" value="<?php echo ($_REQUEST'admin_email'])?$_REQUEST'admin_email']:_ERROR_EMAIL; ?>"></td>
</tr>
<tr>
<td>Admin System Name:</td>
<td><input type="text" name="admin_system_name" value="<?php echo ($_REQUEST'admin_system_name'])?$_REQUEST'admin_system_name']:_ADMIN_SYSTEM_NAME; ?>" size="40"></td>
</tr>
<tr>
<td>Tax:</td>
<td><input type="text" name="tax" value="<?php echo ($_REQUEST'tax'])?$_REQUEST'tax']:_DEFAULT_TAX; ?>" size="5">%
<em>Optional, add this much tax ontop of payment requests (can be overridden later)</em>
</td>
</tr>
<tr>
<td>Default Language:</td>
<td>
<select name="default_language">
<?php foreach(glob("includes/lang/*.php") as $file){
$lang = basename(str_replace('.php','',$file));
?>
<option value="<?php echo $lang; ?>"><?php echo $lang; ?></option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td>Date Formats:</td>
<td>
Date Input:
<select name="date_input">
<option value="1">DD/MM/YYYY</option>
<option value="2">YYYY/MM/DD</option>
<option value="3">MM/DD/YYYY</option>
</select>
Date Output:
<input type="text" name="date_format" value="d/m/Y" size="6"> <em><a href="http://php.net/date">php date syntax</a></em>
</td>
</tr>
<tr>
<td>Currency:</td>
<td>
Symbol: <input type="text" name="currency_code" value="$" size="4">
Code: <input type="text" name="currency_name" value="AUD" size="4">
<input type="radio" name="currency_location" value="before" checked>(<strong>$</strong> xxx.xx)
<input type="radio" name="currency_location" value="after">(xxx.xx <strong>$</strong>)
</td>
</tr>
<tr>
<td>Hourly Rate:</td>
<td>
<input type="text" name="default_rate" value="25" size="4"> Per Hour
</td>
</tr>
</table>
<h3>Step 4: Build Configuration</h3>
<p>
Please click the button below, we will check your database connection and populate it with some default values.
</p>
<p>
<input type="submit" name="submit" value="Build Configuration File">
</p>
</form>
<?
}else{
?>
<h2>Success!</h2>
<h3>Next step: Uploading your new config.php file.</h3>
<p>
Below is the contents for your very own <b>config.php</b> file, please upload this file into the <strong>includes/</strong> directory (ie: includes/config.php)
</p>
<textarea rows=40 cols=110><?php echo htmlspecialchars($config_file); ?></textarea>
<?php if(!$install_sql || $sqlerrors){ ?>
<h3>Next step: Loading your database.</h3>
<?php if($sqlerrors){
?>
<h4>There were some errors when we tried to do this automatically, so you will have to do it manually:</h4>
<?php foreach($sqlerrors as $error){
?>
<span style="color:#FF0000;"><?php echo $error; ?></span> <br/>
<?
}
} ?>
<p>
Here is the SQL you need to execute on your database:
</p>
<textarea rows=40 cols=110><?php echo htmlspecialchars($mysql); ?></textarea>
<?php } ?>
<h3>First time login:</h3>
<p>
After you upload the above config.php file, you can <a href="index.php">login</a> with the email address <strong>admin@example.com</strong> and the password <strong>password</strong>
</p>
<?
}
require_once("design_footer.php");
}
Can you see any thing wrong in this?
thanks for your help, you have been a star.