⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 install.php

📁 BLOG HOSTER---PHP & MYSQL Create Blogs in seconds Installation of your BlogHoster system is easy.
💻 PHP
字号:
<?



if(isset($_GET['task'])) { $task = $_GET['task']; } elseif(isset($_POST['task'])) { $task = $_POST['task']; }
if($task == "") { $task = "step0"; }





$head = "
<html>
<head>
<title>Webligo BlogHoster Installer - SCRiPTMAFiA 2005</title>
<style type='text/css'>

body {
font-family: \"Palatino Linotype\", georgia, verdana, sans-serif;
font-size: 11pt;
line-height: 16pt;
color: #333333;
}

h2 {
margin-bottom: 5px;
}

input.button {
background: #336699;
color: #FFFFFF;
padding: 5px;
font-weight: bold;
font-family: arial, verdana, tahoma, sans-serif;
font-size: 10pt;
}

input.text {
font-family: \"Courier New\", courier, sans-serif;
}

a:link { color: #336699; }
a:visited { color: #336699; }
a:hover { color: #3399FF; }

</style>
</head>
<body>
";


$foot = "
</body>
</html>
";







if($task == "step0") {
echo $head;
echo "
<h2>BlogHoster v1.20 Installer - SCRiPTMAFiA 2005</h2>
Welcome to the BlogHoster installation program. Installing your BlogHoster
system is easy! To get started, click the button below. If you have any
questions about the installation process or BlogHoster in general, get
in touch with us at webligo.com.
If necessary, we will be happy to handle the installation for you at no charge.
<br><br>
Before continuing, please be sure you have reviewed the installation instructions
provided in install.txt. Also, by clicking the button below, you signify that you
understand and agree with the terms of the software license you purchased from Webligo for this software (license.txt). 
You also signify that you understand that you may not, under any circumstances, resell
or redistribute this software in any way. You signify that you understand that reselling or redistrubiting copies
of this software is piracy. If you agree to the terms of your license agreement, as described in
license.txt, as well as the terms described above, click the button to continue.
<br>
<form action='install.php' method='POST'>
<input type='submit' class='button' value='Continue...'>
<input type='hidden' name='task' value='step1'>
</form>
";
echo $foot;
}



if($task == "step1") {
echo $head;
echo "
<h2>Enter License Key</h2>
Please enter your license key. This was provided to you in the email you received following your purchase.
If you have lost your license key, feel free to contact us.
<br>
<form action='install.php' method='POST'>
License Key: <input type='text' name='license' size='30'><br><br>
<input type='submit' class='button' value='Continue...'>
<input type='hidden' name='task' value='step2'>
</form>
";
echo $foot;
}




if($task == "step2") {
$license = $_POST['license'];
if(isset($_POST['check'])) { $check = $_POST['check']; } else { $check = "yes"; }

$server_array = explode("/", $_SERVER['PHP_SELF']); $server_array_mod = array_pop($server_array); $server_info = implode("/", $server_array); $server = "http://".$_SERVER['HTTP_HOST'].$server_info; $ip = $_SERVER['REMOTE_ADDR']; 
if(!preg_match("/^[0-9]{4}[-]{1}[0-9]{4}[-]{1}[0-9]{4}[-]{1}[0-9]{4}?$/", $license)) { $status = "failure"; $error = "<h2>Invalid License Key</h2>You have provided an invalid license key.<br><form action='install.php' method='POST'><input type='submit' class='button' value='Try Again'><input type='hidden' name='task' value='step1'></form>"; } elseif(substr($license,10,1)*substr($license,11,1)*substr($license,12,1)*substr($license,13,1) != substr($license,15,4)) { $status = "failure"; $error = "<h2>Invalid License Key</h2>You have provided an invalid license key.<br><form action='install.php' method='POST'><input type='submit' class='button' value='Try Again'><input type='hidden' name='task' value='step1'></form>"; } else { $status = "success"; } if($status == "failure") { echo $head; echo $error; echo $foot; exit(); }

echo $head;
echo "
<h2>MySQL Database Information</h2>
On this page, you will enter the information that BlogHoster will use to connect
to the MySQL database on your server. After you click the button below, the 
install script will first attempt to connect to your database with the information
you have provided. If the connection was successful, the MySQL tables will be 
created. Note: If you have already installed BlogHoster on your server, any data
in your existing BlogHoster MySQL tables will be overwritten.
<br><br>

<form action='install.php' method='POST'>

Hostname:<br>
<input type='text' class='text' size='30' name='mysql_host' value='localhost'>
<br><br>

Database Name:<br>
<input type='text' class='text' size='30' name='mysql_database'>
<br><br>

Username:<br>
<input type='text' class='text' size='30' name='mysql_username'>
<br><br>

Password:<br>
<input type='password' class='text' size='30' name='mysql_password'>
<br><br>

<input type='submit' class='button' value='Continue...'>
<input type='hidden' name='task' value='step3'>
<input type='hidden' name='license' value='$license'>
</form>
";
echo $foot;
}




if($task == "step3") {
$mysql_host = $_POST['mysql_host'];
$mysql_database = $_POST['mysql_database'];
$mysql_username = $_POST['mysql_username'];
$mysql_password = $_POST['mysql_password'];
$license = $_POST['license'];

echo $head;
echo "
<h2>Installing...</h2>
";



// TEST MYSQL CONNECTION
sleep(2);
$link = @mysql_connect($mysql_host, $mysql_username, $mysql_password);
  if(!$link) { 
  $error1 = "The server responded with the following error message: <i>"; $error1 .= mysql_error(); $error1 .= "</i>";
  $msg1 = "- Failed to connect to MySQL server. $error1<br>";
  } else {
  $msg1 = "- Successfully connected to the MySQL server.<br>";
  }
echo $msg1;



// TEST DATABASE SELECT
if($link) {
sleep(2);
$db_selected = @mysql_select_db($mysql_database, $link);
  if(!$db_selected) { 
  $error2 = "The server responded with the following error message: <i>"; $error2 .= mysql_error(); $error2 .= "</i>";
  $msg2 = "- Failed to select MySQL database <i>$mysql_database</i>. $error2<br>"; 
  } else {
  $msg2 = "- Successfully selected MySQL database.<br>";
  }
}
sleep(1);
echo $msg2;



// TRY TO CREATE MYSQLCON.PHP
if($error1 == "" AND $error2 == "") { 
$filename = "mysqlcon.php";
$somecontent = "<?\n\$mysql_database = \"$mysql_database\";\n\$mysql_username = \"$mysql_username\";\n\$mysql_password = \"$mysql_password\";\n\$mysql_host = \"$mysql_host\";\n\n\$mysql_connect = mysql_connect(\"\$mysql_host\", \"\$mysql_username\", \"\$mysql_password\");\nmysql_select_db(\"\$mysql_database\");\n?>";
$handle = fopen($filename, 'w+');
fwrite($handle, $somecontent);
fclose($handle);
}


// TRY TO RUN INSTALLATION QUERIES
if($error1 == "" AND $error2 == "") {
sleep(2);
include "installsql.php";
echo "- Successfully created BlogHoster MySQL tables.";
}


// SHOW ANY ERRORS OR SHOW SUCCESS BUTTON
if($error1 != "" OR $error2 != "") {
echo "
<form action='install.php' method='POST'>
<input type='submit' class='button' value='Go Back'>
<input type='hidden' name='license' value='$license'>
<input type='hidden' name='task' value='step2'>
<input type='hidden' name='check' value='no'>
</form>
";
} else {
mysql_query("UPDATE bhost_admin SET license='$license'");
sleep(2);
echo "
<br><br>
Your installation has completely successfully! Next, please login 
to your BlogHoster <a href='./admin/index.php'>administration panel</a> 
and modify your Admin Profile. Also, be sure to delete install.php and 
installsql.php from your server.
";
}





echo $foot;
@mysql_close($link);



}


?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -