make update script

This commit is contained in:
Ibnu Maksum 2022-09-09 09:53:21 +07:00
parent 46e534af6c
commit e9d67ce220
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
5 changed files with 205 additions and 100 deletions

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill Installer</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.png">
@ -9,7 +10,7 @@
<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 href="css/bootstrap.min.css" rel="stylesheet">
</head>
@ -17,7 +18,7 @@
<div id='main-container'>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo"/></a></div>
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo" /></a></div>
</div>
</div>
<!-- contents area start -->
@ -53,7 +54,7 @@
</div>
<!-- contents area end -->
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br/><br/></div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
</body>
</html>
</html>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill Installer</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
@ -9,7 +10,7 @@
<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>
@ -17,7 +18,7 @@
<div id='main-container'>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo"/></a></div>
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo" /></a></div>
</div>
</div>
@ -26,14 +27,12 @@
<?php
$passed = '';
$ltext = '';
if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
$ltext .= 'To Run PHPMixBill You need at least PHP version 5.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---PASSED---</strong><br/>";
if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
$ltext .= 'To Run PHPMixBill You need at least PHP version 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext .= 'To Run PHPMixBill You need at least PHP version 5.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---FAILED---</strong><br/>";
$ltext .= 'To Run PHPMixBill You need at least PHP version 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if (extension_loaded('PDO')) {
@ -53,11 +52,11 @@
}
if ($passed == '111') {
echo("<br/> $ltext <br/> Great! System Test Completed. You can run PHPMixBill on your server. Click Continue For Next Step.
echo ("<br/> $ltext <br/> Great! System Test Completed. You can run PHPMixBill on your server. Click Continue For Next Step.
<br><br>
<a href=\"step3.php\" class=\"btn btn-primary\">Continue</a>");
<a href=\"step3.php\" class=\"btn btn-primary\">Continue</a><br><br><a href=\"update.php\" class=\"btn btn-primary\">Update System</a>");
} else {
echo("<br/> $ltext <br/> Sorry. The requirements of PHPMixBill is not available on your server.
echo ("<br/> $ltext <br/> Sorry. The requirements of PHPMixBill is not available on your server.
Please contact with us- iesien22@yahoo.com with this code- $passed Or contact with your server administrator
<br><br>
<a href=\"#\" class=\"btn btn-primary disabled\">Correct The Problem To Continue</a>");
@ -65,7 +64,7 @@
?>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br/><br/></div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
</body>
</html>
</html>

View File

@ -26,7 +26,7 @@
<?php
if (isset($_GET['_error']) && ($_GET['_error']) == '1') {
echo '<h4 style="color: red;"> Unable to Connect Database, Please make sure database info is correct and try again ! </h4>';
}
}//
$cururl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$appurl = str_replace('/install/step3.php', '', $cururl);

View File

@ -22,13 +22,13 @@ catch(PDOException $ex){
if ($cn == '1') {
$input = '<?php
$db_host = \'' . $db_host . '\';
$db_user = \'' . $db_user . '\';
$db_password = \'' . $db_password . '\';
$db_name = \'' . $db_name . '\';
define(\'APP_URL\', \'' . $appurl . '\');
$_app_stage = \'Live\';';
$wConfig = "../config.php";
$db_host = \'' . $db_host . '\';
$db_user = \'' . $db_user . '\';
$db_password = \'' . $db_password . '\';
$db_name = \'' . $db_name . '\';
define(\'APP_URL\', \'' . $appurl . '\');
$_app_stage = \'Live\';';
$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");

105
system/install/update.php Normal file
View File

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill Updaters</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo" /></a></div>
</div>
</div>
<div class="span12">
<h4> PHPMixBill Updater </h4>
<pre><?php
include '../config.php';
try{
$dbh = new pdo( "mysql:host=$db_host;dbname=$db_name",
"$db_user",
"$db_password",
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
echo "CREATE TABLE `tbl_payment_gateway` (
`id` int(11) NOT NULL,
`username` varchar(32) COLLATE utf8mb4_general_ci NOT NULL,
`gateway` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'xendit | midtrans',
`gateway_trx_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`plan_id` int(11) NOT NULL,
`plan_name` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
`routers_id` int(11) NOT NULL,
`routers` varchar(32) COLLATE utf8mb4_general_ci NOT NULL,
`price` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
`pg_url_payment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`payment_method` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`payment_channel` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`pg_request` text COLLATE utf8mb4_general_ci,
`pg_paid_response` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`expired_date` datetime DEFAULT NULL,
`created_date` datetime NOT NULL,
`paid_date` datetime DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1 unpaid 2 paid 3 failed 4 canceled'
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;\n\n";
$dbh->exec("CREATE TABLE
`tbl_payment_gateway` (
`id` int(11) NOT NULL,
`username` varchar(32) COLLATE utf8mb4_general_ci NOT NULL,
`gateway` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'xendit | midtrans',
`gateway_trx_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`plan_id` int(11) NOT NULL,
`plan_name` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
`routers_id` int(11) NOT NULL,
`routers` varchar(32) COLLATE utf8mb4_general_ci NOT NULL,
`price` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
`pg_url_payment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`payment_method` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`payment_channel` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`pg_request` text COLLATE utf8mb4_general_ci,
`pg_paid_response` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`expired_date` datetime DEFAULT NULL,
`created_date` datetime NOT NULL,
`paid_date` datetime DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1 unpaid 2 paid 3 failed 4 canceled'
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;");
echo "ALTER TABLE `tbl_payment_gateway` ADD PRIMARY KEY (`id`);\n\n";
$dbh->exec("ALTER TABLE `tbl_payment_gateway` ADD PRIMARY KEY (`id`);");
echo "ALTER TABLE `tbl_payment_gateway` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;\n\n";
$dbh->exec("ALTER TABLE `tbl_payment_gateway` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;");
echo "ALTER TABLE `tbl_customers` ADD `email` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' AFTER `phonenumber`;\n\n";
$dbh->exec("ALTER TABLE `tbl_customers` ADD `email` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' AFTER `phonenumber`;");
echo "ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;\n\n";
$dbh->exec("ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL");
echo "ALTER TABLE `tbl_plans` ADD `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled' AFTER `pool`;\n\n";
$dbh->exec("ALTER TABLE `tbl_plans` ADD `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled' AFTER `pool`;");
echo "ALTER TABLE `tbl_routers` ADD `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled' AFTER `description`;\n\n";
$dbh->exec("ALTER TABLE `tbl_routers` ADD `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled' AFTER `description`;");
echo "ALTER TABLE `tbl_routers` CHANGE `description` `description` VARCHAR(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;";
$dbh->exec("ALTER TABLE `tbl_routers` CHANGE `description` `description` VARCHAR(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;");
echo "Success update database for new system <a href='/admin/'>Back To Home</a>";
}catch(PDOException $ex){
echo "Error Failed to connect to database: ".$ex->getMessage()."\n";
}
?></pre>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
</body>
</html>