radius DB install
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
**/
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
**/
|
||||
//error_reporting (0);
|
||||
$appurl = $_POST['appurl'];
|
||||
$db_host = $_POST['dbhost'];
|
||||
@ -9,19 +10,21 @@ $db_user = $_POST['dbuser'];
|
||||
$db_password = $_POST['dbpass'];
|
||||
$db_name = $_POST['dbname'];
|
||||
$cn = '0';
|
||||
try{
|
||||
$dbh = new pdo( "mysql:host=$db_host;dbname=$db_name",
|
||||
try {
|
||||
$dbh = new pdo(
|
||||
"mysql:host=$db_host;dbname=$db_name",
|
||||
"$db_user",
|
||||
"$db_password",
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
);
|
||||
$cn = '1';
|
||||
}
|
||||
catch(PDOException $ex){
|
||||
} catch (PDOException $ex) {
|
||||
$cn = '0';
|
||||
}
|
||||
|
||||
if ($cn == '1') {
|
||||
$input = '<?php
|
||||
if ($_POST['radius'] == 'yes') {
|
||||
$input = '<?php
|
||||
|
||||
define(\'APP_URL\', \'' . $appurl . '\');
|
||||
$_app_stage = \'Live\';
|
||||
@ -48,17 +51,40 @@ if($_app_stage!=\'Live\'){
|
||||
ini_set(\'display_startup_errors\', 0);
|
||||
}
|
||||
';
|
||||
$wConfig = "../config.php";
|
||||
} else {
|
||||
$input = '<?php
|
||||
|
||||
define(\'APP_URL\', \'' . $appurl . '\');
|
||||
$_app_stage = \'Live\';
|
||||
|
||||
// Database PHPNuxBill
|
||||
$db_host = \'' . $db_host . '\';
|
||||
$db_user = \'' . $db_user . '\';
|
||||
$db_password = \'' . $db_password . '\';
|
||||
$db_name = \'' . $db_name . '\';
|
||||
|
||||
if($_app_stage!=\'Live\'){
|
||||
error_reporting(E_ERROR);
|
||||
ini_set(\'display_errors\', 1);
|
||||
ini_set(\'display_startup_errors\', 1);
|
||||
}else{
|
||||
error_reporting(E_ERROR);
|
||||
ini_set(\'display_errors\', 0);
|
||||
ini_set(\'display_startup_errors\', 0);
|
||||
}
|
||||
';
|
||||
}
|
||||
$wConfig = "../config.php";
|
||||
$fh = fopen($wConfig, 'w') or die("Can't create config file, your server does not support 'fopen' function,
|
||||
please create a file named - config.php with following contents- <br/>$input");
|
||||
|
||||
fwrite($fh, $input);
|
||||
fclose($fh);
|
||||
|
||||
$sql = file_get_contents('phpnuxbill.sql');
|
||||
|
||||
$qr = $dbh->exec($sql);
|
||||
|
||||
if ($_POST['radius'] == 'yes') {
|
||||
$sql = file_get_contents('radius.sql');
|
||||
$qrs = $dbh->exec($sql);
|
||||
}
|
||||
} else {
|
||||
header("location: step3.php?_error=1");
|
||||
exit;
|
||||
@ -67,8 +93,9 @@ $wConfig = "../config.php";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>PHPNuxBill Installer</title>
|
||||
<title>PHPNuxBill Installer</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@ -76,44 +103,44 @@ $wConfig = "../config.php";
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<link type='text/css' href='css/style.css' rel='stylesheet'/>
|
||||
<link type='text/css' href='css/style.css' rel='stylesheet' />
|
||||
<link type='text/css' href="css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body style='background-color: #FBFBFB;'>
|
||||
<div id='main-container'>
|
||||
<div id='main-container'>
|
||||
<img src="img/logo.png" class="img-responsive" alt="Logo" />
|
||||
<hr>
|
||||
|
||||
<div class="span12">
|
||||
<h4> PHPNuxBill Installer </h4>
|
||||
<?php
|
||||
if ($cn == '1') {
|
||||
?>
|
||||
<p><strong>Config File Created and Database Imported.</strong><br></p>
|
||||
<form action="step5.php" method="post">
|
||||
<fieldset>
|
||||
<legend>Click Continue</legend>
|
||||
<button type='submit' class='btn btn-primary'>Continue</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php
|
||||
} elseif ($cn == '2') {
|
||||
?>
|
||||
<p> MySQL Connection was successfull. An error occured while adding data on MySQL. Unsuccessfull
|
||||
Installation. Please refer manual installation in the website github.com/ibnux/phpnuxbill or Contact phpnuxbill@ibnux.com for
|
||||
helping on installation</p>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<p> MySQL Connection Failed.</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span12">
|
||||
<h4> PHPNuxBill Installer </h4>
|
||||
<?php
|
||||
if ($cn == '1') {
|
||||
?>
|
||||
<p><strong>Config File Created and Database Imported.</strong><br></p>
|
||||
<form action="step5.php" method="post">
|
||||
<fieldset>
|
||||
<legend>Click Continue</legend>
|
||||
<button type='submit' class='btn btn-primary'>Continue</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php
|
||||
} elseif ($cn == '2') {
|
||||
?>
|
||||
<p> MySQL Connection was successfull. An error occured while adding data on MySQL. Unsuccessfull
|
||||
Installation. Please refer manual installation in the website github.com/ibnux/phpnuxbill/wiki or Contact Telegram @ibnux for
|
||||
helping on installation</p>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<p> MySQL Connection Failed.</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">Copyright © 2021 PHPNuxBill. All Rights Reserved<br/><br/></div>
|
||||
<div class="footer">Copyright © 2021 PHPNuxBill. All Rights Reserved<br /><br /></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user