diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..5dc604d6
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,20 @@
+
+
+# CHANGELOG
+
+## 2023.6.15
+
+- User can connect to internet from User Dashboard
+- Fix Confirm when delete
+- Change Logo PHPNuxBill
+- Using Composer
+- Fix Search User
+- Fix user check, if not found will logout
+- User password show but hidden
+- Voucher code hidden
+
+## 2023.6.8
+
+- Fixing registration without OTP
+- Username will not go to phonenumber if OTP registration is not enabled
+- Fix Bug PPOE
\ No newline at end of file
diff --git a/README.md b/README.md
index b02d3c59..f624abe9 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
-# PHPNuxBill - Mikrotik Billing
+# PHPNuxBill - PHP Mikrotik Billing
+
+
## Feature
@@ -15,17 +17,12 @@
See [How it Works / Cara Kerja](https://github.com/hotspotbilling/phpnuxbill/wiki/How-It-Works---Cara-kerja)
-## Payment Gateway
+## Payment Gateway And Plugin
-- [Tripay.com](https://github.com/hotspotbilling/phpnuxbill-tripay) | Indonesia
-- [Xendit.com](https://github.com/hotspotbilling/phpnuxbill-xendit) | Indonesia and Philippine ( Philippine not tested )
-- [Duitku.com](https://github.com/hotspotbilling/phpnuxbill-duitku) | Indonesia
+- [Payment Gateway List](https://github.com/orgs/hotspotbilling/repositories?q=payment+gateway)
+- [Plugin List](https://github.com/orgs/hotspotbilling/repositories?q=plugin)
-Click link to download
-
-Goto Discussionif you want another Payment Gateway
-
-Some documentation
+You can download payment gateway and Plugin from Plugin Manager
## System Requirements
@@ -124,6 +121,8 @@ GNU General Public License version 2 or later
see LICENSE file
+## [CHANGELOG](CHANGELOG.md)
+
## Donate to ibnux
[](https://paypal.me/ibnux)
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 00000000..80e2ed8e
Binary files /dev/null and b/favicon.ico differ
diff --git a/index.php b/index.php
index 8686af78..d1eac444 100644
--- a/index.php
+++ b/index.php
@@ -2,6 +2,15 @@
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
+session_start();
-require ('system/boot.php');
+if(isset($_GET['nux-mac']) && !empty($_GET['nux-mac'])){
+ $_SESSION['nux-mac'] = $_GET['nux-mac'];
+}
+
+if(isset($_GET['nux-ip']) && !empty($_GET['nux-ip'])){
+ $_SESSION['nux-ip'] = $_GET['nux-ip'];
+}
+require_once 'system/vendor/autoload.php';
+require_once 'system/boot.php';
App::_run();
diff --git a/install/img/favicon.png b/install/img/favicon.png
index dd342612..f87c5c50 100644
Binary files a/install/img/favicon.png and b/install/img/favicon.png differ
diff --git a/install/img/logo.png b/install/img/logo.png
index dd05cd03..d08cf12b 100644
Binary files a/install/img/logo.png and b/install/img/logo.png differ
diff --git a/system/autoload/Mikrotik.php b/system/autoload/Mikrotik.php
index a5c4e346..0b98ecd4 100644
--- a/system/autoload/Mikrotik.php
+++ b/system/autoload/Mikrotik.php
@@ -19,6 +19,38 @@ class Mikrotik
}
}
+ public static function isUserLogin($client, $username){
+ $printRequest = new RouterOS\Request(
+ '/ip hotspot active print',
+ RouterOS\Query::where('user', $username)
+ );
+ return $client->sendSync($printRequest)->getProperty('.id');
+ }
+
+ public static function logMeIn($client, $user, $pass, $ip, $mac){
+ $addRequest = new RouterOS\Request('/ip/hotspot/active/login');
+ $client->sendSync(
+ $addRequest
+ ->setArgument('user', $user)
+ ->setArgument('password', $pass)
+ ->setArgument('ip', $ip)
+ ->setArgument('mac-address', $mac)
+ );
+ }
+
+ public static function logMeOut($client, $user){
+ $printRequest = new RouterOS\Request(
+ '/ip hotspot active print',
+ RouterOS\Query::where('user', $user)
+ );
+ $id = $client->sendSync($printRequest)->getProperty('.id');
+ $removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
+ $client(
+ $removeRequest
+ ->setArgument('numbers', $id)
+ );
+ }
+
public static function addHotspotPlan($client, $name, $sharedusers, $rate){
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync(
diff --git a/system/autoload/User.php b/system/autoload/User.php
index 68ebbf55..18c9fd88 100644
--- a/system/autoload/User.php
+++ b/system/autoload/User.php
@@ -1,17 +1,26 @@
find_one($id);
+
+ if(empty($d['username'])){
+ r2(U . 'logout', 'd', '');
+ }
return $d;
}
- public static function _billing(){
+
+ public static function _billing()
+ {
$id = $_SESSION['uid'];
- $d = ORM::for_table('tbl_user_recharges')->where('customer_id',$id)->find_one();
+ $d = ORM::for_table('tbl_user_recharges')->where('customer_id', $id)->find_one();
return $d;
}
-}
\ No newline at end of file
+}
diff --git a/system/boot.php b/system/boot.php
index 8c221a87..6f98ab7a 100644
--- a/system/boot.php
+++ b/system/boot.php
@@ -4,7 +4,6 @@
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
-session_start();
function r2($to, $ntype = 'e', $msg = '')
{
if ($msg == '') {
@@ -82,7 +81,6 @@ function _notify($msg, $type = 'e')
$_SESSION['notify'] = $msg;
}
-require_once('system/vendors/smarty/libs/Smarty.class.php');
$lan_file = 'system/lan/' . $config['language'] . '/common.lan.php';
require($lan_file);
$ui = new Smarty();
diff --git a/system/composer.json b/system/composer.json
new file mode 100644
index 00000000..9bded243
--- /dev/null
+++ b/system/composer.json
@@ -0,0 +1,6 @@
+{
+ "require": {
+ "mpdf/mpdf": "^8.1",
+ "smarty/smarty": "^4.3"
+ }
+}
diff --git a/system/composer.lock b/system/composer.lock
new file mode 100644
index 00000000..40d0cae7
--- /dev/null
+++ b/system/composer.lock
@@ -0,0 +1,490 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "81c1d3c4b2673fdd2922ac32768d59f1",
+ "packages": [
+ {
+ "name": "mpdf/mpdf",
+ "version": "v8.1.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/mpdf.git",
+ "reference": "146c7c1dfd21c826b9d5bbfe3c15e52fd933c90f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/mpdf/zipball/146c7c1dfd21c826b9d5bbfe3c15e52fd933c90f",
+ "reference": "146c7c1dfd21c826b9d5bbfe3c15e52fd933c90f",
+ "shasum": ""
+ },
+ "require": {
+ "ext-gd": "*",
+ "ext-mbstring": "*",
+ "mpdf/psr-log-aware-trait": "^2.0 || ^3.0",
+ "myclabs/deep-copy": "^1.7",
+ "paragonie/random_compat": "^1.4|^2.0|^9.99.99",
+ "php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
+ "psr/http-message": "^1.0",
+ "psr/log": "^1.0 || ^2.0 || ^3.0",
+ "setasign/fpdi": "^2.1"
+ },
+ "require-dev": {
+ "mockery/mockery": "^1.3.0",
+ "mpdf/qrcode": "^1.1.0",
+ "squizlabs/php_codesniffer": "^3.5.0",
+ "tracy/tracy": "~2.5",
+ "yoast/phpunit-polyfills": "^1.0"
+ },
+ "suggest": {
+ "ext-bcmath": "Needed for generation of some types of barcodes",
+ "ext-xml": "Needed mainly for SVG manipulation",
+ "ext-zlib": "Needed for compression of embedded resources, such as fonts"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Mpdf\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0-only"
+ ],
+ "authors": [
+ {
+ "name": "Matěj Humpál",
+ "role": "Developer, maintainer"
+ },
+ {
+ "name": "Ian Back",
+ "role": "Developer (retired)"
+ }
+ ],
+ "description": "PHP library generating PDF files from UTF-8 encoded HTML",
+ "homepage": "https://mpdf.github.io",
+ "keywords": [
+ "pdf",
+ "php",
+ "utf-8"
+ ],
+ "support": {
+ "docs": "http://mpdf.github.io",
+ "issues": "https://github.com/mpdf/mpdf/issues",
+ "source": "https://github.com/mpdf/mpdf"
+ },
+ "funding": [
+ {
+ "url": "https://www.paypal.me/mpdf",
+ "type": "custom"
+ }
+ ],
+ "time": "2023-05-03T19:36:43+00:00"
+ },
+ {
+ "name": "mpdf/psr-log-aware-trait",
+ "version": "v2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/psr-log-aware-trait.git",
+ "reference": "7a077416e8f39eb626dee4246e0af99dd9ace275"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/psr-log-aware-trait/zipball/7a077416e8f39eb626dee4246e0af99dd9ace275",
+ "reference": "7a077416e8f39eb626dee4246e0af99dd9ace275",
+ "shasum": ""
+ },
+ "require": {
+ "psr/log": "^1.0 || ^2.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Mpdf\\PsrLogAwareTrait\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Dorison",
+ "email": "mark@chromatichq.com"
+ },
+ {
+ "name": "Kristofer Widholm",
+ "email": "kristofer@chromatichq.com"
+ }
+ ],
+ "description": "Trait to allow support of different psr/log versions.",
+ "support": {
+ "issues": "https://github.com/mpdf/psr-log-aware-trait/issues",
+ "source": "https://github.com/mpdf/psr-log-aware-trait/tree/v2.0.0"
+ },
+ "time": "2023-05-03T06:18:28+00:00"
+ },
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.11.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
+ "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "conflict": {
+ "doctrine/collections": "<1.6.8",
+ "doctrine/common": "<2.13.3 || >=3,<3.2.2"
+ },
+ "require-dev": {
+ "doctrine/collections": "^1.6.8",
+ "doctrine/common": "^2.13.3 || ^3.2.2",
+ "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/DeepCopy/deep_copy.php"
+ ],
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "support": {
+ "issues": "https://github.com/myclabs/DeepCopy/issues",
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
+ },
+ "funding": [
+ {
+ "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2023-03-08T13:26:56+00:00"
+ },
+ {
+ "name": "paragonie/random_compat",
+ "version": "v9.99.100",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paragonie/random_compat.git",
+ "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
+ "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">= 7"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.*|5.*",
+ "vimeo/psalm": "^1"
+ },
+ "suggest": {
+ "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+ },
+ "type": "library",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paragon Initiative Enterprises",
+ "email": "security@paragonie.com",
+ "homepage": "https://paragonie.com"
+ }
+ ],
+ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+ "keywords": [
+ "csprng",
+ "polyfill",
+ "pseudorandom",
+ "random"
+ ],
+ "support": {
+ "email": "info@paragonie.com",
+ "issues": "https://github.com/paragonie/random_compat/issues",
+ "source": "https://github.com/paragonie/random_compat"
+ },
+ "time": "2020-10-15T08:29:30+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
+ "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/1.1"
+ },
+ "time": "2023-04-04T09:50:52+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.1.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/1.1.4"
+ },
+ "time": "2021-05-03T11:20:27+00:00"
+ },
+ {
+ "name": "setasign/fpdi",
+ "version": "v2.3.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Setasign/FPDI.git",
+ "reference": "bccc892d5fa1f48c43f8ba7db5ed4ba6f30c8c05"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Setasign/FPDI/zipball/bccc892d5fa1f48c43f8ba7db5ed4ba6f30c8c05",
+ "reference": "bccc892d5fa1f48c43f8ba7db5ed4ba6f30c8c05",
+ "shasum": ""
+ },
+ "require": {
+ "ext-zlib": "*",
+ "php": "^5.6 || ^7.0 || ^8.0"
+ },
+ "conflict": {
+ "setasign/tfpdf": "<1.31"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~5.7",
+ "setasign/fpdf": "~1.8",
+ "setasign/tfpdf": "1.31",
+ "squizlabs/php_codesniffer": "^3.5",
+ "tecnickcom/tcpdf": "~6.2"
+ },
+ "suggest": {
+ "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "setasign\\Fpdi\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jan Slabon",
+ "email": "jan.slabon@setasign.com",
+ "homepage": "https://www.setasign.com"
+ },
+ {
+ "name": "Maximilian Kresse",
+ "email": "maximilian.kresse@setasign.com",
+ "homepage": "https://www.setasign.com"
+ }
+ ],
+ "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
+ "homepage": "https://www.setasign.com/fpdi",
+ "keywords": [
+ "fpdf",
+ "fpdi",
+ "pdf"
+ ],
+ "support": {
+ "issues": "https://github.com/Setasign/FPDI/issues",
+ "source": "https://github.com/Setasign/FPDI/tree/v2.3.7"
+ },
+ "funding": [
+ {
+ "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2023-02-09T10:38:43+00:00"
+ },
+ {
+ "name": "smarty/smarty",
+ "version": "v4.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/smarty-php/smarty.git",
+ "reference": "e28cb0915b4e3749bf57d4ebae2984e25395cfe5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/smarty-php/smarty/zipball/e28cb0915b4e3749bf57d4ebae2984e25395cfe5",
+ "reference": "e28cb0915b4e3749bf57d4ebae2984e25395cfe5",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8.5 || ^7.5",
+ "smarty/smarty-lexer": "^3.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "libs/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0"
+ ],
+ "authors": [
+ {
+ "name": "Monte Ohrt",
+ "email": "monte@ohrt.com"
+ },
+ {
+ "name": "Uwe Tews",
+ "email": "uwe.tews@googlemail.com"
+ },
+ {
+ "name": "Rodney Rehm",
+ "email": "rodney.rehm@medialize.de"
+ },
+ {
+ "name": "Simon Wisselink",
+ "homepage": "https://www.iwink.nl/"
+ }
+ ],
+ "description": "Smarty - the compiling PHP template engine",
+ "homepage": "https://smarty-php.github.io/smarty/",
+ "keywords": [
+ "templating"
+ ],
+ "support": {
+ "forum": "https://github.com/smarty-php/smarty/discussions",
+ "issues": "https://github.com/smarty-php/smarty/issues",
+ "source": "https://github.com/smarty-php/smarty/tree/v4.3.1"
+ },
+ "time": "2023-03-28T19:47:03+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.3.0"
+}
diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php
index 8c93dedf..b586fdb2 100644
--- a/system/controllers/accounts.php
+++ b/system/controllers/accounts.php
@@ -1,7 +1,8 @@
assign('_title', $_L['My_Account']);
$ui->assign('_system_menu', 'accounts');
@@ -11,6 +12,7 @@ $user = User::_info();
$ui->assign('_user', $user);
use PEAR2\Net\RouterOS;
+
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
@@ -23,83 +25,79 @@ switch ($action) {
case 'change-password-post':
$password = _post('password');
run_hook('customer_change_password'); #HOOK
- if($password != ''){
- $d = ORM::for_table('tbl_customers')->where('username',$user['username'])->find_one();
- if($d){
+ if ($password != '') {
+ $d = ORM::for_table('tbl_customers')->where('username', $user['username'])->find_one();
+ if ($d) {
$d_pass = $d['password'];
- $npass = _post('npass');
+ $npass = _post('npass');
$cnpass = _post('cnpass');
- if(Password::_uverify($password,$d_pass) == true){
- if(!Validator::Length($npass,15,2)){
- r2(U.'accounts/change-password','e','New Password must be 3 to 14 character');
+ if (Password::_uverify($password, $d_pass) == true) {
+ if (!Validator::Length($npass, 15, 2)) {
+ r2(U . 'accounts/change-password', 'e', 'New Password must be 3 to 14 character');
}
- if($npass != $cnpass){
- r2(U.'accounts/change-password','e','Both Password should be same');
+ if ($npass != $cnpass) {
+ r2(U . 'accounts/change-password', 'e', 'Both Password should be same');
}
- $c = ORM::for_table('tbl_user_recharges')->where('username',$user['username'])->find_one();
- if ($c){
- $mikrotik = Mikrotik::info($c['routers']);
- if($c['type'] == 'Hotspot'){
- if(!$config['radius_mode']){
+ $c = ORM::for_table('tbl_user_recharges')->where('username', $user['username'])->find_one();
+ if ($c) {
+ $mikrotik = Mikrotik::info($c['routers']);
+ if ($c['type'] == 'Hotspot') {
+ if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::setHotspotUser($client,$c['username'],$npass);
- Mikrotik::removeHotspotActiveUser($client,$user['username']);
+ Mikrotik::setHotspotUser($client, $c['username'], $npass);
+ Mikrotik::removeHotspotActiveUser($client, $user['username']);
}
- $d->password = $npass;
- $d->save();
+ $d->password = $npass;
+ $d->save();
- _msglog('s',$_L['Password_Changed_Successfully']);
- _log('['.$user['username'].']: Password changed successfully','User',$user['id']);
+ _msglog('s', $_L['Password_Changed_Successfully']);
+ _log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
- r2(U.'login');
-
- }else{
- if(!$config['radius_mode']){
+ r2(U . 'login');
+ } else {
+ if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::setPpoeUser($client,$c['username'],$npass);
- Mikrotik::removePpoeActive($client,$user['username']);
+ Mikrotik::setPpoeUser($client, $c['username'], $npass);
+ Mikrotik::removePpoeActive($client, $user['username']);
}
- $d->password = $npass;
- $d->save();
+ $d->password = $npass;
+ $d->save();
- _msglog('s',$_L['Password_Changed_Successfully']);
- _log('['.$user['username'].']: Password changed successfully','User',$user['id']);
+ _msglog('s', $_L['Password_Changed_Successfully']);
+ _log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
- r2(U.'login');
- }
- }else{
- $d->password = $npass;
- $d->save();
+ r2(U . 'login');
+ }
+ } else {
+ $d->password = $npass;
+ $d->save();
- _msglog('s',$_L['Password_Changed_Successfully']);
- _log('['.$user['username'].']: Password changed successfully','User',$user['id']);
+ _msglog('s', $_L['Password_Changed_Successfully']);
+ _log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
- r2(U.'login');
- }
-
- }else{
- r2(U.'accounts/change-password','e',$_L['Incorrect_Current_Password']);
+ r2(U . 'login');
+ }
+ } else {
+ r2(U . 'accounts/change-password', 'e', $_L['Incorrect_Current_Password']);
}
- }else{
- r2(U.'accounts/change-password','e',$_L['Incorrect_Current_Password']);
+ } else {
+ r2(U . 'accounts/change-password', 'e', $_L['Incorrect_Current_Password']);
}
- }else{
- r2(U.'accounts/change-password','e',$_L['Incorrect_Current_Password']);
+ } else {
+ r2(U . 'accounts/change-password', 'e', $_L['Incorrect_Current_Password']);
}
break;
case 'profile':
-
- $id = $_SESSION['uid'];
- $d = ORM::for_table('tbl_customers')->find_one($id);
- if($d){
+ $d = ORM::for_table('tbl_customers')->find_one($user['id']);
+ if ($d) {
run_hook('customer_view_edit_profile'); #HOOK
- $ui->assign('d',$d);
+ $ui->assign('d', $d);
$ui->display('user-profile.tpl');
- }else{
- r2(U . 'accounts/users', 'e', $_L['Account_Not_Found']);
+ } else {
+ r2(U . 'home', 'e', $_L['Account_Not_Found']);
}
break;
@@ -110,34 +108,33 @@ switch ($action) {
$phonenumber = _post('phonenumber');
run_hook('customer_edit_profile'); #HOOK
$msg = '';
- if(Validator::Length($fullname,31,2) == false){
- $msg .= 'Full Name should be between 3 to 30 characters'. '
';
+ if (Validator::Length($fullname, 31, 2) == false) {
+ $msg .= 'Full Name should be between 3 to 30 characters' . '
';
}
- if(Validator::UnsignedNumber($phonenumber) == false){
- $msg .= 'Phone Number must be a number'. '
';
- }
-
- $id = _post('id');
- $d = ORM::for_table('tbl_customers')->find_one($id);
- if($d){
- }else{
- $msg .= $_L['Data_Not_Found']. '
';
+ if (Validator::UnsignedNumber($phonenumber) == false) {
+ $msg .= 'Phone Number must be a number' . '
';
}
- if($msg == ''){
+ $d = ORM::for_table('tbl_customers')->find_one($user['id']);
+ if ($d) {
+ } else {
+ $msg .= $_L['Data_Not_Found'] . '
';
+ }
+
+ if ($msg == '') {
$d->fullname = $fullname;
- $d->address = $address;
- $d->email = $email;
- $d->phonenumber = $phonenumber;
+ $d->address = $address;
+ $d->email = $email;
+ $d->phonenumber = $phonenumber;
$d->save();
- _log('['.$user['username'].']: '.$_L['User_Updated_Successfully'],'User',$user['id']);
+ _log('[' . $user['username'] . ']: ' . $_L['User_Updated_Successfully'], 'User', $user['id']);
r2(U . 'accounts/profile', 's', $_L['User_Updated_Successfully']);
- }else{
+ } else {
r2(U . 'accounts/profile', 'e', $msg);
}
break;
default:
echo 'action not defined';
-}
\ No newline at end of file
+}
diff --git a/system/controllers/autoload_user.php b/system/controllers/autoload_user.php
new file mode 100644
index 00000000..4a02eca6
--- /dev/null
+++ b/system/controllers/autoload_user.php
@@ -0,0 +1,34 @@
+'.Lang::T('You are Online, Logout?').'');
+ } else {
+ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
+ die(''.Lang::T('Not Online, Login now?').'');
+ }else{
+ die(Lang::T('Your account not connected to internet'));
+ }
+ }
+ } else {
+ die('--');
+ }
+ break;
+ default:
+ echo 'action not defined';
+}
diff --git a/system/controllers/customers.php b/system/controllers/customers.php
index 21ea411f..3aabc72b 100644
--- a/system/controllers/customers.php
+++ b/system/controllers/customers.php
@@ -23,16 +23,26 @@ if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
switch ($action) {
case 'list':
$ui->assign('xfooter', '');
- $username = _post('username');
+ $search = _post('search');
+ $what = _post('what');
+ if(!in_array($what,['username','fullname','phonenumber','email'])){
+ $what = 'username';
+ }
run_hook('list_customers'); #HOOK
- if ($username != '') {
- $paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $username . '%');
- $d = ORM::for_table('tbl_customers')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
+ if ($search != '') {
+ $paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $search . '%');
+ $d = ORM::for_table('tbl_customers')
+ ->where_like($what, '%' . $search . '%')
+ ->offset($paginator['startpoint'])
+ ->limit($paginator['limit'])
+ ->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_customers');
$d = ORM::for_table('tbl_customers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
+ $ui->assign('search', htmlspecialchars($search));
+ $ui->assign('what', $what);
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('customers.tpl');
diff --git a/system/controllers/export.php b/system/controllers/export.php
index 5407afa3..ff175bf2 100644
--- a/system/controllers/export.php
+++ b/system/controllers/export.php
@@ -1,7 +1,8 @@
assign('_title', $_L['Reports']);
$ui->assign('_sysfrm_menu', 'reports');
@@ -16,7 +17,7 @@ $tdate = date('Y-m-d', strtotime('today - 30 days'));
//first day of month
$first_day_month = date('Y-m-01');
//
-$this_week_start = date('Y-m-d',strtotime( 'previous sunday'));
+$this_week_start = date('Y-m-d', strtotime('previous sunday'));
// 30 days before
$before_30_days = date('Y-m-d', strtotime('today - 30 days'));
//this month
@@ -36,51 +37,51 @@ switch ($action) {
$dr->order_by_desc('id');
$xy = $dr->sum('price');
- $ui->assign('d',$x);
- $ui->assign('dr',$xy);
- $ui->assign('mdate',$mdate);
- $ui->assign('recharged_on',$mdate);
+ $ui->assign('d', $x);
+ $ui->assign('dr', $xy);
+ $ui->assign('mdate', $mdate);
+ $ui->assign('recharged_on', $mdate);
run_hook('print_by_date'); #HOOK
$ui->display('print-by-date.tpl');
break;
case 'pdf-by-date':
- $mdate = date('Y-m-d');
+ $mdate = date('Y-m-d');
$d = ORM::for_table('tbl_transactions');
$d->where('recharged_on', $mdate);
$d->order_by_desc('id');
$x = $d->find_many();
- $dr = ORM::for_table('tbl_transactions');
+ $dr = ORM::for_table('tbl_transactions');
$dr->where('recharged_on', $mdate);
$dr->order_by_desc('id');
$xy = $dr->sum('price');
- $title = ' Reports ['.$mdate.']';
- $title = str_replace('-',' ',$title);
+ $title = ' Reports [' . $mdate . ']';
+ $title = str_replace('-', ' ', $title);
if ($x) {
$html = '
'.$_L['Username'].' | -'.$_L['Plan_Name'].' | -'.$_L['Type'].' | -'.$_L['Plan_Price'].' | -'.$_L['Created_On'].' | -'.$_L['Expires_On'].' | -'.$_L['Method'].' | -'.$_L['Routers'].' | +' . $_L['Username'] . ' | +' . $_L['Plan_Name'] . ' | +' . $_L['Type'] . ' | +' . $_L['Plan_Price'] . ' | +' . $_L['Created_On'] . ' | +' . $_L['Expires_On'] . ' | +' . $_L['Method'] . ' | +' . $_L['Routers'] . ' |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$username | $plan_name | $type | @@ -107,16 +108,13 @@ switch ($action) {
'.$_L['Username'].' | -'.$_L['Plan_Name'].' | -'.$_L['Type'].' | -'.$_L['Plan_Price'].' | -'.$_L['Created_On'].' | -'.$_L['Expires_On'].' | -'.$_L['Method'].' | -'.$_L['Routers'].' | +' . $_L['Username'] . ' | +' . $_L['Plan_Name'] . ' | +' . $_L['Type'] . ' | +' . $_L['Plan_Price'] . ' | +' . $_L['Created_On'] . ' | +' . $_L['Expires_On'] . ' | +' . $_L['Method'] . ' | +' . $_L['Routers'] . ' |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$username | $plan_name | $type | @@ -280,17 +277,17 @@ EOF;