<?php
include("prepend.php");
$included = false;
if(empty($step)) {
if(!empty($installStep1)) {
$file = "../inc/db.php";
if(file_exists($file)) {
@unlink($file);
}
$key = md5($ndbpass);
if ($fp = @fopen($file,"w")){
@fputs($fp,("<?php\n"
."\$database_login=\"$dbLogin\";\n"
."\$database_pass=\"$dbPass\";\n"
."\$database_host=\"$dbHost\";\n"
."\$database_name=\"$dbName\";\n"
."\$db = @mysql_connect(\$database_host,\$database_login,\$database_pass)\n"
."\tor die(\"Mysql-Error \".mysql_errno() . \": \" . mysql_error() );\n"
."\$select = @mysql_select_db(\$database_name,\$db)\n"
."\tor die(\"Mysql-Error \".mysql_errno() . \": \" . mysql_error() );\n"
."\$table_pf = \"$tblPrefix\";\n"
."define(\"TABLE\", \$table_pf);\n?>"));
@fclose($fp);
@umask(0);
@chmod($file, 0755);
@include_once($file);
if(($db)&&($select)) {
include_once("dump.php");
if(!is_dir("../../uploads/files")) {
@mkdir("../../uploads/files", 0777);
}
if(!is_dir("../../uploads/files/1")) {
@mkdir("../../uploads/files/1", 0777);
}
if(!is_dir("../../uploads/files/2")) {
@mkdir("../../uploads/files/2", 0777);
}
}else{
$errorList[]="Error ". mysql_errno() . ": " . mysql_error();
}
}else{
$errorList[]="Could not write to database init file '".$file."'<br>"
."Please set this file world-writeable for setup "
."(e.g. with ftp command 'chmod 666 ".$file."')";
}
$file = "../inc/db.php";
if(file_exists($file)) {
@include_once($file);
$included = true;
}
}
if($included == true) {
$tpl->assign("install",
array ( "LOGIN" => $database_login,
"PASSWORD" => $database_pass,
"HOST" => $database_host,
"NAME" => $database_name,
"PREFIX" => $table_pf
)
);
}
ob_start();
$tpl->display("install.template");
$output = ob_get_contents();
ob_end_clean();
}
include("append.php");
?>