diff --git a/.gitignore b/.gitignore index 1025436b..c9ad216f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -system/config.php +config.php .DS_Store .vscode/ ui/compiled/*.php diff --git a/system/config.sample.php b/config.sample.php similarity index 98% rename from system/config.sample.php rename to config.sample.php index 764696dc..d23e7f08 100644 --- a/system/config.sample.php +++ b/config.sample.php @@ -1,9 +1,9 @@ -<?php -$db_host = "localhost"; # Database Host -$db_port = ""; # Database Port. Keep it blank if you are un sure. -$db_user = "root"; # Database Username -$db_password = ""; # Database Password -$db_name = "phpmixbill"; # Database Name -define('APP_URL', 'http://localhost/phpmixbill'); # Application URL. -#Please include http and do not use trailing slash after the url. For example use in this format- http://www.example.com Or http://www.example.com/finance +<?php +$db_host = "localhost"; # Database Host +$db_port = ""; # Database Port. Keep it blank if you are un sure. +$db_user = "root"; # Database Username +$db_password = ""; # Database Password +$db_name = "phpmixbill"; # Database Name +define('APP_URL', 'http://localhost/phpmixbill'); # Application URL. +#Please include http and do not use trailing slash after the url. For example use in this format- http://www.example.com Or http://www.example.com/finance $_app_stage = 'Live'; # Do not change this \ No newline at end of file diff --git a/system/install/css/bootstrap.css b/install/css/bootstrap.css similarity index 100% rename from system/install/css/bootstrap.css rename to install/css/bootstrap.css diff --git a/system/install/css/bootstrap.css.map b/install/css/bootstrap.css.map similarity index 100% rename from system/install/css/bootstrap.css.map rename to install/css/bootstrap.css.map diff --git a/system/install/css/bootstrap.min.css b/install/css/bootstrap.min.css similarity index 100% rename from system/install/css/bootstrap.min.css rename to install/css/bootstrap.min.css diff --git a/system/install/css/style.css b/install/css/style.css similarity index 100% rename from system/install/css/style.css rename to install/css/style.css diff --git a/system/install/img/favicon.png b/install/img/favicon.png similarity index 100% rename from system/install/img/favicon.png rename to install/img/favicon.png diff --git a/system/install/img/logo.png b/install/img/logo.png similarity index 100% rename from system/install/img/logo.png rename to install/img/logo.png diff --git a/system/install/index.php b/install/index.php similarity index 98% rename from system/install/index.php rename to install/index.php index da025f84..80b78c65 100644 --- a/system/install/index.php +++ b/install/index.php @@ -1,60 +1,60 @@ -<!DOCTYPE html> -<html lang="en"> - -<head> - <title>PHPMixBill Installer</title> - <link rel="shortcut icon" type="image/x-icon" href="img/favicon.png"> - <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 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> - <!-- contents area start --> - <div class="row"> - <div class="col-md-12"> - <h4> PHPMixBill Installer </h4> - <h5>Please Read Before Continue</h5> - <p><strong>Informasi Aplikasi</strong><br> - Application Name: PHPMixBill <br> - Release Date: 30/10/2015<br> - By: PHPMixBill [ <a href="https://github.com/ibnux/phpmixbill" target="_blank">https://github.com/ibnux/phpmixbill</a> ]<br> - Donasi Paypal: <b>me@ibnux.et</b><br> - <br> - <strong>Syarat Penggunaan:</strong><br> - Syarat Penggunaan ini berlaku untuk semua versi.<br><br> - <ul> - <li>Silahkan Anda menggunakan aplikasi ini dengan bijak, Anda dapat mendesain ulang script maupun tampilan pada - aplikasi ini sesuai dengan kebutuhan anda, memperbayak jumlah copy atau mendistribusikan aplikasi ini. - Dengan catatan tidak menghapus link developer.</li> - <li>Tidak ada garansi dari kami jika anda mengalami error atau merasa rugi ketika menggunakan aplikasi ini, - Anda hanya dapat memberikan feedback yang berisi laporan error, dengan syarat dan ketentuan yang berlaku.</li> - <li>Semua yang terkait biaya atau donasi apapun versi-nya, Anda dapat update seumur hidup atau selama aplikasi - ini masih dikembangkan. Mohon jangan salah pengertian bahwa kami tim pengembang mengkomersilkan produk ini - dan anda membeli produk kami.</li> - <li>Aplikasi ini bersifat sosial untuk dapat dikembangkan bersama. Karena itu kami juga mengundang relawan-relawan - yang mau menjadi pengembangkan aplikasi ini.</li> - <li>Penulis berhak setiap saat untuk mengubah ketentuan Syarat Penggunaan tanpa pemberitahuan sebelumnya.</li> - </ul> - </div> - <div class="col-md-12"><br> - <a href="step2.php" class="btn btn-primary">Accept & Continue</a> - </div> - </div> - <!-- contents area end --> - </div> - <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br /><br /></div> -</body> - +<!DOCTYPE html> +<html lang="en"> + +<head> + <title>PHPMixBill Installer</title> + <link rel="shortcut icon" type="image/x-icon" href="img/favicon.png"> + <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 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> + <!-- contents area start --> + <div class="row"> + <div class="col-md-12"> + <h4> PHPMixBill Installer </h4> + <h5>Please Read Before Continue</h5> + <p><strong>Informasi Aplikasi</strong><br> + Application Name: PHPMixBill <br> + Release Date: 30/10/2015<br> + By: PHPMixBill [ <a href="https://github.com/ibnux/phpmixbill" target="_blank">https://github.com/ibnux/phpmixbill</a> ]<br> + Donasi Paypal: <b>me@ibnux.et</b><br> + <br> + <strong>Syarat Penggunaan:</strong><br> + Syarat Penggunaan ini berlaku untuk semua versi.<br><br> + <ul> + <li>Silahkan Anda menggunakan aplikasi ini dengan bijak, Anda dapat mendesain ulang script maupun tampilan pada + aplikasi ini sesuai dengan kebutuhan anda, memperbayak jumlah copy atau mendistribusikan aplikasi ini. + Dengan catatan tidak menghapus link developer.</li> + <li>Tidak ada garansi dari kami jika anda mengalami error atau merasa rugi ketika menggunakan aplikasi ini, + Anda hanya dapat memberikan feedback yang berisi laporan error, dengan syarat dan ketentuan yang berlaku.</li> + <li>Semua yang terkait biaya atau donasi apapun versi-nya, Anda dapat update seumur hidup atau selama aplikasi + ini masih dikembangkan. Mohon jangan salah pengertian bahwa kami tim pengembang mengkomersilkan produk ini + dan anda membeli produk kami.</li> + <li>Aplikasi ini bersifat sosial untuk dapat dikembangkan bersama. Karena itu kami juga mengundang relawan-relawan + yang mau menjadi pengembangkan aplikasi ini.</li> + <li>Penulis berhak setiap saat untuk mengubah ketentuan Syarat Penggunaan tanpa pemberitahuan sebelumnya.</li> + </ul> + </div> + <div class="col-md-12"><br> + <a href="step2.php" class="btn btn-primary">Accept & Continue</a> + </div> + </div> + <!-- contents area end --> + </div> + <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br /><br /></div> +</body> + </html> \ No newline at end of file diff --git a/system/install/phpmixbill.sql b/install/phpmixbill.sql similarity index 100% rename from system/install/phpmixbill.sql rename to install/phpmixbill.sql diff --git a/system/install/step2.php b/install/step2.php similarity index 97% rename from system/install/step2.php rename to install/step2.php index abbaddcc..e16874da 100644 --- a/system/install/step2.php +++ b/install/step2.php @@ -1,70 +1,70 @@ -<!DOCTYPE html> -<html lang="en"> - -<head> - <title>PHPMixBill 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"> - - <!--[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 Installer </h4> - <?php - $passed = ''; - $ltext = ''; - 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 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---FAILED---</strong><br/>"; - $passed .= '0'; - } - - if (extension_loaded('PDO')) { - $ltext .= 'PDO is installed on your server: ' . "Tested <strong>---PASSED---</strong><br/>"; - $passed .= '1'; - } else { - $ltext = 'PDO is installed on your server: ' . "Tested <strong>---FAILED---</strong><br/>"; - $passed .= '0'; - } - - if (extension_loaded('pdo_mysql')) { - $ltext .= 'PDO MySQL driver is enabled on your server: ' . "Tested <strong>---PASSED---</strong><br/>"; - $passed .= '1'; - } else { - $ltext .= 'PDO MySQL driver is not enabled on your server: ' . "Tested <strong>---FAILED---</strong><br/>"; - $passed .= '0'; - } - - if ($passed == '111') { - 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><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. - 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>"); - } - ?> - </div> - </div> - <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br /><br /></div> -</body> - +<!DOCTYPE html> +<html lang="en"> + +<head> + <title>PHPMixBill 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"> + + <!--[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 Installer </h4> + <?php + $passed = ''; + $ltext = ''; + 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 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---FAILED---</strong><br/>"; + $passed .= '0'; + } + + if (extension_loaded('PDO')) { + $ltext .= 'PDO is installed on your server: ' . "Tested <strong>---PASSED---</strong><br/>"; + $passed .= '1'; + } else { + $ltext = 'PDO is installed on your server: ' . "Tested <strong>---FAILED---</strong><br/>"; + $passed .= '0'; + } + + if (extension_loaded('pdo_mysql')) { + $ltext .= 'PDO MySQL driver is enabled on your server: ' . "Tested <strong>---PASSED---</strong><br/>"; + $passed .= '1'; + } else { + $ltext .= 'PDO MySQL driver is not enabled on your server: ' . "Tested <strong>---FAILED---</strong><br/>"; + $passed .= '0'; + } + + if ($passed == '111') { + 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><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. + 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>"); + } + ?> + </div> + </div> + <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br /><br /></div> +</body> + </html> \ No newline at end of file diff --git a/system/install/step3.php b/install/step3.php similarity index 97% rename from system/install/step3.php rename to install/step3.php index 29db1b36..422a3ca9 100644 --- a/system/install/step3.php +++ b/install/step3.php @@ -1,72 +1,72 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <title>PHPMixBill 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"> - - <!--[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 Installer </h4> - <?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 = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - $appurl = str_replace('/install/step3.php', '', $cururl); - $appurl = str_replace('?_error=1', '', $appurl); - $appurl = str_replace('/system', '', $appurl); - ?> - - <form action="step4.php" method="post"> - <fieldset> - <legend>Database Connection & Site config</legend> - - <div class="form-group"> - <label for="appurl">Application URL</label> - <input type="text" class="form-control" id="appurl" name="appurl" value="<?php echo $appurl; ?>"> - <span class='help-block'>Application url without trailing slash at the end of url (e.g. http://172.16.10.10). Please keep default, if you are unsure.</span> - </div> - <div class="form-group"> - <label for="dbhost">Database Host</label> - <input type="text" class="form-control" id="dbhost" name="dbhost"> - </div> - <div class="form-group"> - <label for="dbuser">Database Username</label> - <input type="text" class="form-control" id="dbuser" name="dbuser"> - </div> - <div class="form-group"> - <label for="dbpass">Database Password</label> - <input type="text" class="form-control" id="dbpass" name="dbpass"> - </div> - - <div class="form-group"> - <label for="dbname">Database Name</label> - <input type="text" class="form-control" id="dbname" name="dbname"> - </div> - - <button type="submit" class="btn btn-primary">Submit</button> - </fieldset> - </form> - </div> - </div> - <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br/><br/></div> -</body> -</html> - +<!DOCTYPE html> +<html lang="en"> +<head> + <title>PHPMixBill 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"> + + <!--[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 Installer </h4> + <?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 = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $appurl = str_replace('/install/step3.php', '', $cururl); + $appurl = str_replace('?_error=1', '', $appurl); + $appurl = str_replace('/system', '', $appurl); + ?> + + <form action="step4.php" method="post"> + <fieldset> + <legend>Database Connection & Site config</legend> + + <div class="form-group"> + <label for="appurl">Application URL</label> + <input type="text" class="form-control" id="appurl" name="appurl" value="<?php echo $appurl; ?>"> + <span class='help-block'>Application url without trailing slash at the end of url (e.g. http://172.16.10.10). Please keep default, if you are unsure.</span> + </div> + <div class="form-group"> + <label for="dbhost">Database Host</label> + <input type="text" class="form-control" id="dbhost" name="dbhost"> + </div> + <div class="form-group"> + <label for="dbuser">Database Username</label> + <input type="text" class="form-control" id="dbuser" name="dbuser"> + </div> + <div class="form-group"> + <label for="dbpass">Database Password</label> + <input type="text" class="form-control" id="dbpass" name="dbpass"> + </div> + + <div class="form-group"> + <label for="dbname">Database Name</label> + <input type="text" class="form-control" id="dbname" name="dbname"> + </div> + + <button type="submit" class="btn btn-primary">Submit</button> + </fieldset> + </form> + </div> + </div> + <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br/><br/></div> +</body> +</html> + diff --git a/system/install/step4.php b/install/step4.php similarity index 96% rename from system/install/step4.php rename to install/step4.php index 4027c906..2ff69f68 100644 --- a/system/install/step4.php +++ b/install/step4.php @@ -1,102 +1,102 @@ -<?php -/** -* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/) -**/ -//error_reporting (0); -$appurl = $_POST['appurl']; -$db_host = $_POST['dbhost']; -$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", - "$db_user", - "$db_password", - array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); - $cn = '1'; -} -catch(PDOException $ex){ - $cn = '0'; -} - -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"; - $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('phpmixbill.sql'); - - $qr = $dbh->exec($sql); - -} else { - header("location: step3.php?_error=1"); - exit; -} - -?> -<!DOCTYPE html> -<html lang="en"> -<head> - <title>PHPMixBill 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"> - - <!--[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 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/phpmixbill or Contact phpmixbill@ibnux.com for - helping on installation</p> - <?php - } else { - ?> - <p> MySQL Connection Failed.</p> - <?php - } - ?> - </div> - </div> - - <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br/><br/></div> -</body> -</html> - +<?php +/** +* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/) +**/ +//error_reporting (0); +$appurl = $_POST['appurl']; +$db_host = $_POST['dbhost']; +$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", + "$db_user", + "$db_password", + array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); + $cn = '1'; +} +catch(PDOException $ex){ + $cn = '0'; +} + +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"; + $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('phpmixbill.sql'); + + $qr = $dbh->exec($sql); + +} else { + header("location: step3.php?_error=1"); + exit; +} + +?> +<!DOCTYPE html> +<html lang="en"> +<head> + <title>PHPMixBill 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"> + + <!--[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 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/phpmixbill or Contact phpmixbill@ibnux.com for + helping on installation</p> + <?php + } else { + ?> + <p> MySQL Connection Failed.</p> + <?php + } + ?> + </div> + </div> + + <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br/><br/></div> +</body> +</html> + diff --git a/system/install/step5.php b/install/step5.php similarity index 97% rename from system/install/step5.php rename to install/step5.php index 5c72f25a..44663829 100644 --- a/system/install/step5.php +++ b/install/step5.php @@ -1,46 +1,46 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <title>PHPMixBill 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"> - - <!--[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 Installer </h4> - <p> - <strong>Congratulations!</strong><br> - You have just install PHPMixBill !<br> - To Login Admin Portal:<br> - Use this link - - <?php - $cururl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - $appurl = str_replace('/install/step5.php', '', $cururl); - $appurl = str_replace('/system', '', $appurl); - echo '<a href="' . $appurl . '/admin">' . $appurl . '/admin</a>'; - ?> - <br> - Username: admin<br> - Password: admin<br> - For security, Delete the <b>install</b> directory inside system folder. - </p> - </div> - </div> - <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br/><br/></div> -</body> +<!DOCTYPE html> +<html lang="en"> +<head> + <title>PHPMixBill 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"> + + <!--[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 Installer </h4> + <p> + <strong>Congratulations!</strong><br> + You have just install PHPMixBill !<br> + To Login Admin Portal:<br> + Use this link - + <?php + $cururl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $appurl = str_replace('/install/step5.php', '', $cururl); + $appurl = str_replace('/system', '', $appurl); + echo '<a href="' . $appurl . '/admin">' . $appurl . '/admin</a>'; + ?> + <br> + Username: admin<br> + Password: admin<br> + For security, Delete the <b>install</b> directory inside system folder. + </p> + </div> + </div> + <div class="footer">Copyright © 2021 PHPMixBill. All Rights Reserved<br/><br/></div> +</body> </html> \ No newline at end of file diff --git a/system/install/update.php b/install/update.php similarity index 100% rename from system/install/update.php rename to install/update.php diff --git a/system/boot.php b/system/boot.php index 971a3e3e..c17c0e9e 100644 --- a/system/boot.php +++ b/system/boot.php @@ -17,10 +17,10 @@ function r2($to, $ntype = 'e', $msg = '') exit; } -if (file_exists('system/config.php')) { - require('system/config.php'); +if (file_exists('config.php')) { + require('config.php'); } else { - r2('system/install'); + r2('install'); } @@ -220,8 +220,7 @@ function _admin($login = true) function _raid($l) { - $r = substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l); - return $r; + return substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l); } function _log($description, $type = '', $userid = '0') @@ -263,6 +262,7 @@ function alphanumeric($str, $tambahan = "") function sendTelegram($txt) { global $_c; + run_hook('send_telegram'); #HOOK if (!empty($_c['telegram_bot']) && !empty($_c['telegram_target_id'])) { file_get_contents('https://api.telegram.org/bot' . $_c['telegram_bot'] . '/sendMessage?chat_id=' . $_c['telegram_target_id'] . '&text=' . urlencode($txt)); } @@ -272,6 +272,7 @@ function sendTelegram($txt) function sendSMS($phone, $txt) { global $_c; + run_hook('send_sms'); #HOOK if (!empty($_c['sms_url'])) { $smsurl = str_replace('[number]', urlencode($phone), $_c['sms_url']); $smsurl = str_replace('[text]', urlencode($txt), $smsurl); @@ -282,6 +283,7 @@ function sendSMS($phone, $txt) function sendWhatsapp($phone, $txt) { global $_c; + run_hook('send_whatsapp'); #HOOK if (!empty($_c['wa_url'])) { $waurl = str_replace('[number]', urlencode($phone), $_c['wa_url']); $waurl = str_replace('[text]', urlencode($txt), $waurl); diff --git a/system/cron.php b/system/cron.php index 8f3c6856..1fc2b284 100644 --- a/system/cron.php +++ b/system/cron.php @@ -3,7 +3,7 @@ * PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/) **/ -require('config.php'); +require('../config.php'); require('orm.php'); use PEAR2\Net\RouterOS; diff --git a/system/radius.php b/system/radius.php index 6de89c63..e3ad01ed 100644 --- a/system/radius.php +++ b/system/radius.php @@ -7,7 +7,7 @@ if(php_sapi_name() !== 'cli'){ die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE"); } -require(__DIR__.'/config.php'); +require(__DIR__.'/../config.php'); require(__DIR__.'/orm.php'); use PEAR2\Net\RouterOS;