Compare commits

...

51 Commits
5.3 ... 6.0

Author SHA1 Message Date
3f92e39185 Create FUNDING.yml 2022-09-16 14:00:22 +07:00
6c69dacdef Merge pull request #39 from ibnux/Development
- Add Router check before save
- Add Telegram Notification for Admin
- Username must phone number
- Add SMS and Whatsapp Notification, this will force user to validate their phone number
- Add Payment Gateway
- Enable and Disable Router/Plan
- Add Tawk.to chat support
2022-09-16 13:57:34 +07:00
1c18f6091d fix payment gateway and table 2022-09-16 11:38:03 +07:00
b6204a5f94 fix recharge 2022-09-16 11:19:53 +07:00
061224b469 plugin system for payment gateway 2022-09-16 11:05:33 +07:00
0bd6c9e3c7 add merge spanish lang 2022-09-15 11:51:02 +07:00
665e05deed Merge remote-tracking branch 'origin/master' into Development 2022-09-15 11:48:48 +07:00
3fa4282848 update README 2022-09-15 11:45:43 +07:00
4906768a02 Merge pull request #35 from alucard2303/patch-3
Update phpmixbill.sql for Spanish language
2022-09-14 19:11:16 +07:00
a860708a10 Merge pull request #34 from alucard2303/patch-2
Spanish language
2022-09-14 19:10:26 +07:00
cef6e2a2f6 Duitku ok 2022-09-14 16:54:29 +07:00
8a8c7f897f change to pg- and add duitku 2022-09-14 15:58:12 +07:00
48350941e9 add untranslated language 2022-09-11 11:04:41 +07:00
4067f3fa9a change table structure 2022-09-11 11:04:31 +07:00
3653fcbf87 fix history 2022-09-11 11:02:55 +07:00
9ca2933b5d get unpaid 2022-09-11 11:02:30 +07:00
98b592c8a9 fix wrong name 2022-09-11 11:02:21 +07:00
4d84efcf83 change menu, show history, show unpaid 2022-09-11 11:02:10 +07:00
9154c10c45 Lang class 2022-09-10 16:08:10 +07:00
a7fd02df12 order Button 2022-09-10 16:06:38 +07:00
4a6ea093c1 Payment Gateway Tripay done 2022-09-10 16:01:51 +07:00
5ce70b972b Drop Midtrans 2022-09-10 12:20:45 +07:00
71e8b8e22f midtrans succes paid, but will be drop 2022-09-10 12:17:38 +07:00
dd46273a04 midtrans pay, but not yet validated 2022-09-09 16:46:39 +07:00
e9d67ce220 make update script 2022-09-09 09:53:21 +07:00
46e534af6c without sales text 2022-09-08 17:11:15 +07:00
8d7b1c6ff0 xendit without callback OK 2022-09-08 17:09:21 +07:00
65666ac998 latest structure 2022-09-08 16:32:12 +07:00
99f9f73a70 dont show disabled plan and routers 2022-09-08 14:00:46 +07:00
6afcdfe1fa page Editor 2022-09-08 10:54:35 +07:00
4fa341d854 Enable disable router and plan 2022-09-08 10:43:46 +07:00
464f41ef16 Persiapan Radius Mode 2022-09-07 16:11:35 +07:00
19f79680ff Hashtag for telegram 2022-09-07 15:28:59 +07:00
6c64d0944f walled garden example 2022-09-07 15:09:56 +07:00
40d77bba7b add tawk to and example walled garden 2022-09-07 15:07:40 +07:00
b7394762b3 update tabel installer 2022-09-07 14:50:02 +07:00
a84095b13b SMS OTP registration 2022-09-07 14:44:20 +07:00
8b7001b5ef tripay pg and list channels 2022-09-07 14:44:04 +07:00
41aa9f74ea change template, no themes 2022-09-06 10:31:33 +07:00
deecd28cf7 set payment gateway 2022-09-06 10:31:22 +07:00
9dd85dc38e Change Header 2022-09-05 15:12:00 +07:00
e6eff99632 Minutes and Hour Plan Validity 2022-09-05 15:11:22 +07:00
ba83833e94 notif recharge to user 2022-09-02 15:44:22 +07:00
a0dc6c7274 notif to telegram 2022-09-01 15:35:54 +07:00
dd116ee248 Registration no need has voucher 2022-09-01 14:52:32 +07:00
719e7deb93 Update phpmixbill.sql 2022-08-28 19:34:44 -05:00
15ecd120e1 Create common.lan.php 2022-08-28 19:19:06 -05:00
eb3c84d333 change pages 2022-08-24 11:40:26 +07:00
6eaede3c6e Show error, and fix IP Port custom 2022-08-23 16:33:21 +07:00
90a08cb731 wrong hash default 2022-04-23 01:24:28 +07:00
5df998874a '/ppp/active/print' 2022-04-23 01:13:17 +07:00
239 changed files with 9868 additions and 6584 deletions

4
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,4 @@
# These are supported funding model platforms
github: ibnux
custom: ['https://paypal.me/ibnux','https://trakteer.id/ibnux']

3
.gitignore vendored
View File

@ -3,4 +3,5 @@ system/config.php
.vscode/
ui/compiled/*.php
ui/cache/*.php
test.php
test.php
pages/

View File

@ -1,83 +1,72 @@
# PHP Mikrotik Billing
----
![N|phpmixbill](http://4.bp.blogspot.com/-3OWL5OI7pqU/VjocUDdzMDI/AAAAAAAAAiA/s_XJN0_mDlk/s640/Screenshot_8.png)
## Feature
----
This project maintained by [@ibnux](https://twitter.com/ibnux)
Aplikasi ini dikelola oleh [@ibnux](https://twitter.com/ibnux)
----
Download [Mikrotik Login Template](https://github.com/ibnux/phpmixbill-mikrotik-login-template)
Features:
----
- Voucher Generator and Print
- Self registration, user must have voucher before registration
- Multi Router Mikrotik
- Hotspot & PPPOE
- Easy Installation
- Multi Language
- RADIUS
- Payment Gateway Midtrans, Xendit and Tripay
- SMS validation for login
- Whatsapp Notification to Consumer
- Telegram Notification for Admin
TODOS:
----
## Payment Gateway
- SMS Notification to user
- send receipt via SMS or EMAIL
- Social Media Login
- Tripay.com | Indonesia
- Xendit.com | Indonesia and Philippine ( Philippine not tested )
- Duitku.com | Indonesia
## Installation
- Rename **pages_template** to **pages**
- make writeable **system** folder or create file **system/config.php** and make it writeable
- make writeable folder **ui/cache/** and **ui/compiled**
- Open webs and run installation
- set cronjobs or scheduller for **system/cron.php**
Radius system need to set radius to use **system/radius.php** you can ask me for paid support.
Installation
----
See [WIKI](https://github.com/ibnux/phpmixbill/wiki/Instalation)
baca [WIKI](https://github.com/ibnux/phpmixbill/wiki/Instalation)
System Requirements
----
## System Requirements
Most current web servers with PHP & MySQL installed will be capable of running PHPMixBill
Minimum Requirements
- Linux or Windows OS
- PHP Version 5.3+
- PHP Version 7.0+
- Both PDO & MySQLi Support
- GD2 Image Library
- CURL support
- MySQL Version 4.1.x and above
can be Installed in Raspberry Pi Device.
The problem with windows is hard to set cronjob, better Linux
JASA
----
Terima jasa instalasi PHPMIXBILL beserta mikrotiknya.
## Paid Support
Via Team Viewer maupun Barang dibeli dari saya dan tinggal pakai.
Start from Rp 500.000 or $50
1. Unit Mikrotik Router
2. Raspberry Pi Server (RasPi + Casing + Memory 4GB + Adaptor)
[Telegram](https://t.me/ibnux)
Jasa kurang lebih Rp. 500.000, belum termasuk ongkir dan harga perangkat, Gratis Tanya Jawab via Messenger (Jika lagi senggang).
[Website](https://ibnux.net/layanan)
hubungi ibnux di [Twitter](https://twitter.com/ibnux) atau di [facebook](https://facebook.com/ibnumaksum)
License
----
## License
GNU General Public License version 2 or later
see LICENSE file
## Donate to ibnux
Donate to ibnux
----
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6RBNGRJMZVV7C)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/ibnux)
BCA: 5410454825

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
header('location: ../index.php?_route=admin/');

View File

@ -41,7 +41,7 @@
<div class="btn-group btn-group-justified" role="group">
<a href="https://github.com/ibnux/phpmixbill/releases" class="btn btn-primary">Download</a>
<a href="https://github.com/ibnux/phpmixbill" class="btn btn-success">Source</a>
<a href="https://ibnux.github.io/phpmixbill/diskusi.html" class="btn btn-info">Disquss</a>
<a href="https://github.com/ibnux/phpmixbill/discussions" class="btn btn-info">Discussions</a>
</div>
</div>

View File

@ -1,14 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
require ('system/boot.php');
App::_run();

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
Class Admin{

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
Class App{

43
system/autoload/Http.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
class Http
{
public static function getData($url, $headers)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
return $server_output;
}
public static function postJsonData($url, $array_post, $headers = [], $basic = null)
{
$headers[] = 'Content-Type: application/json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLINFO_HEADER_OUT, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($array_post));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if (!empty($basic)) {
curl_setopt($ch, CURLOPT_USERPWD, $basic);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
return $server_output;
}
}

11
system/autoload/Lang.php Normal file
View File

@ -0,0 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
class Lang {
public static function T($var) {
return Lang($var);
}
}

386
system/autoload/Package.php Normal file
View File

@ -0,0 +1,386 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
use PEAR2\Net\RouterOS;
class Package
{
/**
* @param int $id_customer String user identifier
* @param string $router_name router name for this package
* @param int $plan_id plan id for this package
* @param string $gateway payment gateway name
* @param string $channel channel payment gateway
* @return boolean
*/
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
{
global $_c, $_L;
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
if ($id_customer == '' or $router_name == '' or $plan_id == '') {
return false;
}
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
$mikrotik = Router::_info($router_name);
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' day'));
} else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime('+' . $p['validity'] . ' hour')));
$date_exp = $datetime[0];
$time = $datetime[1];
} else if ($p['validity_unit'] == 'Mins') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime('+' . $p['validity'] . ' minute')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
if ($p['type'] == 'Hotspot') {
if ($b) {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
}
$b->customer_id = $id_customer;
$b->username = $c['username'];
$b->plan_id = $plan_id;
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "$gateway - $channel";
$b->routers = $router_name;
$b->type = "Hotspot";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
$t->routers = $router_name;
$t->type = "Hotspot";
$t->save();
} else {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $id_customer;
$d->username = $c['username'];
$d->plan_id = $plan_id;
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "$gateway - $channel";
$d->routers = $router_name;
$d->type = "Hotspot";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
$t->routers = $router_name;
$t->type = "Hotspot";
$t->save();
}
sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . $p['price']);
} else {
if ($b) {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$b->customer_id = $id_customer;
$b->username = $c['username'];
$b->plan_id = $plan_id;
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "$gateway - $channel";
$b->routers = $router_name;
$b->type = "PPPOE";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
$t->routers = $router_name;
$t->type = "PPPOE";
$t->save();
} else {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $id_customer;
$d->username = $c['username'];
$d->plan_id = $plan_id;
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "$gateway - $channel";
$d->routers = $router_name;
$d->type = "PPPOE";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
$t->routers = $router_name;
$t->type = "PPPOE";
$t->save();
}
sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . $p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n" .
"$_c[address]\n" .
"$_c[phone]\n" .
"\n\n" .
"INVOICE: *$in[invoice]*\n" .
"$_L[Date] : $date_now\n" .
"$gateway $channel\n" .
"\n\n" .
"$_L[Type] : *$in[type]*\n" .
"$_L[Plan_Name] : *$in[plan_name]*\n" .
"$_L[Plan_Price] : *$_c[currency_code] " . number_format($in['price'], 2, $_c['dec_point'], $_c['thousands_sep']) . "*\n\n" .
"$_L[Username] : *$in[username]*\n" .
"$_L[Password] : **********\n\n" .
"$_L[Created_On] :\n*" . date($_c['date_format'], strtotime($in['recharged_on'])) . " $in[time]*\n" .
"$_L[Expires_On] :\n*" . date($_c['date_format'], strtotime($in['expiration'])) . " $in[time]*\n" .
"\n\n" .
"$_c[note]");
return true;
}
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
Class Paginator

View File

@ -3,10 +3,6 @@
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
class Password

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
Class Router{

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
class Timezone {

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
Class User{

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
/**

View File

@ -3,10 +3,6 @@
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
session_start();
function r2($to, $ntype = 'e', $msg = '')
@ -51,6 +47,7 @@ function _get($param, $defvalue = '')
}
}
require('system/orm.php');
ORM::configure("mysql:host=$db_host;dbname=$db_name");
@ -75,15 +72,16 @@ function _notify($msg, $type = 'e')
}
require_once('system/vendors/smarty/libs/Smarty.class.php');
$_theme = APP_URL . '/ui/theme/' . $config['theme'];
$_theme = APP_URL . '/ui/ui';
$lan_file = 'system/lan/' . $config['language'] . '/common.lan.php';
require($lan_file);
$ui = new Smarty();
$ui->setTemplateDir('ui/theme/' . $config['theme'] . '/');
$ui->setTemplateDir('ui/ui/');
$ui->setCompileDir('ui/compiled/');
$ui->setConfigDir('ui/conf/');
$ui->setCacheDir('ui/cache/');
$ui->assign('app_url', APP_URL);
$ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL,PHP_URL_HOST)));
define('U', APP_URL . '/index.php?_route=');
$ui->assign('_url', APP_URL . '/index.php?_route=');
$ui->assign('_theme', $_theme);
@ -179,6 +177,60 @@ function _log($description, $type = '', $userid = '0')
$d->save();
}
function Lang($key){
global $_L,$lan_file;
if(!empty($_L[$key])){
return $_L[$key];
}
$val = $key;
$key = alphanumeric($key," ");
if(!empty($_L[$key])){
return $_L[$key];
}else if(!empty($_L[str_replace(' ','_',$key)])){
return $_L[str_replace(' ','_',$key)];
}else{
$key = str_replace(' ','_',$key);
file_put_contents($lan_file, "$"."_L['$key'] = '".addslashes($val)."';\n", FILE_APPEND);
return $val;
}
}
function alphanumeric($str, $tambahan = "")
{
return preg_replace("/[^a-zA-Z0-9" . $tambahan . "]+/", "", $str);
}
function sendTelegram($txt)
{
global $_c;
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));
}
}
function sendSMS($phone, $txt)
{
global $_c;
if(!empty($_c['sms_url'])){
$smsurl = str_replace('[number]',urlencode($phone),$_c['sms_url']);
$smsurl = str_replace('[text]',urlencode($txt),$smsurl);
file_get_contents($smsurl);
}
}
function sendWhatsapp($phone, $txt)
{
global $_c;
if(!empty($_c['wa_url'])){
$waurl = str_replace('[number]',urlencode($phone),$_c['wa_url']);
$waurl = str_replace('[text]',urlencode($txt),$waurl);
file_get_contents($waurl);
}
}
function time_elapsed_string($datetime, $full = false)
{
$now = new DateTime;
@ -220,5 +272,26 @@ $sys_render = 'system/controllers/' . $handler . '.php';
if (file_exists($sys_render)) {
include($sys_render);
} else {
exit("$sys_render");
header("HTTP/1.0 404 Not Found");
exit("<pre>
___ ___ ___
| | | | | |
|_ | | |_ |
|_|___| |_|
_____ _ _____ _
| | |___| |_ | __|___ _ _ ___ _| |
| | | | . | _| | __| . | | | | . |
|_|___|___|_| |__| |___|___|_|_|___|
_ ______ ____ _____ ____ ____
(_) |_ _ \ |_ \|_ _| |_ _||_ _|
__ | |_) | | \ | | __ _ \ \ / /
[ | | __'. | |\ \| | [ | | | > `' <
| | _| |__) |_| |_\ |_ | \_/ |, _/ /'`\ \_
[___]|_______/|_____|\____|'.__.'_/|____||____|
</pre>");
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_auth();
$ui->assign('_title', $_L['My_Account'].'- '. $config['CompanyName']);
@ -19,7 +14,7 @@ use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'change-password':
$ui->display('user-change-password.tpl');
break;
@ -32,7 +27,7 @@ switch ($action) {
$d_pass = $d['password'];
$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');
@ -45,83 +40,87 @@ switch ($action) {
if ($c){
$mikrotik = Router::_info($c['routers']);
if($c['type'] == 'Hotspot'){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $npass);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $user['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $npass);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $user['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$d->password = $npass;
$d->save();
_msglog('s',$_L['Password_Changed_Successfully']);
_log('['.$user['username'].']: Password changed successfully','User',$user['id']);
r2(U.'login');
}else{
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $npass);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}else{
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $npass);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$d->password = $npass;
$d->save();
_msglog('s',$_L['Password_Changed_Successfully']);
_log('['.$user['username'].']: Password changed successfully','User',$user['id']);
r2(U.'login');
}
}else{
$d->password = $npass;
$d->save();
_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']);
}
@ -134,7 +133,7 @@ switch ($action) {
break;
case 'profile':
$id = $_SESSION['uid'];
$d = ORM::for_table('tbl_customers')->find_one($id);
if($d){
@ -157,7 +156,7 @@ switch ($action) {
if(Validator::UnsignedNumber($phonenumber) == false){
$msg .= 'Phone Number must be a number'. '<br>';
}
$id = _post('id');
$d = ORM::for_table('tbl_customers')->find_one($id);
if($d){
@ -170,14 +169,14 @@ switch ($action) {
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->save();
_log('['.$user['username'].']: '.$_L['User_Updated_Successfully'],'User',$user['id']);
r2(U . 'accounts/profile', 's', $_L['User_Updated_Successfully']);
}else{
r2(U . 'accounts/profile', 'e', $msg);
}
break;
default:
echo 'action not defined';
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
if (isset($routes['1'])) {
$do = $routes['1'];

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
@ -20,26 +15,26 @@ switch ($action) {
$routers = _get('routers');
$d = ORM::for_table('tbl_pool')->where('routers', $routers)->find_many();
$ui->assign('d',$d);
$ui->display('autoload-pool.tpl');
break;
case 'server':
$d = ORM::for_table('tbl_routers')->find_many();
$d = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('d',$d);
$ui->display('autoload-server.tpl');
break;
case 'plan':
$server = _post('server');
$jenis = _post('jenis');
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->find_many();
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->where('enabled', '1')->find_many();
$ui->assign('d',$d);
$ui->display('autoload.tpl');
break;
default:
echo 'action not defined';
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Bandwidth_Plans'].' - '. $config['CompanyName']);
@ -22,7 +17,7 @@ if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/bandwidth.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_bandwidth','name_bw','%'.$name.'%');
@ -31,7 +26,7 @@ switch ($action) {
$paginator = Paginator::bootstrap('tbl_bandwidth');
$d = ORM::for_table('tbl_bandwidth')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->display('bandwidth.tpl');
@ -67,12 +62,12 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
$msg = '';
if(Validator::Length($name,16,4) == false){
$msg .= 'Name should be between 5 to 15 characters'. '<br>';
}
if($rate_down_unit == 'Kbps'){ $unit_rate_down = $rate_down * 1024; }else{ $unit_rate_down = $rate_down * 1048576; }
if($rate_up_unit == 'Kbps'){ $unit_rate_up = $min_up * 1024; }else{ $unit_rate_up = $min_up * 1048576; }
@ -89,7 +84,7 @@ switch ($action) {
$d->rate_up = $rate_up;
$d->rate_up_unit = $rate_up_unit;
$d->save();
r2(U . 'bandwidth/list', 's', $_L['Created_Successfully']);
}else{
r2(U . 'bandwidth/add', 'e', $msg);
@ -129,7 +124,7 @@ switch ($action) {
$d->rate_up = $rate_up;
$d->rate_up_unit = $rate_up_unit;
$d->save();
r2(U . 'bandwidth/list', 's', $_L['Updated_Successfully']);
}else{
r2(U . 'bandwidth/edit/'.$id, 'e', $msg);

View File

@ -0,0 +1,28 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_auth();
$ui->assign('_system_menu', 'order');
$action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
require('system/autoload/Paymentgateway.php');
require('system/autoload/Recharge.php');
switch ($action) {
case 'xendit':
echo "done";
break;
case 'midtrans':
echo "done";
break;
case 'tripay':
echo '{"success": true}';
break;
default:
echo "not found";
}

View File

@ -0,0 +1,13 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_auth();
$ui->assign('_title', 'Community - '. $config['CompanyName']);
$ui->assign('_system_menu', 'community');
$action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
$ui->display('community.tpl');

View File

@ -1,14 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
**/
_admin();
$ui->assign('_title', $_L['Customers'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Customers'] . ' - ' . $config['CompanyName']);
$ui->assign('_system_menu', 'customers');
$action = $routes['1'];
@ -16,26 +13,27 @@ $admin = Admin::_info();
$ui->assign('_admin', $admin);
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/customers.js"></script>');
$username = _post('username');
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();
}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('d',$d);
$ui->assign('paginator',$paginator);
$username = _post('username');
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();
} 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('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('customers.tpl');
break;
@ -46,10 +44,10 @@ switch ($action) {
case 'edit':
$id = $routes['2'];
$d = ORM::for_table('tbl_customers')->find_one($id);
if($d){
$ui->assign('d',$d);
if ($d) {
$ui->assign('d', $d);
$ui->display('customers-edit.tpl');
}else{
} else {
r2(U . 'customers/list', 'e', $_L['Account_Not_Found']);
}
break;
@ -58,76 +56,84 @@ switch ($action) {
$id = $routes['2'];
$d = ORM::for_table('tbl_customers')->find_one($id);
if($d){
$c = ORM::for_table('tbl_user_recharges')->where('username',$d['username'])->find_one();
if ($c){
$mikrotik = Router::_info($c['routers']);
if($c['type'] == 'Hotspot'){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
if ($d) {
$c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one();
if ($c) {
$mikrotik = Router::_info($c['routers']);
if ($c['type'] == 'Hotspot') {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}else{
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
}
try {
$d->delete();
} catch (Exception $e) {
}
try {
$c->delete();
} catch (Exception $e) {
}
} else {
try {
$d->delete();
} catch (Exception $e) {
}
try {
$c->delete();
} catch (Exception $e) {
}
}
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
try{
$d->delete();
}catch(Exception $e){}
try{
$c->delete();
}catch(Exception $e){}
}else{
try{
$d->delete();
}catch(Exception $e){}
try{
$c->delete();
}catch(Exception $e){}
}
r2(U . 'customers/list', 's', $_L['User_Delete_Ok']);
}
break;
@ -138,38 +144,37 @@ switch ($action) {
$password = _post('password');
$cpassword = _post('cpassword');
$address = _post('address');
$phonenumber = _post('phonenumber');
$phonenumber = _post('phonenumber');
$msg = '';
if(Validator::Length($username,35,2) == false){
$msg .= 'Username should be between 3 to 55 characters'. '<br>';
if (Validator::Length($username, 35, 2) == false) {
$msg .= 'Username should be between 3 to 55 characters' . '<br>';
}
if(Validator::Length($fullname,36,2) == false){
$msg .= 'Full Name should be between 3 to 25 characters'. '<br>';
if (Validator::Length($fullname, 36, 2) == false) {
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
}
if(!Validator::Length($password,35,2)){
$msg .= 'Password should be between 3 to 35 characters'. '<br>';
if (!Validator::Length($password, 35, 2)) {
$msg .= 'Password should be between 3 to 35 characters' . '<br>';
}
if($password != $cpassword){
$msg .= 'Passwords does not match'. '<br>';
if ($password != $cpassword) {
$msg .= 'Passwords does not match' . '<br>';
}
$d = ORM::for_table('tbl_customers')->where('username',$username)->find_one();
if($d){
$msg .= $_L['account_already_exist']. '<br>';
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if ($d) {
$msg .= $_L['account_already_exist'] . '<br>';
}
if($msg == ''){
if ($msg == '') {
$d = ORM::for_table('tbl_customers')->create();
$d->username = $username;
$d->password = $password;
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->phonenumber = $username;
$d->save();
r2(U . 'customers/list', 's', $_L['account_created_successfully']);
}else{
} else {
r2(U . 'customers/add', 'e', $msg);
}
break;
@ -180,126 +185,128 @@ switch ($action) {
$password = _post('password');
$cpassword = _post('cpassword');
$address = _post('address');
$phonenumber = _post('phonenumber');
$phonenumber = _post('phonenumber');
$msg = '';
if(Validator::Length($username,16,2) == false){
$msg .= 'Username should be between 3 to 15 characters'. '<br>';
if (Validator::Length($username, 16, 2) == false) {
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
}
if(Validator::Length($fullname,26,2) == false){
$msg .= 'Full Name should be between 3 to 25 characters'. '<br>';
if (Validator::Length($fullname, 26, 2) == false) {
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
}
if($password != ''){
if(!Validator::Length($password,15,2)){
$msg .= 'Password should be between 3 to 15 characters'. '<br>';
if ($password != '') {
if (!Validator::Length($password, 15, 2)) {
$msg .= 'Password should be between 3 to 15 characters' . '<br>';
}
if($password != $cpassword){
$msg .= 'Passwords does not match'. '<br>';
if ($password != $cpassword) {
$msg .= 'Passwords does not match' . '<br>';
}
}
$id = _post('id');
$d = ORM::for_table('tbl_customers')->find_one($id);
if($d){
}else{
$msg .= $_L['Data_Not_Found']. '<br>';
if (!$d) {
$msg .= $_L['Data_Not_Found'] . '<br>';
}
if($d['username'] != $username){
$c = ORM::for_table('tbl_customers')->where('username',$username)->find_one();
if($c){
$msg .= $_L['account_already_exist']. '<br>';
if ($d['username'] != $username) {
$c = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if ($c) {
$msg .= $_L['account_already_exist'] . '<br>';
}
}
if($msg == ''){
$c = ORM::for_table('tbl_user_recharges')->where('username',$username)->find_one();
if ($c){
$mikrotik = Router::_info($c['routers']);
if($c['type'] == 'Hotspot'){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $password);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
if ($msg == '') {
$c = ORM::for_table('tbl_user_recharges')->where('username', $username)->find_one();
if ($c) {
$mikrotik = Router::_info($c['routers']);
if ($c['type'] == 'Hotspot') {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
$d->password = $password;
$d->save();
}else{
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $password);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $password);
$client->sendSync($setRequest);
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
$d->password = $password;
$d->save();
}
$d->username = $username;
if($password != ''){
$d->password = $password;
}
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->save();
}else{
$d->username = $username;
if($password != ''){
$d->password = $password;
}
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->save();
}
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$d->password = $password;
$d->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $password);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$d->password = $password;
$d->save();
}
$d->username = $username;
if ($password != '') {
$d->password = $password;
}
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->save();
} else {
$d->username = $username;
if ($password != '') {
$d->password = $password;
}
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
$d->save();
}
r2(U . 'customers/list', 's', 'User Updated Successfully');
}else{
r2(U . 'customers/edit/'.$id, 'e', $msg);
} else {
r2(U . 'customers/edit/' . $id, 'e', $msg);
}
break;
default:
echo 'action not defined';
}
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Dashboard'].' - '. $config['CompanyName']);

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
r2(APP_URL.'/index.php?_route=dashboard');

View File

@ -1,23 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* Ibnu Maksum <me@ibnux.net>
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @donate PayPal: me@ibnux.net
**/
_admin();
$ui->assign('_title', 'Disquss - '. $config['CompanyName']);
$ui->assign('_system_menu', 'disquss');
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
}
switch ($action) {
default:
$ui->display('disquss.tpl');
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Reports'].'- '. $config['CompanyName']);
@ -35,12 +30,12 @@ switch ($action) {
$d->where('recharged_on', $mdate);
$d->order_by_desc('id');
$x = $d->find_many();
$dr = ORM::for_table('tbl_transactions');
$dr->where('recharged_on', $mdate);
$dr->order_by_desc('id');
$xy = $dr->sum('price');
$ui->assign('d',$x);
$ui->assign('dr',$xy);
$ui->assign('mdate',$mdate);
@ -48,20 +43,20 @@ switch ($action) {
$ui->display('print-by-date.tpl');
break;
case 'pdf-by-date':
$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->where('recharged_on', $mdate);
$dr->order_by_desc('id');
$xy = $dr->sum('price');
$title = ' Reports ['.$mdate.']';
$title = str_replace('-',' ',$title);
@ -89,7 +84,7 @@ switch ($action) {
</tr>';
$c = true;
foreach ($x as $value) {
$username = $value['username'];
$plan_name = $value['plan_name'];
$type = $value['type'];
@ -135,7 +130,7 @@ switch ($action) {
#address { width: 300px; float: left; }
#logo { text-align: right; float: right; position: relative; margin-top: 15px; border: 5px solid #fff; overflow: hidden; }
#customers
{
font-family: Helvetica, sans-serif;
@ -176,31 +171,31 @@ EOF;
}
break;
case 'print-by-period':
$fdate = _post('fdate');
$tdate = _post('tdate');
$stype = _post('stype');
$d = ORM::for_table('tbl_transactions');
if ($stype != ''){
$d->where('type', $stype);
}
$d->where_gte('recharged_on', $fdate);
$d->where_lte('recharged_on', $tdate);
$d->order_by_desc('id');
$x = $d->find_many();
$dr = ORM::for_table('tbl_transactions');
if ($stype != ''){
$dr->where('type', $stype);
}
$dr->where_gte('recharged_on', $fdate);
$dr->where_lte('recharged_on', $tdate);
$xy = $dr->sum('price');
$ui->assign('d',$x);
$ui->assign('dr',$xy);
$ui->assign('fdate',$fdate);
@ -209,28 +204,28 @@ EOF;
$ui->display('print-by-period.tpl');
break;
case 'pdf-by-period':
$fdate = _post('fdate');
$tdate = _post('tdate');
$stype = _post('stype');
$d = ORM::for_table('tbl_transactions');
if ($stype != ''){
$d->where('type', $stype);
}
$d->where_gte('recharged_on', $fdate);
$d->where_lte('recharged_on', $tdate);
$d->order_by_desc('id');
$x = $d->find_many();
$dr = ORM::for_table('tbl_transactions');
if ($stype != ''){
$dr->where('type', $stype);
}
$dr->where_gte('recharged_on', $fdate);
$dr->where_lte('recharged_on', $tdate);
$xy = $dr->sum('price');
@ -262,7 +257,7 @@ EOF;
</tr>';
$c = true;
foreach ($x as $value) {
$username = $value['username'];
$plan_name = $value['plan_name'];
$type = $value['type'];
@ -308,7 +303,7 @@ EOF;
#address { width: 300px; float: left; }
#logo { text-align: right; float: right; position: relative; margin-top: 15px; border: 5px solid #fff; overflow: hidden; }
#customers
{
font-family: Helvetica, sans-serif;
@ -349,7 +344,7 @@ EOF;
}
break;
default:
echo 'action not defined';
}

View File

@ -1,14 +1,10 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_auth();
$ui->assign('_title', $_L['Dashboard'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Dashboard'] . ' - ' . $config['CompanyName']);
$user = User::_info();
$ui->assign('_user', $user);
@ -17,4 +13,10 @@ $ui->assign('_user', $user);
$bill = User::_billing();
$ui->assign('_bill', $bill);
$ui->display('user-dashboard.tpl');
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one());
$ui->display('user-dashboard.tpl');

View File

@ -1,12 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
**/
if (isset($routes['1'])) {
$do = $routes['1'];
@ -14,33 +11,33 @@ if (isset($routes['1'])) {
$do = 'login-display';
}
switch($do){
switch ($do) {
case 'post':
$username = _post('username');
$password = _post('password');
if($username != '' AND $password != ''){
$d = ORM::for_table('tbl_customers')->where('username',$username)->find_one();
if($d){
$d_pass = $d['password'];
if(Password::_uverify($password,$d_pass) == true){
$_SESSION['uid'] = $d['id'];
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username .' '. $_L['Login_Successful'],'User',$d['id']);
r2(U.'home');
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
_log($username .' '. $_L['Failed_Login'],'User');
r2(U.'login');
}
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
r2(U.'login');
}
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
r2(U.'login');
}
$username = _post('username');
$password = _post('password');
if ($username != '' and $password != '') {
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if ($d) {
$d_pass = $d['password'];
if (Password::_uverify($password, $d_pass) == true) {
$_SESSION['uid'] = $d['id'];
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username . ' ' . $_L['Login_Successful'], 'User', $d['id']);
r2(U . 'home');
} else {
_msglog('e', $_L['Invalid_Username_or_Password']);
_log($username . ' ' . $_L['Failed_Login'], 'User');
r2(U . 'login');
}
} else {
_msglog('e', $_L['Invalid_Username_or_Password']);
r2(U . 'login');
}
} else {
_msglog('e', $_L['Invalid_Username_or_Password']);
r2(U . 'login');
}
break;
@ -52,4 +49,3 @@ switch($do){
$ui->display('login.tpl');
break;
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
if (session_status() == PHP_SESSION_NONE) session_start();
session_destroy();

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Private_Message'].'- '. $config['CompanyName']);

View File

@ -0,0 +1,159 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_auth();
$ui->assign('_system_menu', 'order');
$action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
switch ($action) {
case 'voucher':
$ui->assign('_title', $_L['Order_Voucher'] . ' - ' . $config['CompanyName']);
$ui->display('user-order.tpl');
break;
case 'history':
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_many();
$paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
$ui->assign('paginator', $paginator);
$ui->assign('d', $d);
$ui->assign('_title', Lang::T('Order History') . ' - ' . $config['CompanyName']);
$ui->display('user-orderHistory.tpl');
break;
case 'package':
$ui->assign('_title', 'Order PPOE Internet - ' . $config['CompanyName']);
$routers = ORM::for_table('tbl_routers')->find_many();
$plans = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('routers', $routers);
$ui->assign('plans', $plans);
$ui->display('user-orderPackage.tpl');
break;
case 'unpaid':
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
if ($d) {
if (empty($d['pg_url_payment'])) {
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));
} else {
r2(U . "order/view/" . $d['id'] . '/check/', 's', Lang::T("You have unpaid transaction"));
}
} else {
r2(U . "order/package/", 's', Lang::T("You have no unpaid transaction"));
}
case 'view':
$trxid = $routes['2'] * 1;
$trx = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_one($trxid);
// jika tidak ditemukan, berarti punya orang lain
if (empty($trx)) {
r2(U . "order/package", 'w', Lang::T("Payment not found"));
}
// jika url kosong, balikin ke buy
if (empty($trx['pg_url_payment'])) {
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));
}
if ($routes['3'] == 'check') {
if (!file_exists('system/paymentgateway/' . $trx['gateway'] . '.php')) {
r2(U . 'order/view/' . $trxid, 'e', Lang::T("No Payment Gateway Available"));
}
include 'system/paymentgateway/' . $trx['gateway'] . '.php';
call_user_func($trx['gateway'] . '_validate_config');
call_user_func($_c['payment_gateway'] . '_get_status', $trx, $user);
} else if ($routes['3'] == 'cancel') {
$trx->pg_paid_response = '{}';
$trx->status = 4;
$trx->paid_date = date('Y-m-d H:i:s');
$trx->save();
$trx = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_one($trxid);
if ('midtrans' == $trx['gateway']) {
//Hapus invoice link
}
}
if (empty($trx)) {
r2(U . "home", 'e', Lang::T("Transaction Not found"));
}
$router = ORM::for_table('tbl_routers')->find_one($trx['routers_id']);
$plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']);
$bandw = ORM::for_table('tbl_bandwidth')->find_one($plan['id_bw']);
$ui->assign('trx', $trx);
$ui->assign('router', $router);
$ui->assign('plan', $plan);
$ui->assign('bandw', $bandw);
$ui->assign('_title', 'TRX #' . $trxid . ' - ' . $config['CompanyName']);
$ui->display('user-orderView.tpl');
break;
case 'buy':
if ($_c['payment_gateway'] == 'none') {
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
}
if (!file_exists('system/paymentgateway/' . $_c['payment_gateway'] . '.php')) {
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
}
include 'system/paymentgateway/' . $_c['payment_gateway'] . '.php';
call_user_func($_c['payment_gateway'] . '_validate_config');
$router = ORM::for_table('tbl_routers')->where('enabled', '1')->find_one($routes['2'] * 1);
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3'] * 1);
if (empty($router) || empty($plan)) {
r2(U . $back, 'e', Lang::T("Plan Not found"));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
if ($d) {
if ($d['pg_url_payment']) {
r2(U . "order/view/" . $d['id'], 'w', Lang::T("You already have unpaid transaction, cancel it or pay it."));
} else {
if ($_c['payment_gateway'] == $d['gateway']) {
$id = $d['id'];
} else {
$d->status = 4;
$d->save();
}
}
}
if (empty($id)) {
$d = ORM::for_table('tbl_payment_gateway')->create();
$d->username = $user['username'];
$d->gateway = $_c['payment_gateway'];
$d->plan_id = $plan['id'];
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
$d->routers = $router['name'];
$d->price = $plan['price'];
$d->created_date = date('Y-m-d H:i:s');
$d->status = 1;
$d->save();
$id = $d->id();
} else {
$d->username = $user['username'];
$d->gateway = $_c['payment_gateway'];
$d->plan_id = $plan['id'];
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
$d->routers = $router['name'];
$d->price = $plan['price'];
$d->created_date = date('Y-m-d H:i:s');
$d->status = 1;
$d->save();
}
if (!$id) {
r2(U . "order/package/" . $d['id'], 'e', Lang::T("Failed to create Transaction.."));
} else {
call_user_func($_c['payment_gateway'] . '_create_transaction', $d, $user);
}
break;
default:
$ui->display('404.tpl');
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_auth();
$ui->assign('_title', $_L['Order_Voucher'].'- '. $config['CompanyName']);

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', 'Pages - '. $config['CompanyName']);

View File

@ -0,0 +1,55 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_admin();
$ui->assign('_system_menu', 'paymentgateway');
$action = alphanumeric($routes['1']);
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if(file_exists('system/paymentgateway/'.$action.'.php')){
include 'system/paymentgateway/'.$action.'.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if(function_exists($action.'_save_config')){
call_user_func($action.'_save_config');
}else{
$ui->display('a404.tpl');
}
}else{
if(function_exists($action.'_show_config')){
call_user_func($action.'_show_config');
}else{
$ui->display('a404.tpl');
}
}
}else{
if(!empty($action)){
r2(U . 'paymentgateway', 'w', Lang::T('Payment Gateway Not Found'));
}else{
$files = scandir('system/paymentgateway/');
foreach($files as $file){
if(pathinfo($file, PATHINFO_EXTENSION)=='php'){
$pgs[] = str_replace('.php','',$file);
}
}
if(isset($_POST['payment_gateway'])){
$payment_gateway = _post('payment_gateway');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'payment_gateway')->find_one();
if($d){
$d->value = $payment_gateway;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'payment_gateway';
$d->value = $payment_gateway;
$d->save();
}
r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway saved successfully'));
}
$ui->assign('_title', 'Payment Gateway Settings - '. $config['CompanyName']);
$ui->assign('pgs', $pgs);
$ui->display('paymentgateway.tpl');
}
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_auth();
$ui->assign('_title', $_L['Private_Message'].'- '. $config['CompanyName']);

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
@ -25,7 +20,7 @@ require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pool.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_pool','pool_name','%'.$name.'%');
@ -34,7 +29,7 @@ switch ($action) {
$paginator = Paginator::bootstrap('tbl_pool');
$d = ORM::for_table('tbl_pool')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->display('pool.tpl');
@ -43,7 +38,7 @@ switch ($action) {
case 'add':
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r',$r);
$ui->display('pool-add.tpl');
break;
@ -64,24 +59,27 @@ switch ($action) {
$d = ORM::for_table('tbl_pool')->find_one($id);
$mikrotik = Router::_info($d['routers']);
if($d){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $d['pool_name'])
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/pool/remove');
$client($removeRequest
->setArgument('numbers', $poolName)
);
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $d['pool_name'])
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/pool/remove');
$client($removeRequest
->setArgument('numbers', $poolName)
);
}
$d->delete();
r2(U . 'pool/list', 's', $_L['Delete_Successfully']);
}
break;
@ -90,7 +88,7 @@ switch ($action) {
$name = _post('name');
$ip_address = _post('ip_address');
$routers = _post('routers');
$msg = '';
if(Validator::Length($name,30,2) == false){
$msg .= 'Name should be between 3 to 30 characters'. '<br>';
@ -98,30 +96,33 @@ switch ($action) {
if ($ip_address == '' OR $routers == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_pool')->where('pool_name',$name)->find_one();
if($d){
$msg .= $_L['Pool_already_exist']. '<br>';
}
$mikrotik = Router::_info($routers);
if($msg == ''){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$addRequest = new RouterOS\Request('/ip/pool/add');
$client->sendSync($addRequest
->setArgument('name', $name)
->setArgument('ranges', $ip_address)
);
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ip/pool/add');
$client->sendSync($addRequest
->setArgument('name', $name)
->setArgument('ranges', $ip_address)
);
}
$b = ORM::for_table('tbl_pool')->create();
$b->pool_name = $name;
$b->range_ip = $ip_address;
$b->routers = $routers;
$b->save();
r2(U . 'pool/list', 's', $_L['Created_Successfully']);
}else{
r2(U . 'pool/add', 'e', $msg);
@ -149,31 +150,34 @@ switch ($action) {
}else{
$msg .= $_L['Data_Not_Found']. '<br>';
}
$mikrotik = Router::_info($routers);
if($msg == ''){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/pool/set');
$client($setRequest
->setArgument('numbers', $poolName)
->setArgument('ranges', $ip_address)
);
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/pool/set');
$client($setRequest
->setArgument('numbers', $poolName)
->setArgument('ranges', $ip_address)
);
}
$d->pool_name = $name;
$d->range_ip = $ip_address;
$d->routers = $routers;
$d->save();
r2(U . 'pool/list', 's', $_L['Updated_Successfully']);
}else{
r2(U . 'pool/edit/'.$id, 'e', $msg);

View File

@ -43,9 +43,9 @@ switch ($action) {
case 'recharge':
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
$p = ORM::for_table('tbl_plans')->find_many();
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
$ui->display('recharge.tpl');
@ -57,9 +57,9 @@ switch ($action) {
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
$p = ORM::for_table('tbl_plans')->find_many();
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
$ui->display('recharge-user.tpl');
@ -82,85 +82,100 @@ switch ($action) {
if ($msg == '') {
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan)->where('enabled', '1')->find_one();
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
$mikrotik = Router::_info($server);
$date_exp = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + $p['validity'], date("Y")));
if($p['validity_unit']=='Months'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
}else if($p['validity_unit']=='Days'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' day'));
}else if($p['validity_unit']=='Hrs'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' hour')));
$date_exp = $datetime[0];
$time = $datetime[1];
}else if($p['validity_unit']=='Mins'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' minute')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
if ($type == 'Hotspot') {
if ($b) {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$b->customer_id = $id_customer;
@ -190,67 +205,70 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
} else {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
@ -281,34 +299,40 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
}
sendTelegram( "$admin[fullname] #Recharge Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
"\nRouter: ".$server.
"\nPrice: ".$p['price']);
} else {
if ($b) {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$b->customer_id = $id_customer;
$b->username = $c['username'];
@ -337,19 +361,22 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
} else {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $id_customer;
@ -379,10 +406,33 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
}
sendTelegram( "$admin[fullname] #Recharge Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
"\nRouter: ".$server.
"\nPrice: ".$p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
"$_L[Sales] : $admin[fullname]\n".
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {
@ -407,7 +457,7 @@ switch ($action) {
$d = ORM::for_table('tbl_user_recharges')->find_one($id);
if ($d) {
$ui->assign('d', $d);
$p = ORM::for_table('tbl_plans')->find_many();
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('p', $p);
$ui->display('prepaid-edit.tpl');
@ -423,40 +473,46 @@ switch ($action) {
$mikrotik = Router::_info($d['routers']);
if ($d) {
if ($d['type'] == 'Hotspot') {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $d['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $d['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$d->delete();
} else {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $d['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $d['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
}
$d->delete();
}
r2(U . 'prepaid/list', 's', $_L['Delete_Successfully']);
@ -496,7 +552,7 @@ switch ($action) {
if ($code != '') {
$ui->assign('code', $code);
$paginator = Paginator::bootstrap('tbl_voucher', 'code', '%' . $code . '%');
$d = ORM::for_table('tbl_plans')
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->where_like('tbl_plans.code', '%' . $code . '%')
->offset($paginator['startpoint'])
@ -504,7 +560,7 @@ switch ($action) {
->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_voucher');
$d = ORM::for_table('tbl_plans')
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->offset($paginator['startpoint'])
->limit($paginator['limit'])->find_many();
@ -519,9 +575,9 @@ switch ($action) {
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
$p = ORM::for_table('tbl_plans')->find_many();
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
$ui->display('voucher-add.tpl');
@ -676,81 +732,97 @@ switch ($action) {
$time = date("H:i:s");
$mikrotik = Router::_info($v1['routers']);
$date_exp = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + $p['validity'], date("Y")));
if($p['validity_unit']=='Months'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
}else if($p['validity_unit']=='Days'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' day'));
}else if($p['validity_unit']=='Hrs'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' hour')));
$date_exp = $datetime[0];
$time = $datetime[1];
}else if($p['validity_unit']=='Mins'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' minute')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
if ($v1) {
if ($v1['type'] == 'Hotspot') {
if ($b) {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$b->customer_id = $user;
@ -780,66 +852,69 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
} else {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
@ -874,33 +949,41 @@ switch ($action) {
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
sendTelegram( "$admin[fullname] #Refill #Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else {
if ($b) {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$b->customer_id = $user;
$b->username = $c['username'];
@ -929,19 +1012,22 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
} else {
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user;
@ -975,10 +1061,35 @@ switch ($action) {
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
sendTelegram( "$admin[fullname] Refill #Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
"$_L[Sales] : $admin[fullname]\n".
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {

View File

@ -1,281 +1,156 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* created by iBNuX
**/
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* created by iBNuX
**/
if (isset($routes['1'])) {
$do = $routes['1'];
} else {
$do = 'register-display';
}
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch($do){
$otpPath = 'system/uploads/sms/';
switch ($do) {
case 'post':
$username = _post('username');
$otp_code = _post('otp_code');
$username = _post('username');
$fullname = _post('fullname');
$password = _post('password');
$cpassword = _post('cpassword');
$address = _post('address');
$phonenumber = _post('phonenumber');
$code = _post('kodevoucher');
$v1 = ORM::for_table('tbl_voucher')->where('code',$code)->where('status',0)->find_one();
if ($v1){
$msg = '';
if(Validator::Length($username,35,2) == false){
$msg .= 'Username should be between 3 to 55 characters'. '<br>';
}
if(Validator::Length($fullname,36,2) == false){
$msg .= 'Full Name should be between 3 to 25 characters'. '<br>';
}
if(!Validator::Length($password,35,2)){
$msg .= 'Password should be between 3 to 35 characters'. '<br>';
$phonenumber = _post('username');
$msg = '';
if (Validator::Length($username, 35, 2) == false) {
$msg .= 'Username should be between 3 to 55 characters' . '<br>';
}
if (Validator::Length($fullname, 36, 2) == false) {
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
}
if (!Validator::Length($password, 35, 2)) {
$msg .= 'Password should be between 3 to 35 characters' . '<br>';
}
if ($password != $cpassword) {
$msg .= $_L['PasswordsNotMatch'] . '<br>';
}
}
if($password != $cpassword){
$msg .= $_L['PasswordsNotMatch']. '<br>';
}
$d = ORM::for_table('tbl_customers')->where('username',$username)->find_one();
if($d){
$msg .= $_L['account_already_exist']. '<br>';
}
if($msg == ''){
$d = ORM::for_table('tbl_customers')->create();
$d->username = $username;
$d->password = $password;
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
if($d->save()){
$user = $d->id();
//check voucher plan
$p = ORM::for_table('tbl_plans')->find_one($v1['id_plan']);
$c = ORM::for_table('tbl_customers')->find_one($user);
$p = ORM::for_table('tbl_plans')->find_one($v1['id_plan']);
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
$mikrotik = Router::_info($v1['routers']);
$date_exp = date("Y-m-d", mktime(0,0,0,date("m"),date("d") + $p['validity'],date("Y")));
if($v1['type'] == 'Hotspot'){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if($p['typebp']=="Limited"){
if($p['limit_type']=="Time_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
}else if($p['limit_type']=="Data_Limit"){
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
}else if($p['limit_type']=="Both_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
}else{
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user;
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "Hotspot";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-"._raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
}else{
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user;
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "PPPOE";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-"._raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
}
r2(U . 'login', 's', $_L['Register_Success']);
}else{
$ui->assign('username', $username);
$ui->assign('fullname', $fullname);
$ui->assign('address', $address);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify','<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Failed to register</div></div>');
$ui->display('register.tpl');
}
//r2(U . 'register', 's', $_L['account_created_successfully']);
}else{
$ui->assign('username', $username);
$ui->assign('fullname', $fullname);
$ui->assign('address', $address);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify','<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>'.$msg.'</div></div>');
$ui->display('register.tpl');
}
}else{
$ui->assign('username', $username);
$ui->assign('fullname', $fullname);
$ui->assign('address', $address);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify','<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>'.$_L['Voucher_Not_Valid'].'</div></div>');
$ui->display('register.tpl');
//r2(U . 'register', 'e', $_L['Voucher_Not_Valid']);
}
/*$password = _post('password');
if($username != '' AND $password != ''){
$d = ORM::for_table('tbl_customers')->where('username',$username)->find_one();
if($d){
$d_pass = $d['password'];
if(Password::_uverify($password,$d_pass) == true){
$_SESSION['uid'] = $d['id'];
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username .' '. $_L['Login_Successful'],'User',$d['id']);
r2(U.'home');
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
_log($username .' '. $_L['Failed_Login'],'User');
r2(U.'login');
}
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
r2(U.'login');
}
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
r2(U.'login');
}*/
if(!empty($_c['sms_url'])){
$otpPath .= sha1($username.$db_password).".txt";
if(file_exists($otpPath) && time()-filemtime($otpPath)>300){
unlink($otpPath);
r2(U . 'register', 's', 'Verification code expired');
}else if(file_exists($otpPath)){
$code = file_get_contents($otpPath);
if($code!=$otp_code){
$ui->assign('username', $username);
$ui->assign('fullname', $fullname);
$ui->assign('address', $address);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Verification code is Wrong</div></div>');
$ui->display('register-otp.tpl');
exit();
}else{
unlink($otpPath);
}
}else{
r2(U . 'register', 's', 'No Verification code');
}
}
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if ($d) {
$msg .= $_L['account_already_exist'] . '<br>';
}
if ($msg == '') {
$d = ORM::for_table('tbl_customers')->create();
$d->username = $username;
$d->password = $password;
$d->fullname = $fullname;
$d->address = $address;
$d->phonenumber = $phonenumber;
if ($d->save()) {
$user = $d->id();
r2(U . 'login', 's', $_L['Register_Success']);
} else {
$ui->assign('username', $username);
$ui->assign('fullname', $fullname);
$ui->assign('address', $address);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify', '<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Failed to register</div></div>');
r2(U . 'register', 's', 'Failed to register');
}
} else {
$ui->assign('username', $username);
$ui->assign('fullname', $fullname);
$ui->assign('address', $address);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify', '<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>' . $msg . '</div></div>');
$ui->display('register.tpl');
}
break;
default:
$ui->assign('username', "");
$ui->assign('fullname', "");
$ui->assign('address', "");
$ui->assign('phonenumber', "");
$ui->display('register.tpl');
if(!empty($_c['sms_url'])){
$username = _post('username');
if(!empty($username)){
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if ($d) {
r2(U . 'register', 's', $_L['account_already_exist']);
}
if(!file_exists($otpPath)){
mkdir($otpPath);
touch($otpPath.'index.html');
}
$otpPath .= sha1($username.$db_password).".txt";
if(file_exists($otpPath) && time()-filemtime($otpPath)<120){
$ui->assign('username', $username);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Please wait '.(120-(time()-filemtime($otpPath))).' seconds before sending another SMS</div></div>');
$ui->display('register-otp.tpl');
}else{
$otp = rand(100000,999999);
file_put_contents($otpPath, $otp);
sendSMS($username,$_c['CompanyName']."\nYour Verification code are: $otp");
$ui->assign('username', $username);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Verification code has been sent to your phone</div></div>');
$ui->display('register-otp.tpl');
}
}else{
$ui->display('register-rotp.tpl');
}
}else{
$ui->assign('username', "");
$ui->assign('fullname', "");
$ui->assign('address', "");
$ui->assign('otp', false);
$ui->display('register.tpl');
}
break;
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Reports'].' - '. $config['CompanyName']);

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
@ -15,6 +10,10 @@ $action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
if($admin['user_type'] != 'Admin'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
}
@ -22,7 +21,7 @@ if($admin['user_type'] != 'Admin'){
switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/routers.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_routers','name','%'.$name.'%');
@ -31,7 +30,7 @@ switch ($action) {
$paginator = Paginator::bootstrap('tbl_routers');
$d = ORM::for_table('tbl_routers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->display('routers.tpl');
@ -70,7 +69,8 @@ switch ($action) {
$username = _post('username');
$password = _post('password');
$description = _post('description');
$enabled = _post('enabled')*1;
$msg = '';
if(Validator::Length($name,30,4) == false){
$msg .= 'Name should be between 5 to 30 characters'. '<br>';
@ -78,12 +78,21 @@ switch ($action) {
if ($ip_address == '' OR $username == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_routers')->where('ip_address',$ip_address)->find_one();
if($d){
$msg .= $_L['Router_already_exist']. '<br>';
}
if(!$_c['radius_mode']){
try {
$iport = explode(":", $ip_address);
$client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$msg .= "Unable to connect to the router.<br>".$e->getMessage().'<br>';
}
}
if($msg == ''){
$d = ORM::for_table('tbl_routers')->create();
$d->name = $name;
@ -91,6 +100,7 @@ switch ($action) {
$d->username = $username;
$d->password = $password;
$d->description = $description;
$d->enabled = $enabled;
$d->save();
r2(U . 'routers/list', 's', $_L['Created_Successfully']);
@ -106,7 +116,7 @@ switch ($action) {
$username = _post('username');
$password = _post('password');
$description = _post('description');
$enabled = $_POST['enabled']*1;
$msg = '';
if(Validator::Length($name,30,4) == false){
$msg .= 'Name should be between 5 to 30 characters'. '<br>';
@ -124,11 +134,30 @@ switch ($action) {
}
if($d['name'] != $name){
$c = ORM::for_table('tbl_routers')->where('ip_address',$ip_address)->find_one();
$c = ORM::for_table('tbl_routers')->where('name',$name)->where_not_equal('id',$id)->find_one();
if($c){
$msg .= $_L['Router_already_exist']. '<br>';
$msg .= 'Name Already Exists<br>';
}
}
$oldname = $d['name'];
if($d['ip_address'] != $ip_address){
$c = ORM::for_table('tbl_routers')->where('ip_address',$ip_address)->where_not_equal('id',$id)->find_one();
if($c){
$msg .= 'IP Already Exists<br>';
}
}
if(!$_c['radius_mode']){
try {
$iport = explode(":", $ip_address);
$client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$msg .= "Unable to connect to the router.<br>".$e->getMessage().'<br>';
}
}
if($msg == ''){
$d->name = $name;
@ -136,7 +165,28 @@ switch ($action) {
$d->username = $username;
$d->password = $password;
$d->description = $description;
$d->enabled = $enabled;
$d->save();
if($name!=$oldname){
$p = ORM::for_table('tbl_plans')->where('routers',$oldname)->find_result_set();
$p->set('routers',$name);
$p->save();
$p = ORM::for_table('tbl_payment_gateway')->where('routers',$oldname)->find_result_set();
$p->set('routers',$name);
$p->save();
$p = ORM::for_table('tbl_pool')->where('routers',$oldname)->find_result_set();
$p->set('routers',$name);
$p->save();
$p = ORM::for_table('tbl_transactions')->where('routers',$oldname)->find_result_set();
$p->set('routers',$name);
$p->save();
$p = ORM::for_table('tbl_user_recharges')->where('routers',$oldname)->find_result_set();
$p->set('routers',$name);
$p->save();
$p = ORM::for_table('tbl_voucher')->where('routers',$oldname)->find_result_set();
$p->set('routers',$name);
$p->save();
}
r2(U . 'routers/list', 's', $_L['Updated_Successfully']);
}else{
r2(U . 'routers/edit/'.$id, 'e', $msg);

View File

@ -1,94 +1,96 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
**/
_admin();
$ui->assign('_title', $_L['Hotspot_Plans'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Hotspot_Plans'] . ' - ' . $config['CompanyName']);
$ui->assign('_system_menu', 'services');
$action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'hotspot':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/hotspot.js"></script>');
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/hotspot.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_plans','name_plan','%'.$name.'%','type','Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type','Hotspot')->where_like('tbl_plans.name_plan','%'.$name.'%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}else{
$paginator = Paginator::bootstrap('tbl_plans','type','Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type','Hotspot')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_plans', 'name_plan', '%' . $name . '%', 'type', 'Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where_like('tbl_plans.name_plan', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_plans', 'type', 'Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('hotspot.tpl');
break;
case 'add':
$d = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('d',$d);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r',$r);
$d = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('d', $d);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
$ui->display('hotspot-add.tpl');
break;
case 'edit':
$id = $routes['2'];
$d = ORM::for_table('tbl_plans')->find_one($id);
if($d){
$ui->assign('d',$d);
$b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b',$b);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r',$r);
if ($d) {
$ui->assign('d', $d);
$b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b', $b);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
$ui->display('hotspot-edit.tpl');
}else{
} else {
r2(U . 'services/hotspot', 'e', $_L['Account_Not_Found']);
}
break;
case 'delete':
$id = $routes['2'];
$d = ORM::for_table('tbl_plans')->find_one($id);
if($d){
$mikrotik = Router::_info($d['routers']);
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $d['name_plan'])
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
$client($removeRequest
->setArgument('numbers', $profileName)
);
if ($d) {
if(!$_c['radius_mode']){
$mikrotik = Router::_info($d['routers']);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $d['name_plan'])
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileName)
);
}
$d->delete();
r2(U . 'services/hotspot', 's', $_L['Delete_Successfully']);
}
break;
@ -96,224 +98,255 @@ switch ($action) {
case 'add-post':
$name = _post('name');
$typebp = _post('typebp');
$limit_type = _post('limit_type');
$time_limit = _post('time_limit');
$time_unit = _post('time_unit');
$data_limit = _post('data_limit');
$data_unit = _post('data_unit');
$id_bw = _post('id_bw');
$price = _post('pricebp');
$sharedusers = _post('sharedusers');
$limit_type = _post('limit_type');
$time_limit = _post('time_limit');
$time_unit = _post('time_unit');
$data_limit = _post('data_limit');
$data_unit = _post('data_unit');
$id_bw = _post('id_bw');
$price = _post('pricebp');
$sharedusers = _post('sharedusers');
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$enabled = _post('enabled')*1;
$msg = '';
if(Validator::UnsignedNumber($validity) == false){
$msg .= 'The validity must be a number'. '<br>';
if (Validator::UnsignedNumber($validity) == false) {
$msg .= 'The validity must be a number' . '<br>';
}
if(Validator::UnsignedNumber($price) == false){
$msg .= 'The price must be a number'. '<br>';
if (Validator::UnsignedNumber($price) == false) {
$msg .= 'The price must be a number' . '<br>';
}
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_plans')->where('name_plan',$name)->where('type','Hotspot')->find_one();
if($d){
$msg .= $_L['Plan_already_exist']. '<br>';
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '') {
$msg .= $_L['All_field_is_required'] . '<br>';
}
if($msg == ''){
$b = ORM::for_table('tbl_bandwidth')->where('id',$id_bw)->find_one();
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
$rate = $b['rate_up'].$unitup."/".$b['rate_down'].$unitdown;
$d = ORM::for_table('tbl_plans')->where('name_plan', $name)->where('type', 'Hotspot')->find_one();
if ($d) {
$msg .= $_L['Plan_already_exist'] . '<br>';
}
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
$unitdown = 'K';
} else {
$unitdown = 'M';
}
if ($b['rate_up_unit'] == 'Kbps') {
$unitup = 'K';
} else {
$unitup = 'M';
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
}
$mikrotik = Router::_info($routers);
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync($addRequest
->setArgument('name', $name)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
$d = ORM::for_table('tbl_plans')->create();
$d->name_plan = $name;
$d->id_bw = $id_bw;
$d->price = $price;
$d->type = 'Hotspot';
$d->type = 'Hotspot';
$d->typebp = $typebp;
$d->limit_type = $limit_type;
$d->time_limit = $time_limit;
$d->time_unit = $time_unit;
$d->data_limit = $data_limit;
$d->data_unit = $data_unit;
$d->validity = $validity;
$d->limit_type = $limit_type;
$d->time_limit = $time_limit;
$d->time_unit = $time_unit;
$d->data_limit = $data_limit;
$d->data_unit = $data_unit;
$d->validity = $validity;
$d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers;
$d->routers = $routers;
$d->shared_users = $sharedusers;
$d->routers = $routers;
$d->enabled = $enabled;
$d->save();
r2(U . 'services/hotspot', 's', $_L['Created_Successfully']);
}else{
} else {
r2(U . 'services/add', 'e', $msg);
}
break;
case 'edit-post':
$id = _post('id');
$id = _post('id');
$name = _post('name');
$id_bw = _post('id_bw');
$typebp = _post('typebp');
$typebp = _post('typebp');
$price = _post('price');
$limit_type = _post('limit_type');
$time_limit = _post('time_limit');
$time_unit = _post('time_unit');
$data_limit = _post('data_limit');
$data_unit = _post('data_unit');
$sharedusers = _post('sharedusers');
$limit_type = _post('limit_type');
$time_limit = _post('time_limit');
$time_unit = _post('time_unit');
$data_limit = _post('data_limit');
$data_unit = _post('data_unit');
$sharedusers = _post('sharedusers');
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$enabled = _post('enabled')*1;
$msg = '';
if(Validator::UnsignedNumber($validity) == false){
$msg .= 'The validity must be a number'. '<br>';
if (Validator::UnsignedNumber($validity) == false) {
$msg .= 'The validity must be a number' . '<br>';
}
if(Validator::UnsignedNumber($price) == false){
$msg .= 'The price must be a number'. '<br>';
if (Validator::UnsignedNumber($price) == false) {
$msg .= 'The price must be a number' . '<br>';
}
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_plans')->where('id',$id)->find_one();
if($d){
}else{
$msg .= $_L['Data_Not_Found']. '<br>';
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '') {
$msg .= $_L['All_field_is_required'] . '<br>';
}
if($msg == ''){
$b = ORM::for_table('tbl_bandwidth')->where('id',$id_bw)->find_one();
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
$rate = $b['rate_up'].$unitup."/".$b['rate_down'].$unitdown;
$mikrotik = Router::_info($routers);
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client($setRequest
->setArgument('numbers', $profileName)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
$d = ORM::for_table('tbl_plans')->where('id', $id)->find_one();
if ($d) {
} else {
$msg .= $_L['Data_Not_Found'] . '<br>';
}
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
$unitdown = 'K';
} else {
$unitdown = 'M';
}
if ($b['rate_up_unit'] == 'Kbps') {
$unitup = 'K';
} else {
$unitup = 'M';
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileName)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
}
$d->name_plan = $name;
$d->id_bw = $id_bw;
$d->price = $price;
$d->typebp = $typebp;
$d->limit_type = $limit_type;
$d->time_limit = $time_limit;
$d->time_unit = $time_unit;
$d->data_limit = $data_limit;
$d->data_unit = $data_unit;
$d->validity = $validity;
$d->limit_type = $limit_type;
$d->time_limit = $time_limit;
$d->time_unit = $time_unit;
$d->data_limit = $data_limit;
$d->data_unit = $data_unit;
$d->validity = $validity;
$d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers;
$d->routers = $routers;
$d->shared_users = $sharedusers;
$d->routers = $routers;
$d->enabled = $enabled;
$d->save();
r2(U . 'services/hotspot', 's', $_L['Updated_Successfully']);
}else{
r2(U . 'services/edit/'.$id, 'e', $msg);
} else {
r2(U . 'services/edit/' . $id, 'e', $msg);
}
break;
case 'pppoe':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pppoe.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_plans','name_plan','%'.$name.'%','type','Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type','PPPOE')->where_like('tbl_plans.name_plan','%'.$name.'%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}else{
$paginator = Paginator::bootstrap('tbl_plans','type','Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type','PPPOE')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pppoe.js"></script>');
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_plans', 'name_plan', '%' . $name . '%', 'type', 'Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where_like('tbl_plans.name_plan', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_plans', 'type', 'Hotspot');
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('pppoe.tpl');
break;
case 'pppoe-add':
$d = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('d',$d);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p',$p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r',$r);
$d = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
$ui->display('pppoe-add.tpl');
break;
case 'pppoe-edit':
$id = $routes['2'];
$d = ORM::for_table('tbl_plans')->find_one($id);
if($d){
$ui->assign('d',$d);
$b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b',$b);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p',$p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r',$r);
if ($d) {
$ui->assign('d', $d);
$b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b', $b);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
$ui->display('pppoe-edit.tpl');
}else{
} else {
r2(U . 'services/pppoe', 'e', $_L['Account_Not_Found']);
}
break;
case 'pppoe-delete':
$id = $routes['2'];
$d = ORM::for_table('tbl_plans')->find_one($id);
if($d){
$mikrotik = Router::_info($d['routers']);
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $d['name_plan'])
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
$client($removeRequest
->setArgument('numbers', $profileName)
);
if ($d) {
if(!$_c['radius_mode']){
$mikrotik = Router::_info($d['routers']);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $d['name_plan'])
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileName)
);
}
$d->delete();
r2(U . 'services/pppoe', 's', $_L['Delete_Successfully']);
@ -322,134 +355,162 @@ switch ($action) {
case 'pppoe-add-post':
$name = _post('name_plan');
$id_bw = _post('id_bw');
$price = _post('price');
$id_bw = _post('id_bw');
$price = _post('price');
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool = _post('pool_name');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool = _post('pool_name');
$enabled = _post('enabled')*1;
$msg = '';
if(Validator::UnsignedNumber($validity) == false){
$msg .= 'The validity must be a number'. '<br>';
if (Validator::UnsignedNumber($validity) == false) {
$msg .= 'The validity must be a number' . '<br>';
}
if(Validator::UnsignedNumber($price) == false){
$msg .= 'The price must be a number'. '<br>';
if (Validator::UnsignedNumber($price) == false) {
$msg .= 'The price must be a number' . '<br>';
}
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == '' OR $pool == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_plans')->where('name_plan',$name)->find_one();
if($d){
$msg .= $_L['Plan_already_exist']. '<br>';
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '' or $pool == '') {
$msg .= $_L['All_field_is_required'] . '<br>';
}
if($msg == ''){
$b = ORM::for_table('tbl_bandwidth')->where('id',$id_bw)->find_one();
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
$rate = $b['rate_up'].$unitup."/".$b['rate_down'].$unitdown;
$mikrotik = Router::_info($routers);
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$addRequest = new RouterOS\Request('/ppp/profile/add');
$client->sendSync($addRequest
->setArgument('name', $name)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
$d = ORM::for_table('tbl_plans')->where('name_plan', $name)->find_one();
if ($d) {
$msg .= $_L['Plan_already_exist'] . '<br>';
}
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
$unitdown = 'K';
} else {
$unitdown = 'M';
}
if ($b['rate_up_unit'] == 'Kbps') {
$unitup = 'K';
} else {
$unitup = 'M';
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
}
$d = ORM::for_table('tbl_plans')->create();
$d->type = 'PPPOE';
$d->name_plan = $name;
$d->name_plan = $name;
$d->id_bw = $id_bw;
$d->price = $price;
$d->validity = $validity;
$d->validity = $validity;
$d->validity_unit = $validity_unit;
$d->routers = $routers;
$d->pool = $pool;
$d->routers = $routers;
$d->pool = $pool;
$d->enabled = $enabled;
$d->save();
r2(U . 'services/pppoe', 's', $_L['Created_Successfully']);
}else{
} else {
r2(U . 'services/pppoe-add', 'e', $msg);
}
break;
case 'edit-pppoe-post':
$id = _post('id');
$id = _post('id');
$name = _post('name_plan');
$id_bw = _post('id_bw');
$price = _post('price');
$id_bw = _post('id_bw');
$price = _post('price');
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool = _post('pool_name');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool = _post('pool_name');
$enabled = _post('enabled')*1;
$msg = '';
if(Validator::UnsignedNumber($validity) == false){
$msg .= 'The validity must be a number'. '<br>';
if (Validator::UnsignedNumber($validity) == false) {
$msg .= 'The validity must be a number' . '<br>';
}
if(Validator::UnsignedNumber($price) == false){
$msg .= 'The price must be a number'. '<br>';
if (Validator::UnsignedNumber($price) == false) {
$msg .= 'The price must be a number' . '<br>';
}
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == '' OR $pool == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_plans')->where('id',$id)->find_one();
if($d){
}else{
$msg .= $_L['Data_Not_Found']. '<br>';
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '' or $pool == '') {
$msg .= $_L['All_field_is_required'] . '<br>';
}
if($msg == ''){
$b = ORM::for_table('tbl_bandwidth')->where('id',$id_bw)->find_one();
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
$rate = $b['rate_up'].$unitup."/".$b['rate_down'].$unitdown;
$mikrotik = Router::_info($routers);
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ppp/profile/set');
$client($setRequest
->setArgument('numbers', $profileName)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
$d = ORM::for_table('tbl_plans')->where('id', $id)->find_one();
if ($d) {
} else {
$msg .= $_L['Data_Not_Found'] . '<br>';
}
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
$unitdown = 'K';
} else {
$unitdown = 'M';
}
if ($b['rate_up_unit'] == 'Kbps') {
$unitup = 'K';
} else {
$unitup = 'M';
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ppp/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileName)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
}
$d->name_plan = $name;
$d->id_bw = $id_bw;
$d->price = $price;
$d->validity = $validity;
$d->validity = $validity;
$d->validity_unit = $validity_unit;
$d->routers = $routers;
$d->pool = $pool;
$d->routers = $routers;
$d->pool = $pool;
$d->enabled = $enabled;
$d->save();
r2(U . 'services/pppoe', 's', $_L['Updated_Successfully']);
}else{
r2(U . 'services/pppoe-edit/'.$id, 'e', $msg);
} else {
r2(U . 'services/pppoe-edit/' . $id, 'e', $msg);
}
break;
default:
echo 'action not defined';
}
}

View File

@ -3,10 +3,6 @@
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Settings'] . '- ' . $config['CompanyName']);
@ -204,9 +200,14 @@ switch ($action) {
case 'app-post':
$company = _post('company');
$theme = _post('theme');
$telegram_bot = _post('telegram_bot');
$telegram_target_id = _post('telegram_target_id');
$sms_url = _post('sms_url');
$wa_url = _post('wa_url');
$address = _post('address');
if ($company == '' or $theme == '' or $address == '') {
$tawkto = _post('tawkto');
$radius_mode = _post('radius_mode')*1;
if ($company == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
} else {
$d = ORM::for_table('tbl_appconfig')->where('setting', 'CompanyName')->find_one();
@ -222,9 +223,72 @@ switch ($action) {
$d->value = $phone;
$d->save();
$d = ORM::for_table('tbl_appconfig')->where('setting', 'theme')->find_one();
$d->value = $theme;
$d->save();
$d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_bot')->find_one();
if($d){
$d->value = $telegram_bot;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'telegram_bot';
$d->value = $telegram_bot;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_target_id')->find_one();
if($d){
$d->value = $telegram_target_id;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'telegram_target_id';
$d->value = $telegram_target_id;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'sms_url')->find_one();
if($d){
$d->value = $sms_url;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'sms_url';
$d->value = $sms_url;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'wa_url')->find_one();
if($d){
$d->value = $wa_url;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'wa_url';
$d->value = $wa_url;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tawkto')->find_one();
if($d){
$d->value = $tawkto;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tawkto';
$d->value = $tawkto;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'radius_mode')->find_one();
if($d){
$d->value = $radius_mode;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'radius_mode';
$d->value = $radius_mode;
$d->save();
}
$note = _post('note');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'note')->find_one();

View File

@ -1,14 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
**/
_auth();
$ui->assign('_title', $_L['Voucher'].'- '. $config['CompanyName']);
$ui->assign('_title', $_L['Voucher'] . '- ' . $config['CompanyName']);
$ui->assign('_system_menu', 'voucher');
$action = $routes['1'];
@ -16,335 +13,374 @@ $user = User::_info();
$ui->assign('_user', $user);
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'activation':
$ui->display('user-activation.tpl');
break;
case 'activation-post':
$code = _post('code');
$v1 = ORM::for_table('tbl_voucher')->where('code',$code)->where('status',0)->find_one();
$c = ORM::for_table('tbl_customers')->find_one($user['id']);
$p = ORM::for_table('tbl_plans')->find_one($v1['id_plan']);
$b = ORM::for_table('tbl_user_recharges')->where('customer_id',$user['id'])->find_one();
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
$mikrotik = Router::_info($v1['routers']);
$date_exp = date("Y-m-d", mktime(0,0,0,date("m"),date("d") + $p['validity'],date("Y")));
if ($v1){
if($v1['type'] == 'Hotspot'){
if($b){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if($p['typebp']=="Limited"){
if($p['limit_type']=="Time_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
}else if($p['limit_type']=="Data_Limit"){
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
}else if($p['limit_type']=="Both_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
}else{
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$b->customer_id = $user['id'];
$b->username = $c['username'];
$b->plan_id = $v1['id_plan'];
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "voucher";
$b->routers = $v1['routers'];
$b->type = "Hotspot";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-"._raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
}else{
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if($p['typebp']=="Limited"){
if($p['limit_type']=="Time_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
}else if($p['limit_type']=="Data_Limit"){
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
}else if($p['limit_type']=="Both_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
}else{
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user['id'];
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "Hotspot";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-"._raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
}
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
}else{
if($b){
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$b->customer_id = $user['id'];
$b->username = $c['username'];
$b->plan_id = $v1['id_plan'];
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "voucher";
$b->routers = $v1['routers'];
$b->type = "PPPOE";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-"._raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
}else{
try {
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user['id'];
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "PPPOE";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-"._raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
}
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
}
r2(U."voucher/list-activated",'s',$_L['Activation_Vouchers_Successfully']);
}else{
r2(U . 'voucher/activation', 'e', $_L['Voucher_Not_Valid']);
}
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
$c = ORM::for_table('tbl_customers')->find_one($user['id']);
$p = ORM::for_table('tbl_plans')->find_one($v1['id_plan']);
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $user['id'])->find_one();
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
$mikrotik = Router::_info($v1['routers']);
if($p['validity_unit']=='Months'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
}else if($p['validity_unit']=='Days'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' day'));
}else if($p['validity_unit']=='Hrs'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' hour')));
$date_exp = $datetime[0];
$time = $datetime[1];
}else if($p['validity_unit']=='Mins'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' minute')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
if ($v1) {
if ($v1['type'] == 'Hotspot') {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
}
$b->customer_id = $user['id'];
$b->username = $c['username'];
$b->plan_id = $v1['id_plan'];
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "voucher";
$b->routers = $v1['routers'];
$b->type = "Hotspot";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user['id'];
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "Hotspot";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
}
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
// Telegram to Admin
sendTelegram( '#u'.$c['username']." Activate #Voucher #Hotspot\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$b->customer_id = $user['id'];
$b->username = $c['username'];
$b->plan_id = $v1['id_plan'];
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "voucher";
$b->routers = $v1['routers'];
$b->type = "PPPOE";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user['id'];
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "PPPOE";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
}
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
// Telegram to Admin
sendTelegram( '#u'.$c['username']." Activate #Voucher #PPPOE\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
}
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
} else {
r2(U . 'voucher/activation', 'e', $_L['Voucher_Not_Valid']);
}
break;
case 'list-activated':
$paginator = Paginator::bootstrap('tbl_transactions','username',$user['username']);
$d = ORM::for_table('tbl_transactions')->where('username',$user['username'])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->display('user-activation-list.tpl');
$paginator = Paginator::bootstrap('tbl_transactions', 'username', $user['username']);
$d = ORM::for_table('tbl_transactions')->where('username', $user['username'])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('user-activation-list.tpl');
break;
default:
$ui->display('404.tpl');
}
}

View File

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
require('config.php');
@ -38,38 +33,40 @@ foreach ($d as $ds){
$u = ORM::for_table('tbl_user_recharges')->where('id',$ds['id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id',$ds['customer_id'])->find_one();
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
try {
$client = new RouterOS\Client($m['ip_address'], $m['username'], $m['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('limit-uptime', '00:00:05');
$client->sendSync($setRequest);
if(!$_c['radius_mode']){
try {
$iport = explode(":",$m['ip_address']);
$client = new RouterOS\Client($iport[0], $m['username'], $m['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('limit-uptime', '00:00:05');
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
//update database user dengan status off
$u->status = 'off';
$u->save();
}else
echo " : ACTIVE \r\n";
}else echo " : ACTIVE \r\n";
}else{
$date_now = strtotime(date("Y-m-d H:i:s"));
$expiration = strtotime($ds['expiration'].' '.$ds['time']);
@ -80,35 +77,35 @@ foreach ($d as $ds){
$c = ORM::for_table('tbl_customers')->where('id',$ds['customer_id'])->find_one();
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
try {
$client = new RouterOS\Client($m['ip_address'], $m['username'], $m['password']);
} catch (Exception $e) {
die('Unable to connect to the router.');
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
if(!$_c['radius_mode']){
try {
$iport = explode(":",$m['ip_address']);
$client = new RouterOS\Client($iport[0], $m['username'], $m['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/disable');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
$setRequest = new RouterOS\Request('/ppp/secret/disable');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ppp/secret/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
$u->status = 'off';
$u->save();
}else
echo " : ACTIVE \r\n";
}else echo " : ACTIVE \r\n";
}
}
?>

View File

@ -1,7 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill Installer</title>
<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">
@ -9,51 +10,51 @@
<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>
<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 &amp; Continue</a>
</div>
</div>
<!-- contents area end -->
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br/><br/></div>
<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 &amp; Continue</a>
</div>
</div>
<!-- contents area end -->
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
</body>
</html>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill Installer</title>
<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">
@ -9,63 +10,61 @@
<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 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, '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/>";
$passed .= '1';
<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>
} 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/>";
$passed .= '0';
<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')) {
$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 (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.
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>");
} else {
echo("<br/> $ltext <br/> Sorry. The requirements of PHPMixBill is not available on your server.
<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 &copy; 2021 PHPMixBill. All Rights Reserved<br/><br/></div>
}
?>
</div>
</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

@ -1,11 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
//error_reporting (0);
$appurl = $_POST['appurl'];
@ -19,21 +14,21 @@ try{
"$db_user",
"$db_password",
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$cn = '1';
$cn = '1';
}
catch(PDOException $ex){
$cn = '0';
$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";
$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");

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

@ -0,0 +1,109 @@
<!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 "ALTER TABLE `tbl_user_recharges` CHANGE `method` `method` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';\n\n";
$dbh->exec("ALTER TABLE `tbl_user_recharges` CHANGE `method` `method` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';");
echo "ALTER TABLE `tbl_transactions` CHANGE `method` `method` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;\n\n";
$dbh->exec("ALTER TABLE `tbl_transactions` CHANGE `method` `method` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT 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>

View File

@ -219,7 +219,7 @@ $_L['Account_Information'] = 'Your Account Information';
$_L['Welcome_Text_User'] = 'Welcome to the Panel Members page, on this page you can:';
$_L['Welcome_Text_Admin'] = '<b>PHPMixBill</b> is a billing Hotspot and PPPOE for Mikrotik using PHP and Mikrotik API to comunicate with router. If you get more profit with this application, please donate us.<br>Watch project <a href="https://github.com/ibnux/phpmixbill" target="_blank">in here</a>';
//update
//update
$_L['Invalid_Username_or_Password'] = 'Invalid Username or Password';
$_L['Do_Not_Access'] = 'You do not have permission to access this page';
$_L['Incorrect_Current_Password'] = 'Incorrect Current Password';
@ -247,3 +247,50 @@ $_L['Folder_Lang'] = 'Folder Name';
$_L['Translator'] = 'Translator';
$_L['Lang_already_exist'] = 'Language Name Already Exist';
$_L['Payment_Gateway'] = 'Payment Gateway';
$_L['Community'] = 'Community';
$_L['1_user_can_be_used_for_many_devices'] = '1 user can be used for many devices?';
$_L['Cannot_be_change_after_saved'] = 'Cannot be change after saved';
$_L['Explain_Coverage_of_router'] = 'Jelaskan Cakupan wilayah hotspot';
$_L['Name_of_Area_that_router_operated'] = 'Nama Lokasi/Wilayah Router beroperasi';
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
$_L['Status'] = 'Status';
$_L['Plan_Not_found'] = 'Plan Not found';
$_L['Failed_to_create_transaction'] = 'Failed to create transaction.';
$_L['Seller_has_not_yet_setup_Xendit_payment_gateway'] = 'Seller has not yet setup Xendit payment gateway';
$_L['Admin_has_not_yet_setup_Xendit_payment_gateway_please_tell_admin'] = 'Admin has not yet setup Xendit payment gateway, please tell admin';
$_L['Buy_this_your_active_package_will_be_overwrite'] = 'Buy this? your active package will be overwrite';
$_L['You_already_have_unpaid_transaction_cancel_it_or_pay_it'] = 'You already have unpaid transaction, cancel it or pay it.';
$_L['Transaction_Not_found'] = 'Transaction Not found';
$_L['Cancel_it'] = 'Cancel it?';
$_L['expired'] = 'expired';
$_L['Check_for_Payment'] = 'Check for Payment';
$_L['Transaction_still_unpaid'] = 'Transaction still unpaid.';
$_L['Paid_Date'] = 'Paid Date';
$_L['Transaction_has_been_paid'] = 'Transaction has been paid.';
$_L['PAID'] = 'PAID';
$_L['CANCELED'] = 'CANCELED';
$_L['UNPAID'] = 'UNPAID';
$_L['PAY_NOW'] = 'PAY NOW';
$_L['Buy_Hotspot_Plan'] = 'Buy Hotspot Plan';
$_L['Buy_PPOE_Plan'] = 'Buy PPOE Plan';
$_L['Package'] = 'Package';
$_L['Order_Internet_Package'] = 'Order Internet Package';
$_L['Unknown_Command'] = 'Unknown Command.';
$_L['Checking_payment'] = 'Checking payment';
$_L['Create_Transaction_Success'] = 'Create Transaction Success';
$_L['You_have_unpaid_transaction'] = 'You have unpaid transaction';
$_L['TripayPayment_Channel'] = 'TripayPayment Channel';
$_L['Payment_Channel'] = 'Payment Channel';
$_L['Payment_check_failed'] = 'Payment check failed.';
$_L['Order_Package'] = 'Order Package';
$_L['Transactions'] = 'Transactions';
$_L['Payments'] = 'Payments';
$_L['History'] = 'History';
$_L['Order_History'] = 'Order History';
$_L['Gateway'] = 'Gateway';
$_L['Date_Done'] = 'Date Done';
$_L['Unpaid_Order'] = 'Unpaid Order';

View File

@ -12,7 +12,7 @@ Contributor: Ibnu Maksum (@ibnux)
------------------------------------
*/
$_L['Login'] = 'Masuk';
$_L['Login'] = 'Masuk';
$_L['Register'] = 'Daftar';
$_L['Announcement'] = 'Pengumuman';
$_L['Registration_Info'] = 'Info Pendaftaran';
@ -244,3 +244,52 @@ $_L['Name_Lang'] = 'Nama Bahasa';
$_L['Folder_Lang'] = 'Nama Folder';
$_L['Translator'] = 'Translator';
$_L['Lang_already_exist'] = 'Nama bahasa sudah ada';
$_L['Payment_Gateway'] = 'Payment Gateway';
$_L['Community'] = 'Community';
$_L['1_user_can_be_used_for_many_devices'] = '1 user can be used for many devices?';
$_L['Cannot_be_change_after_saved'] = 'Cannot be change after saved';
$_L['Explain_Coverage_of_router'] = 'Jelaskan Cakupan wilayah hotspot';
$_L['Name_of_Area_that_router_operated'] = 'Nama Lokasi/Wilayah Router beroperasi';
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
$_L['Status'] = 'Status';
$_L['Plan_Not_found'] = 'Plan Not found';
$_L['Failed_to_create_transaction'] = 'Failed to create transaction.';
$_L['Seller_has_not_yet_setup_Xendit_payment_gateway'] = 'Seller has not yet setup Xendit payment gateway';
$_L['Admin_has_not_yet_setup_Xendit_payment_gateway_please_tell_admin'] = 'Admin has not yet setup Xendit payment gateway, please tell admin';
$_L['Buy_this_your_active_package_will_be_overwrite'] = 'Buy this? your active package will be overwrite';
$_L['You_already_have_unpaid_transaction_cancel_it_or_pay_it'] = 'You already have unpaid transaction, cancel it or pay it.';
$_L['Transaction_Not_found'] = 'Transaction Not found';
$_L['Cancel_it'] = 'Cancel it?';
$_L['expired'] = 'expired';
$_L['Check_for_Payment'] = 'Check for Payment';
$_L['Transaction_still_unpaid'] = 'Transaction still unpaid.';
$_L['Paid_Date'] = 'Paid Date';
$_L['Transaction_has_been_paid'] = 'Transaction has been paid.';
$_L['PAID'] = 'PAID';
$_L['CANCELED'] = 'CANCELED';
$_L['UNPAID'] = 'UNPAID';
$_L['PAY_NOW'] = 'PAY NOW';
$_L['Buy_Hotspot_Plan'] = 'Buy Hotspot Plan';
$_L['Buy_PPOE_Plan'] = 'Buy PPOE Plan';
$_L['Package'] = 'Package';
$_L['Order_Internet_Package'] = 'Order Internet Package';
$_L['Unknown_Command'] = 'Unknown Command.';
$_L['Checking_payment'] = 'Checking payment';
$_L['Create_Transaction_Success'] = 'Create Transaction Success';
$_L['You_have_unpaid_transaction'] = 'You have unpaid transaction';
$_L['TripayPayment_Channel'] = 'TripayPayment Channel';
$_L['Payment_Channel'] = 'Payment Channel';
$_L['Payment_check_failed'] = 'Payment check failed.';
$_L['Order_Package'] = 'Order Package';
$_L['Transactions'] = 'Transactions';
$_L['Payments'] = 'Payments';
$_L['History'] = 'History';
$_L['Order_History'] = 'Order History';
$_L['Gateway'] = 'Gateway';
$_L['Date_Done'] = 'Date Done';
$_L['Unpaid_Order'] = 'Unpaid Order';
$_L['Payment_Gateway_Not_Found'] = 'Payment Gateway Not Found';
$_L['Payment_Gateway_saved_successfully'] = 'Payment Gateway saved successfully';

View File

@ -0,0 +1,297 @@
<?php
/*
-----------------------------------
Language Name: Spanish
Contributor: Ing.Luis E. Hernandez
Web: www.phpmixbill.com
Email: contacto.webland@gmail.com
2022
Contributor: Alucard (@alucard)
------------------------------------
*/
$_L['Login'] = 'Entrar';
$_L['Register'] = 'Registro';
$_L['Announcement'] = 'Anuncio';
$_L['Registration_Info'] = 'Información de registro';
$_L['Register_Voucher_Failed'] = 'Cupón no encontrado, compre el cupón antes de registrarse';
$_L['Register_Success'] = '¡Registro exitoso! Puedes iniciar sesión ahora';
$_L['Sign_In_Member'] = 'Log in to Member Panel';
$_L['Register_Member'] = 'Regístrese como miembro';
$_L['Sign_In_Admin'] = 'Panel de administración';
$_L['Logo'] = 'DIGITAL-RED';
$_L['Username'] = 'Usuario';
$_L['Password'] = 'Contraseña';
$_L['PasswordsNotMatch'] = 'Las contraseñas no coinciden';
$_L['account_already_exist'] = 'La cuenta ya existe';
$_L['Manage'] = 'Administrar';
$_L['Submit'] = 'Enviar';
$_L['Save'] = 'Guardar cambios';
$_L['Cancel'] = 'Cancelar';
$_L['Edit'] = 'Editar';
$_L['Delete'] = 'Eliminar';
$_L['Welcome'] = 'Bienvenido';
$_L['Created_Successfully'] = 'Datos creados con éxito';
$_L['Updated_Successfully'] = 'Datos actualizados con éxito';
$_L['Delete_Successfully'] = 'Datos eliminados con éxito';
$_L['Static_Pages'] = "Páginas estáticas";
$_L['Failed_Save_Page'] = "No se pudo guardar la página, asegúrese de que pueda escribir en las páginas de la carpeta, <i>chmod 664 pages/*.html<i>";
$_L['Success_Save_Page'] = "Guardando el éxito de la página";
$_L['Info_Page'] = "A veces es necesario actualizar 3 veces hasta que cambie el contenido";
$_L['Dashboard'] = 'Dashboard';
$_L['Search_Contact'] = 'Buscar clientes...';
$_L['My_Account'] = 'Mi cuenta';
$_L['My_Profile'] = 'Mi perfil';
$_L['Settings'] = 'Ajustes';
$_L['Edit_Profile'] = 'Editar perfil';
$_L['Change_Password'] = 'Cambia la contraseña';
$_L['Logout'] = 'Cerrar sesión';
$_L['Services'] = 'Servicios';
$_L['Bandwidth_Plans'] = 'Planes de velocidad';
$_L['BW_Name'] = 'Nombre de ancho de banda';
$_L['New_Bandwidth'] = 'Nuevo ancho de banda';
$_L['Edit_Bandwidth'] = 'Editar ancho de banda';
$_L['Add_Bandwidth'] = 'Agregar nuevo ancho de banda';
$_L['Rate_Download'] = 'Tarifa Descarga';
$_L['Rate_Upload'] = 'Tasa de subida';
$_L['BW_already_exist'] = 'El ancho de banda del nombre ya existe';
$_L['Hotspot_Plans'] = 'Planes de Hotspot';
$_L['PPPOE_Plans'] = 'Planes PPPOE';
$_L['Plan_Name'] = 'Nombre';
$_L['New_Plan'] = 'Nuevo plan de servicio';
$_L['Add_Plan'] = 'Agregar plan de servicio';
$_L['Edit_Plan'] = 'Editar plan de servicio';
$_L['Plan_already_exist'] = 'Nombre El plan ya existe';
$_L['Plan_Type'] = 'Tipo de plan';
$_L['Plan_Price'] = 'Precio del plan';
$_L['Limit_Type'] = 'Tipo de límite';
$_L['Unlimited'] = 'Ilimitado';
$_L['Limited'] = 'Limitado';
$_L['Time_Limit'] = 'Límite de tiempo';
$_L['Data_Limit'] = 'Límite de datos';
$_L['Both_Limit'] = 'Ambos Límite';
$_L['Plan_Validity'] = 'Validez del Plan';
$_L['Select_BW'] = 'Seleccionar ancho de banda';
$_L['Shared_Users'] = 'Usuarios compartidos';
$_L['user_type_help'] = 'Elija Ventas de tipo de usuario para deshabilitar el acceso a la Configuración';
$_L['Current_Password'] = 'Contraseña actual';
$_L['New_Password'] = 'Nueva contraseña';
$_L['Administrator'] = 'Administrador';
$_L['Sales'] = 'Ventas';
$_L['Member'] = 'Usuario';
$_L['Confirm_New_Password'] = 'Confirmar nueva contraseña';
$_L['Confirm_Password'] = 'Confirmar contraseña';
$_L['Full_Name'] = 'Nombre completo';
$_L['User_Type'] = 'Tipo de usuario';
$_L['Address'] = 'Dirección';
$_L['Created_On'] = 'Creado en';
$_L['Expires_On'] = 'Expira el';
$_L['Phone_Number'] = 'Número de teléfono';
$_L['User_Delete_Ok'] = 'Usuario eliminado con éxito';
$_L['Full_Administrator'] = 'Administrador completo';
$_L['password_change_help'] = 'Mantener en blanco para no cambiar la contraseña';
$_L['currency_help'] = 'Manténgalo en blanco si no desea mostrar el código de moneda';
$_L['Theme_Style'] = 'Estilo de tema';
$_L['Theme_Color'] = 'Color del tema';
$_L['Default_Language'] = 'Idioma predeterminado';
$_L['Network'] = 'Red';
$_L['Routers'] = 'Routers';
$_L['Pool'] = 'IP Pool';
$_L['New_Router'] = 'Nuevo Router';
$_L['Add_Router'] = 'Agregar Router';
$_L['Edit_Router'] = 'Editar Router';
$_L['Router_Name'] = 'Nombre del Router';
$_L['IP_Address'] = 'Direccion IP';
$_L['Router_Secret'] = 'Contraseña Router';
$_L['Description'] = 'Descripcion';
$_L['Router_already_exist'] = 'El enrutador IP ya existe';
$_L['Pool_Name'] = 'Nombre del Pool';
$_L['Range_IP'] = 'Rango de IP';
$_L['New_Pool'] = 'Nuevo Pool';
$_L['Add_Pool'] = 'Agregar Pool';
$_L['Edit_Pool'] = 'Editar Pool';
$_L['Pool_already_exist'] = 'Nombre del Pool ya existe';
$_L['Prepaid'] = 'Prepago';
$_L['Prepaid_User'] = 'Usuarios prepago';
$_L['Prepaid_Vouchers'] = 'Fichas prepago';
$_L['Refill_Account'] = 'Recargar Ficha';
$_L['Recharge_Account'] = 'Recargar Cuenta';
$_L['Select_Account'] = 'Seleccionar cuenta';
$_L['Service_Plan'] = 'Plan de servicio';
$_L['Recharge'] = 'Recargar';
$_L['Method'] = 'Método';
$_L['account_created_successfully'] = 'Cuenta creada con éxito';
$_L['Database_Status'] = 'Estado de la base de datos';
$_L['Total_Database_Size'] = 'Tamaño total de la base de datos';
$_L['Download_Database_Backup'] = 'Descargar copia de seguridad de la base de datos';
$_L['Table_Name'] = 'Nombre de la tabla';
$_L['Rows'] = 'Filas';
$_L['Size'] = 'Tamaño';
$_L['Customers'] = 'Clientes';
$_L['Add_Contact'] = 'Añadir nuevo contacto';
$_L['Edit_Contact'] = 'Editar contacto';
$_L['List_Contact'] = 'Lista de contactos';
$_L['Manage_Accounts'] = 'Administrar contacto';
$_L['Reports'] = 'Reportes';
$_L['Daily_Report'] = 'Reportes diarios';
$_L['Period_Reports'] = 'Informes del período';
$_L['All_Transactions'] = 'Todas las transacciones';
$_L['Total_Income'] = 'Ingresos totales';
$_L['All_Transactions_at_Date'] = 'Todas las transacciones en la fecha';
$_L['Total_Income'] = 'Ingresos totales';
$_L['Export_for_Print'] = 'Exportar para imprimir';
$_L['Print'] = 'Impresión';
$_L['Export_to_PDF'] = 'Exportar a PDF';
$_L['Click_Here_to_Print'] = 'Haga clic aquí para imprimir';
$_L['You_can_use_html_tag'] = 'Puedes usar la etiqueta html';
$_L['Date_Format'] = 'Formato de fecha';
$_L['Income_Today'] = 'Ingresos hoy';
$_L['Income_This_Month'] = 'Ingresos este mes';
$_L['Users_Active'] = 'Usuarios activos';
$_L['Total_Users'] = 'Total de usuarios';
$_L['Users'] = 'Usuarios';
$_L['Edit_User'] = 'Editar usuario';
$_L['Last_Login'] = 'Último acceso';
$_L['Administrator_Users'] = 'Usuarios administradores';
$_L['Manage_Administrator'] = 'Administrar administrador';
$_L['Add_New_Administrator'] = 'Agregar nuevo administrador';
$_L['Localisation'] = 'Localización';
$_L['Backup_Restore'] = 'Copia de seguridad/restauracion';
$_L['General_Settings'] = 'Configuración general';
$_L['Date'] = 'Fecha';
$_L['Login_Successful'] = 'Inicio de sesión exitoso';
$_L['Failed_Login'] = 'Inicio de sesión fallido';
$_L['Settings_Saved_Successfully'] = 'Configuración guardada con éxito';
$_L['User_Updated_Successfully'] = 'Usuario actualizado con éxito';
$_L['User_Expired_Today'] = 'Usuario vencido, hoy';
$_L['Activity_Log'] = 'Registro de actividades';
$_L['View_Reports'] = 'Ver los informes';
$_L['View_All'] = 'Ver todo';
$_L['Number_of_Vouchers'] = 'Número de Fichas';
$_L['Length_Code'] = 'Longitud de codigo';
$_L['Code_Voucher'] = 'Cupón de Ficha';
$_L['Voucher'] = 'Ficha';
$_L['Voucher_Hotspot'] = 'Ficha Hotspot';
$_L['Status_Voucher'] = 'Estatado de Ficha';
$_L['Add_Voucher'] = 'Agregar Ficha';
$_L['Voucher_Successfully'] = 'Crear Ficha con éxito';
$_L['Generate'] = 'Generar';
$_L['Print_Info'] = 'Imprimir uno al lado del otro, será fácil de cortar';
$_L['From_Date'] = 'Partir de la fecha';
$_L['To_Date'] = 'Hasta la fecha';
$_L['New_Service'] = 'Nuevo servicio';
$_L['Type'] = 'Tipo';
$_L['Finish'] = 'Finalizar';
$_L['App_Name'] = 'Nombre de la aplicación/ Nombre de la empresa';
$_L['App_Name_Help_Text'] = 'Este nombre se mostrará en el título';
$_L['Next'] = 'Siguiente';
$_L['Last'] = 'Atras';
$_L['Timezone'] = 'Zona horaria';
$_L['Decimal_Point'] = 'Punto decimal';
$_L['Thousands_Separator'] = 'Separador de miles';
$_L['Currency_Code'] = 'Código de moneda';
$_L['Order_Voucher'] = 'Comprobante de pedido';
$_L['Voucher_Activation'] = 'Activación de Fichas';
$_L['List_Activated_Voucher'] = 'Lista de Fichas activados';
$_L['Enter_Voucher_Code'] = 'Ingrese el código de la Ficha aquí';
$_L['Private_Message'] = 'Mensaje privado';
$_L['Inbox'] = 'Bandeja de entrada';
$_L['Outbox'] = 'Bandeja de salida';
$_L['Compose'] = 'Componer';
$_L['Send_to'] = 'Enviar a';
$_L['Title'] = 'Título';
$_L['Message'] = 'Mensaje';
$_L['Account_Information'] = 'Información de su cuenta';
$_L['Welcome_Text_User'] = 'Bienvenido a la página de Miembros del Panel, en esta página puede:';
$_L['Welcome_Text_Admin'] = '<b>MIKRO-RED</b> es un punto de acceso de facturación y PPPOE para Mikrotik que utiliza PHP y la API de Mikrotik para comunicarse con el enrutador. Si obtiene más ganancias con esta aplicación, por favor dónenos.<br>Ver proyecto <a href="https://github.com/ibnux/phpmixbill" target="_blank">aqui</a>';
//update
$_L['Invalid_Username_or_Password'] = 'Usuario o contraseña invalido';
$_L['Do_Not_Access'] = 'Usted no tiene permiso para acceder a esta página';
$_L['Incorrect_Current_Password'] = 'IContraseña actual incorrecta';
$_L['Password_Changed_Successfully'] = 'Contraseña cambiada con éxito, por favor inicie sesión de nuevo';
$_L['All_field_is_required'] = 'Todo el campo es requerido';
$_L['Voucher_Not_Valid'] = 'Ficha no válida';
$_L['Activation_Vouchers_Successfully'] = 'Fichas de activación con éxito';
$_L['Data_Not_Found'] = 'Datos no encontrados';
$_L['Search_by_Username'] = 'Buscar por nombre de usuario';
$_L['Search_by_Name'] = 'Buscar por nombre';
$_L['Search_by_Code'] = 'Búsqueda por código de Ficha';
$_L['Search'] = 'Búsqueda';
$_L['Select_Customer'] = 'Seleccione un cliente';
$_L['Select_Routers'] = 'Seleccionar enrutadores';
$_L['Select_Plans'] = 'Seleccionar planes';
$_L['Select_Pool'] = 'Seleccionar Pool';
$_L['Hrs'] = 'Hrs';
$_L['Mins'] = 'Mins';
$_L['Days'] = 'Dias';
$_L['Months'] = 'Meses';
$_L['Add_Language'] = 'Agregar idioma';
$_L['Name_Lang'] = 'Nombre del lenguaje';
$_L['Folder_Lang'] = 'Nombre de la carpeta';
$_L['Translator'] = 'Traducir';
$_L['Lang_already_exist'] = 'El nombre del idioma ya existe';
$_L['Payment_Gateway'] = 'Payment Gateway';
$_L['Community'] = 'Community';
$_L['1_user_can_be_used_for_many_devices'] = '1 user can be used for many devices?';
$_L['Cannot_be_change_after_saved'] = 'Cannot be change after saved';
$_L['Explain_Coverage_of_router'] = 'Jelaskan Cakupan wilayah hotspot';
$_L['Name_of_Area_that_router_operated'] = 'Nama Lokasi/Wilayah Router beroperasi';
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
$_L['Status'] = 'Status';
$_L['Plan_Not_found'] = 'Plan Not found';
$_L['Failed_to_create_transaction'] = 'Failed to create transaction.';
$_L['Seller_has_not_yet_setup_Xendit_payment_gateway'] = 'Seller has not yet setup Xendit payment gateway';
$_L['Admin_has_not_yet_setup_Xendit_payment_gateway_please_tell_admin'] = 'Admin has not yet setup Xendit payment gateway, please tell admin';
$_L['Buy_this_your_active_package_will_be_overwrite'] = 'Buy this? your active package will be overwrite';
$_L['You_already_have_unpaid_transaction_cancel_it_or_pay_it'] = 'You already have unpaid transaction, cancel it or pay it.';
$_L['Transaction_Not_found'] = 'Transaction Not found';
$_L['Cancel_it'] = 'Cancel it?';
$_L['expired'] = 'expired';
$_L['Check_for_Payment'] = 'Check for Payment';
$_L['Transaction_still_unpaid'] = 'Transaction still unpaid.';
$_L['Paid_Date'] = 'Paid Date';
$_L['Transaction_has_been_paid'] = 'Transaction has been paid.';
$_L['PAID'] = 'PAID';
$_L['CANCELED'] = 'CANCELED';
$_L['UNPAID'] = 'UNPAID';
$_L['PAY_NOW'] = 'PAY NOW';
$_L['Buy_Hotspot_Plan'] = 'Buy Hotspot Plan';
$_L['Buy_PPOE_Plan'] = 'Buy PPOE Plan';
$_L['Package'] = 'Package';
$_L['Order_Internet_Package'] = 'Order Internet Package';
$_L['Unknown_Command'] = 'Unknown Command.';
$_L['Checking_payment'] = 'Checking payment';
$_L['Create_Transaction_Success'] = 'Create Transaction Success';
$_L['You_have_unpaid_transaction'] = 'You have unpaid transaction';
$_L['TripayPayment_Channel'] = 'TripayPayment Channel';
$_L['Payment_Channel'] = 'Payment Channel';
$_L['Payment_check_failed'] = 'Payment check failed.';
$_L['Order_Package'] = 'Order Package';
$_L['Transactions'] = 'Transactions';
$_L['Payments'] = 'Payments';
$_L['History'] = 'History';
$_L['Order_History'] = 'Order History';
$_L['Gateway'] = 'Gateway';
$_L['Date_Done'] = 'Date Done';
$_L['Unpaid_Order'] = 'Unpaid Order';

View File

@ -3,7 +3,7 @@
-----------------------------------
Language Name: Turkish
Contributor: Goktug Bogac OGEL
Web:
Web:
Email: goktugogel@gmail.com
------------------------------------
*/
@ -221,4 +221,51 @@ $_L['Add_Language'] = 'Dil Ekle';
$_L['Name_Lang'] = 'Dil adı';
$_L['Folder_Lang'] = 'Klasör adı';
$_L['Translator'] = 'Çevirmen';
$_L['Lang_already_exist'] = 'Dil Adı Zaten Var';
$_L['Lang_already_exist'] = 'Dil Adı Zaten Var';
$_L['Payment_Gateway'] = 'Payment Gateway';
$_L['Community'] = 'Community';
$_L['1_user_can_be_used_for_many_devices'] = '1 user can be used for many devices?';
$_L['Cannot_be_change_after_saved'] = 'Cannot be change after saved';
$_L['Explain_Coverage_of_router'] = 'Jelaskan Cakupan wilayah hotspot';
$_L['Name_of_Area_that_router_operated'] = 'Nama Lokasi/Wilayah Router beroperasi';
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
$_L['Status'] = 'Status';
$_L['Plan_Not_found'] = 'Plan Not found';
$_L['Failed_to_create_transaction'] = 'Failed to create transaction.';
$_L['Seller_has_not_yet_setup_Xendit_payment_gateway'] = 'Seller has not yet setup Xendit payment gateway';
$_L['Admin_has_not_yet_setup_Xendit_payment_gateway_please_tell_admin'] = 'Admin has not yet setup Xendit payment gateway, please tell admin';
$_L['Buy_this_your_active_package_will_be_overwrite'] = 'Buy this? your active package will be overwrite';
$_L['You_already_have_unpaid_transaction_cancel_it_or_pay_it'] = 'You already have unpaid transaction, cancel it or pay it.';
$_L['Transaction_Not_found'] = 'Transaction Not found';
$_L['Cancel_it'] = 'Cancel it?';
$_L['expired'] = 'expired';
$_L['Check_for_Payment'] = 'Check for Payment';
$_L['Transaction_still_unpaid'] = 'Transaction still unpaid.';
$_L['Paid_Date'] = 'Paid Date';
$_L['Transaction_has_been_paid'] = 'Transaction has been paid.';
$_L['PAID'] = 'PAID';
$_L['CANCELED'] = 'CANCELED';
$_L['UNPAID'] = 'UNPAID';
$_L['PAY_NOW'] = 'PAY NOW';
$_L['Buy_Hotspot_Plan'] = 'Buy Hotspot Plan';
$_L['Buy_PPOE_Plan'] = 'Buy PPOE Plan';
$_L['Package'] = 'Package';
$_L['Order_Internet_Package'] = 'Order Internet Package';
$_L['Unknown_Command'] = 'Unknown Command.';
$_L['Checking_payment'] = 'Checking payment';
$_L['Create_Transaction_Success'] = 'Create Transaction Success';
$_L['You_have_unpaid_transaction'] = 'You have unpaid transaction';
$_L['TripayPayment_Channel'] = 'TripayPayment Channel';
$_L['Payment_Channel'] = 'Payment Channel';
$_L['Payment_check_failed'] = 'Payment check failed.';
$_L['Order_Package'] = 'Order Package';
$_L['Transactions'] = 'Transactions';
$_L['Payments'] = 'Payments';
$_L['History'] = 'History';
$_L['Order_History'] = 'Order History';
$_L['Gateway'] = 'Gateway';
$_L['Date_Done'] = 'Date Done';
$_L['Unpaid_Order'] = 'Unpaid Order';

View File

@ -0,0 +1,90 @@
[
{
"id": "BC",
"name": "BCA"
},
{
"id": "M2",
"name": "Mandiri"
},
{
"id": "VA",
"name": "Maybank"
},
{
"id": "I1",
"name": "BNI"
},
{
"id": "B1",
"name": "CIMB Niaga"
},
{
"id": "BT",
"name": "Permata Bank"
},
{
"id": "A1",
"name": "ATM Bersama"
},
{
"id": "AG",
"name": "Artha Graha"
},
{
"id": "BR",
"name": "BRIVA"
},
{
"id": "S1",
"name": "Bank Sahabat Sampoerna"
},
{
"id": "OV",
"name": "OVO"
},
{
"id": "SA",
"name": "Shopee Pay"
},
{
"id": "LF",
"name": "LinkAja Apps (Fixed Fee)"
},
{
"id": "LA",
"name": "LinkAja Apps (Percentage Fee)"
},
{
"id": "DA",
"name": "DANA"
},
{
"id": "SP",
"name": "QRIS Shopee Pay"
},
{
"id": "LQ",
"name": "QRIS LinkAja"
},
{
"id": "NQ",
"name": "QRIS Nobu"
},
{
"id": "FT",
"name": "Pegadaian/ALFA/Pos"
},
{
"id": "A2",
"name": "POS Indonesia"
},
{
"id": "IR",
"name": "Indomaret"
},
{
"id": "VC",
"name": "Credit Card (Visa / Master Card / JCB)"
}
]

View File

@ -0,0 +1,66 @@
[
{
"id": "credit_card",
"name": "Credit Card"
},
{
"id": "bca_va",
"name": "BCA"
},
{
"id": "permata_va",
"name": "Permata"
},
{
"id": "bni_va",
"name": "BNI"
},
{
"id": "bri_va",
"name": "BRI"
},
{
"id": "echannel",
"name": "Mandiri Bill"
},
{
"id": "gopay",
"name": "Gopay"
},
{
"id": "bca_klikbca",
"name": "KLIKBCA"
},
{
"id": "bca_klikpay",
"name": "BCA KLIKPAY"
},
{
"id": "cimb_clicks",
"name": "CIMB Clicks"
},
{
"id": "danamon_online",
"name": "Danamon"
},
{
"id": "bri_epay",
"name": "BRImo"
},
{
"id": "indomaret",
"name": "Indomaret"
},
{
"id": "alfamart",
"name": "Alfamart"
},
{
"id": "ShopeePay",
"name": "ShopeePay"
},
{
"id": "uob_ezpay",
"name": "UOB EZ Pay"
}
]

View File

@ -0,0 +1,74 @@
[
{
"id": "PERMATAVA",
"name": "Permata Bank"
},
{
"id": "MYBVA",
"name": "Maybank"
},
{
"id": "BNIVA",
"name": "BNI"
},
{
"id": "BRIVA",
"name": "BRI"
},
{
"id": "MANDIRIVA",
"name": "Mandiri"
},
{
"id": "BCAVA",
"name": "BCA"
},
{
"id": "SMSVA",
"name": "Sinarmas"
},
{
"id": "MUAMALATVA",
"name": "Muamalat"
},
{
"id": "SAMPOERNAVA",
"name": "Sahabat Sampoerna"
},
{
"id": "BSIVA",
"name": "BSI"
},
{
"id": "ALFAMART",
"name": "Alfamart "
},
{
"id": "INDOMARET",
"name": "Indomaret "
},
{
"id": "ALFAMIDI",
"name": "Alfamidi "
},
{
"id": "OVO",
"name": "OVO"
},
{
"id": "QRIS",
"name": "QRIS by ShopeePay"
},
{
"id": "QRISC",
"name": "QRIS (Customizable)"
},
{
"id": "QRIS2",
"name": "QRIS"
},
{
"id": "SHOPEEPAY",
"name": "ShopeePay "
}
]

View File

@ -0,0 +1,66 @@
[
{
"id": "CREDIT_CARD",
"name": "CREDIT CARD"
},
{
"id": "PERMATA",
"name": "Permata Bank"
},
{
"id": "BNI",
"name": "BNI"
},
{
"id": "BRI",
"name": "BRI"
},
{
"id": "MANDIRI",
"name": "Mandiri"
},
{
"id": "BCA",
"name": "BCA"
},
{
"id": "BSI",
"name": "BSI"
},
{
"id": "DD_BRI",
"name": "Direct Debit BRI"
},
{
"id": "DD_BCA_KLIKPAY",
"name": "Direct Debit BCA KLIKPAY"
},
{
"id": "ALFAMART",
"name": "Alfamart "
},
{
"id": "INDOMARET",
"name": "Indomaret "
},
{
"id": "OVO",
"name": "OVO"
},
{
"id": "DANA",
"name": "DANA"
},
{
"id": "LINKAJA",
"name": "LinkAja"
},
{
"id": "SHOPEEPAY",
"name": "ShopeePay "
},
{
"id": "QRIS",
"name": "QRIS"
}
]

View File

@ -0,0 +1,170 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway duitku.com
**/
function duitku_validate_config()
{
global $config;
if (empty($config['duitku_merchant_key'])) {
sendTelegram("Duitku payment gateway not configured");
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Duitku payment gateway, please tell admin"));
}
}
function duitku_show_config()
{
global $ui, $config;
$ui->assign('_title', 'Duitku - Payment Gateway - ' . $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true));
$ui->display('pg-duitku.tpl');
}
function duitku_save_config()
{
global $admin;
$duitku_merchant_id = _post('duitku_merchant_id');
$duitku_merchant_key = _post('duitku_merchant_key');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_merchant_id')->find_one();
if ($d) {
$d->value = $duitku_merchant_id;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_merchant_id';
$d->value = $duitku_merchant_id;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_merchant_key')->find_one();
if ($d) {
$d->value = $duitku_merchant_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_merchant_key';
$d->value = $duitku_merchant_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_channel')->find_one();
if ($d) {
$d->value = implode(',', $_POST['duitku_channel']);
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_channel';
$d->value = implode(',', $_POST['duitku_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Duitku ' . Lang::T('Settings_Saved_Successfully'), 'Admin', $admin['id']);
r2(U . 'paymentgateway/duitku', 's', Lang::T('Settings_Saved_Successfully'));
}
function duitku_create_transaction($trx, $user)
{
global $config, $routes, $ui;
$channels = json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true);
if (!in_array($routes[4], explode(",", $config['duitku_channel']))) {
$ui->assign('_title', 'Duitku Channel - ' . $config['CompanyName']);
$ui->assign('channels', $channels);
$ui->assign('duitku_channels', explode(",", $config['duitku_channel']));
$ui->assign('path', $routes['2'] . '/' . $routes['3']);
$ui->display('duitku_channel.tpl');
die();
}
$json = [
'paymentMethod' => $routes[4],
'paymentAmount' => $trx['price'],
'merchantCode' => $config['duitku_merchant_id'],
'merchantOrderId' => $trx['id'],
'productDetails' => $trx['plan_name'],
'merchantUserInfo' => $user['fullname'],
'customerVaName' => $user['fullname'],
'email' => (empty($user['email'])) ? $user['username'] . '@' . $_SERVER['HTTP_HOST'] : $user['email'],
'phoneNumber' => $user['phonenumber'],
'itemDetails' => [
[
'name' => $trx['plan_name'],
'price' => $trx['price'],
'quantity' => 1
]
],
'returnUrl' => U . 'order/view/' . $trx['id'] . '/check',
'signature' => md5($config['duitku_merchant_id'] . $trx['id'] . $trx['price'] . $config['duitku_merchant_key'])
];
$result = json_decode(Http::postJsonData(duitku_get_server() . 'v2/inquiry', $json), true);
if (empty($result['paymentUrl'])) {
sendTelegram("Duitku payment failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
$d->gateway_trx_id = $result['reference'];
$d->pg_url_payment = $result['paymentUrl'];
$d->payment_method = $routes['4'];
foreach ($channels as $channel) {
if ($channel['id'] == $routes['4']) {
$d->payment_channel = $channel['name'];
break;
}
}
$d->pg_request = json_encode($result);
$d->expired_date = date('Y-m-d H:i:s', strtotime("+1 day"));
$d->save();
r2(U . "order/view/" . $d['id'], 's', Lang::T("Create Transaction Success"));
}
function duitku_get_status($trx, $user)
{
global $config;
$json = [
'merchantCode' => $config['duitku_merchant_id'],
'merchantOrderId' => $trx['id'],
'signature' => md5($config['duitku_merchant_id'] . $trx['id'] . $config['duitku_merchant_key'])
];
$result = json_decode(Http::postJsonData(duitku_get_server() . 'transactionStatus', $json), true);
if ($result['reference'] != $trx['gateway_trx_id']) {
sendTelegram("Duitku payment status failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Payment check failed."));
}
if ($result['statusCode'] == '01') {
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
} else if ($result['statusCode'] == '00' && $trx['status'] != 2) {
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $trx['payment_channel'])) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
}
$trx->pg_paid_response = json_encode($result);
$trx->paid_date = date('Y-m-d H:i:s');
$trx->status = 2;
$trx->save();
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
} else if ($result['statusCode'] == '02') {
$trx->pg_paid_response = json_encode($result);
$trx->status = 3;
$trx->save();
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired or Failed."));
} else if ($trx['status'] == 2) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
}
}
function duitku_get_server()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://passport.duitku.com/webapi/api/merchant/';
} else {
return 'https://sandbox.duitku.com/webapi/api/merchant/';
}
}

View File

@ -0,0 +1,172 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway tripay.com
**/
function duitku_validate_config()
{
global $config;
if (empty($config['tripay_secret_key'])) {
sendTelegram("Tripay payment gateway not configured");
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Tripay payment gateway, please tell admin"));
}
}
function tripay_show_config()
{
global $ui, $config;
$ui->assign('_title', 'Tripay - Payment Gateway - ' . $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true));
$ui->display('pg-tripay.tpl');
}
function tripay_save_config()
{
global $admin, $_L;
$tripay_merchant = _post('tripay_merchant');
$tripay_api_key = _post('tripay_api_key');
$tripay_secret_key = _post('tripay_secret_key');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_merchant')->find_one();
if ($d) {
$d->value = $tripay_merchant;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_merchant';
$d->value = $tripay_merchant;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_api_key')->find_one();
if ($d) {
$d->value = $tripay_api_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_api_key';
$d->value = $tripay_api_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_secret_key')->find_one();
if ($d) {
$d->value = $tripay_secret_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_secret_key';
$d->value = $tripay_secret_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_channel')->find_one();
if ($d) {
$d->value = implode(',', $_POST['tripay_channel']);
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_channel';
$d->value = implode(',', $_POST['tripay_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Tripay ' . $_L['Settings_Saved_Successfully'] . json_encode($_POST['tripay_channel']), 'Admin', $admin['id']);
r2(U . 'paymentgateway/tripay', 's', $_L['Settings_Saved_Successfully']);
}
function tripay_create_transaction($trx, $user)
{
global $config, $routes, $ui;
$channels = json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true);
if (!in_array($routes[4], explode(",", $config['tripay_channel']))) {
$ui->assign('_title', 'Tripay Channel - ' . $config['CompanyName']);
$ui->assign('channels', $channels);
$ui->assign('tripay_channels', explode(",", $config['tripay_channel']));
$ui->assign('path', $routes[2] . '/' . $routes[3]);
$ui->display('tripay_channel.tpl');
die();
}
$json = [
'method' => $routes[4],
'amount' => $trx['price'],
'merchant_ref' => $trx['id'],
'customer_name' => $user['fullname'],
'customer_email' => (empty($user['email'])) ? $user['username'] . '@' . $_SERVER['HTTP_HOST'] : $user['email'],
'customer_phone' => $user['phonenumber'],
'order_items' => [
[
'name' => $trx['plan_name'],
'price' => $trx['price'],
'quantity' => 1
]
],
'return_url' => U . 'order/view/' . $trx['id'] . '/check',
'signature' => hash_hmac('sha256', $config['tripay_merchant'] . $trx['id'] . $trx['price'], $config['tripay_secret_key'])
];
$result = json_decode(Http::postJsonData(tripay_get_server() . 'transaction/create', $json, ['Authorization: Bearer ' . $config['tripay_api_key']]), true);
if ($result['success'] != 1) {
sendTelegram("Tripay payment failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
$d->gateway_trx_id = $result['data']['reference'];
$d->pg_url_payment = $result['data']['checkout_url'];
$d->pg_request = json_encode($result);
$d->expired_date = date('Y-m-d H:i:s', $result['data']['expired_time']);
$d->save();
r2(U . "order/view/" . $d['id'], 's', Lang::T("Create Transaction Success"));
}
function tripay_get_status($trx, $user)
{
global $config;
$result = json_decode(Http::getData(tripay_get_server() . 'transaction/detail?' . http_build_query(['reference' => $trx['gateway_trx_id']]), [
'Authorization: Bearer ' . $config['tripay_api_key']
]), true);
if ($result['success'] != 1) {
sendTelegram("Tripay payment status failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Payment check failed."));
}
$result = $result['data'];
if ($result['status'] == 'UNPAID') {
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
} else if (in_array($result['status'], ['PAID', 'SETTLED']) && $trx['status'] != 2) {
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_name'])) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
}
$trx->pg_paid_response = json_encode($result);
$trx->payment_method = $result['payment_method'];
$trx->payment_channel = $result['payment_name'];
$trx->paid_date = date('Y-m-d H:i:s', $result['paid_at']);
$trx->status = 2;
$trx->save();
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
} else if (in_array($result['status'], ['EXPIRED', 'FAILED', 'REFUND'])) {
$trx->pg_paid_response = json_encode($result);
$trx->status = 3;
$trx->save();
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired."));
} else if ($trx['status'] == 2) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
}
}
function tripay_get_server()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://tripay.co.id/api/';
} else {
return 'https://tripay.co.id/api-sandbox/';
}
}

View File

@ -0,0 +1,150 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway xendit.com
**/
function xendit_validate_config()
{
global $config;
if (empty($config['xendit_secret_key']) || empty($config['xendit_verification_token'])) {
sendTelegram("Xendit payment gateway not configured");
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Xendit payment gateway, please tell admin"));
}
}
function xendit_show_config()
{
global $ui, $config;
$ui->assign('_title', 'Xendit - Payment Gateway - ' . $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_xendit.json'), true));
$ui->display('pg-xendit.tpl');
}
function xendit_save_config()
{
global $admin, $_L;
$xendit_secret_key = _post('xendit_secret_key');
$xendit_verification_token = _post('xendit_verification_token');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_secret_key')->find_one();
if ($d) {
$d->value = $xendit_secret_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_secret_key';
$d->value = $xendit_secret_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_verification_token')->find_one();
if ($d) {
$d->value = $xendit_verification_token;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_verification_token';
$d->value = $xendit_verification_token;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_channel')->find_one();
if ($d) {
$d->value = implode(',', $_POST['xendit_channel']);
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_channel';
$d->value = implode(',', $_POST['xendit_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Xendit ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
r2(U . 'paymentgateway/xendit', 's', $_L['Settings_Saved_Successfully']);
}
function xendit_create_transaction($trx, $user)
{
global $config;
$json = [
'external_id' => $trx['id'],
'amount' => $trx['price'],
'description' => $trx['plan_name'],
'customer' => [
'mobile_number' => $user['phonenumber'],
],
'customer_notification_preference' => [
'invoice_created' => ['whatsapp', 'sms'],
'invoice_reminder' => ['whatsapp', 'sms'],
'invoice_paid' => ['whatsapp', 'sms'],
'invoice_expired' => ['whatsapp', 'sms']
],
'payment_methods ' => explode(',', $config['xendit_channel']),
'success_redirect_url' => U . 'order/view/' . $trx['id'] . '/check',
'failure_redirect_url' => U . 'order/view/' . $trx['id'] . '/check'
];
$result = json_decode(Http::postJsonData(xendit_get_server() . 'invoices', $json, ['Authorization: Basic ' . base64_encode($config['xendit_secret_key'] . ':')]), true);
if (!$result['id']) {
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
$d->gateway_trx_id = $result['id'];
$d->pg_url_payment = $result['invoice_url'];
$d->pg_request = json_encode($result);
$d->expired_date = date('Y-m-d H:i:s', strtotime($result['expiry_date']));
$d->save();
header('Location: ' . $result['invoice_url']);
exit();
}
function xendit_get_status($trx, $user)
{
global $config;
$result = json_decode(Http::getData(xendit_get_server() . 'invoices/' . $trx['gateway_trx_id'], [
'Authorization: Basic ' . base64_encode($config['xendit_secret_key'] . ':')
]), true);
if ($result['status'] == 'PENDING') {
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
} else if (in_array($result['status'], ['PAID', 'SETTLED']) && $trx['status'] != 2) {
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_channel'])) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
}
$trx->pg_paid_response = json_encode($result);
$trx->payment_method = $result['payment_method'];
$trx->payment_channel = $result['payment_channel'];
$trx->paid_date = date('Y-m-d H:i:s', strtotime($result['updated']));
$trx->status = 2;
$trx->save();
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
} else if ($result['status'] == 'EXPIRED') {
$trx->pg_paid_response = json_encode($result);
$trx->status = 3;
$trx->save();
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired."));
} else if ($trx['status'] == 2) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
}else{
sendTelegram("xendit_get_status: unknown result\n\n".json_encode($result, JSON_PRETTY_PRINT));
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Unknown Command."));
}
}
function xendit_get_server()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://api.xendit.co/v2/';
} else {
return 'https://api.xendit.co/v2/';
}
}

26
system/radius.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
if(php_sapi_name() !== 'cli'){
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
}
require(__DIR__.'/config.php');
require(__DIR__.'/orm.php');
use PEAR2\Net\RouterOS;
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
ORM::configure('password', $db_password);
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
$result = ORM::for_table('tbl_appconfig')->find_many();
foreach($result as $value){
$config[$value['setting']]=$value['value'];
}
date_default_timezone_set($config['timezone']);

View File

View File

@ -1,57 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['General_Settings']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['App_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="company" name="company" value="{$_c['CompanyName']}">
<span class="help-block">{$_L['App_Name_Help_Text']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea class="form-control" id="address" name="address" rows="3">{$_c['address']}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
</div>
</div>
<div class="form-group hidden">
<label class="col-md-2 control-label">Theme</label>
<div class="col-md-6">
<select name="theme" id="theme" class="form-control">
<option value="default" {if $_c['theme'] eq 'default'}selected="selected" {/if}>Default</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Note Invoice</label>
<div class="col-md-6">
<textarea class="form-control" id="note" name="note" rows="3">{$_c['note']}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,57 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['Bandwidth_Plans']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}bandwidth/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}bandwidth/add" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['New_Bandwidth']}</a>
</div>&nbsp;
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{$_L['BW_Name']}</th>
<th>{$_L['Rate_Download']}</th>
<th>{$_L['Rate_Upload']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['name_bw']}</td>
<td>{$ds['rate_down']} {$ds['rate_down_unit']}</td>
<td>{$ds['rate_up']} {$ds['rate_up_unit']}</td>
<td>
<a href="{$_url}bandwidth/edit/{$ds['id']}" class="btn btn-sm btn-warning">{$_L['Edit']}</a>
<a href="{$_url}bandwidth/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,60 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['Manage_Accounts']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}customers/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="username" class="form-control" placeholder="{$_L['Search_by_Username']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}customers/add" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['Add_Contact']}</a>
</div>&nbsp;
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Full_Name']}</th>
<th>{$_L['Phone_Number']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Recharge']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['fullname']}</td>
<td>{$ds['phonenumber']}</td>
<td>{$ds['created_at']}</td>
<td align="center"><a href="{$_url}prepaid/recharge-user/{$ds['id']}" id="{$ds['id']}" class="btn btn-primary btn-sm">{$_L['Recharge']}</a></td>
<td align="center">
<a href="{$_url}customers/edit/{$ds['id']}" class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}customers/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,27 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">Public Disquss</div>
<div class="panel-body">
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "https://ibnux.github.io/phpmixbill/diskusi.html"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = "phpmixbill"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://phpmixbill.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,120 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Plan']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}services/add-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
<div class="col-md-10">
<input type="radio" id="Unlimited" name="typebp" value="Unlimited" checked> {$_L['Unlimited']}
<input type="radio" id="Limited" name="typebp" value="Limited"> {$_L['Limited']}
</div>
</div>
<div style="display:none;" id="Type">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
<div class="col-md-10">
<input type="radio" id="Time_Limit" name="limit_type" value="Time_Limit" checked> {$_L['Time_Limit']}
<input type="radio" id="Data_Limit" name="limit_type" value="Data_Limit"> {$_L['Data_Limit']}
<input type="radio" id="Both_Limit" name="limit_type" value="Both_Limit"> {$_L['Both_Limit']}
</div>
</div>
</div>
<div style="display:none;" id="TimeLimit">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Time_Limit']}</label>
<div class="col-md-4">
<input type="text" class="form-control" id="time_limit" name="time_limit" value="0">
</div>
<div class="col-md-2">
<select class="form-control" id="time_unit" name="time_unit">
<option value="Hrs">{$_L['Hrs']}</option>
<option value="Mins">{$_L['Mins']}</option>
</select>
</div>
</div>
</div>
<div style="display:none;" id="DataLimit">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Data_Limit']}</label>
<div class="col-md-4">
<input type="text" class="form-control" id="data_limit" name="data_limit" value="0">
</div>
<div class="col-md-2">
<select class="form-control" id="data_unit" name="data_unit">
<option value="MB">MBs</option>
<option value="GB">GBs</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control">
<option value="">{$_L['Select_BW']}...</option>
{foreach $d as $ds}
<option value="{$ds['id']}">{$ds['name_bw']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="pricebp" name="pricebp">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Shared_Users']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="sharedusers" name="sharedusers" value="1">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
<div class="col-md-4">
<input type="text" class="form-control" id="validity" name="validity">
</div>
<div class="col-md-2">
<select class="form-control" id="validity_unit" name="validity_unit">
<option value="Days">{$_L['Days']}</option>
<option value="Months">{$_L['Months']}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control">
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,67 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['Hotspot_Plans']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}services/hotspot/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}services/add" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['New_Plan']}</a>
</div>&nbsp;
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Type']}</th>
<th>{$_L['Bandwidth_Plans']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Time_Limit']}</th>
<th>{$_L['Data_Limit']}</th>
<th>{$_L['Plan_Validity']}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['name_plan']}</td>
<td>{$ds['typebp']}</td>
<td>{$ds['name_bw']}</td>
<td>{$ds['price']}</td>
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['routers']}</td>
<td>
<a href="{$_url}services/edit/{$ds['id']}" class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,40 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel mb20 panel-primary panel-hovered">
<div class="panel-heading">{$_L[$pageHeader]}</div>
<div id="myNicPanel" style="width: 100%;"></div>
<div id="panel-edit" class="panel-body">{$htmls}</div>
{if $writeable}
<div class="panel-footer">
<a href="javascript:saveIt()" class="btn btn-primary btn-block">SAVE</a>
<br>
<p class="help-block">{$_L['Info_Page']}</p>
</div>
{else}
<div class="panel-footer">
{$_L['Failed_Save_Page']}
</div>
{/if}
</div>
</div>
</div>
<form id="formpages" class="hidden" method="post" role="form" action="{$_url}pages/{$pageHeader}-post" >
<textarea name="html" id="html"></textarea>
</form>
<script src="{$_theme}/scripts/nicEdit.js"></script>
<script type="text/javascript">
var myNicEditor
bkLib.onDomLoaded(function() {
myNicEditor = new nicEditor();
myNicEditor.setPanel('myNicPanel');
myNicEditor.addInstance('panel-edit');
});
function saveIt(){
//alert(document.getElementById('panel-edit').innerHTML);
document.getElementById('html').value = nicEditors.findEditor('panel-edit').getContent()
document.getElementById('formpages').submit();
}
</script>
{include file="sections/footer.tpl"}

View File

@ -1,59 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['Pool']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}pool/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}pool/add" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['New_Pool']}</a>
</div>&nbsp;
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>#</th>
<th>{$_L['Pool_Name']}</th>
<th>{$_L['Range_IP']}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{$no = 1}
{foreach $d as $ds}
<tr>
<td align="center">{$no++}</td>
<td>{$ds['pool_name']}</td>
<td>{$ds['range_ip']}</td>
<td>{$ds['routers']}</td>
<td align="center">
<a href="{$_url}pool/edit/{$ds['id']}" class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}pool/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,62 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['PPPOE_Plans']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}services/pppoe/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}services/pppoe-add" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['New_Plan']}</a>
</div>&nbsp;
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Bandwidth_Plans']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Plan_Validity']}</th>
<th>{$_L['Pool']}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['name_plan']}</td>
<td>{$ds['name_bw']}</td>
<td>{$ds['price']}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['pool']}</td>
<td>{$ds['routers']}</td>
<td>
<a href="{$_url}services/pppoe-edit/{$ds['id']}" class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}services/pppoe-delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,65 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['Prepaid_User']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}prepaid/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="username" class="form-control" placeholder="{$_L['Search_by_Username']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}prepaid/recharge" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['Recharge_Account']}</a>
</div>&nbsp;
</div>
<table id="datatable" class="table table-striped table-bordered">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['namebp']}</td>
<td>{$ds['type']}</td>
<td>{$ds['recharged_on']} {$ds['time']}</td>
<td>{$ds['expiration']} {$ds['time']}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
<td>
<a href="{$_url}prepaid/edit/{$ds['id']}" class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}prepaid/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,72 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>{$_title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{$_theme}/styles/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" type="image/x-icon" href="{$_theme}/images/favicon.ico">
<style type="text/css">
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
</style>
</head>
<body>
<div class="row">
<div class="col-md-12">
<div id="printable">
<h4>{$_L['All_Transactions_at_Date']}: {date($_c['date_format'], strtotime($mdate))}</h4>
<table class="table table-condensed table-bordered" style="background: #ffffff">
<th class="text-center">{$_L['Username']}</th>
<th class="text-center">{$_L['Plan_Name']}</th>
<th class="text-center">{$_L['Type']}</th>
<th class="text-center">{$_L['Plan_Price']}</th>
<th class="text-center">{$_L['Created_On']}</th>
<th class="text-center">{$_L['Expires_On']}</th>
<th class="text-center">{$_L['Method']}</th>
<th class="text-center">{$_L['Routers']}</th>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td class="text-center">{$ds['plan_name']}</td>
<td class="text-center">{$ds['type']}</td>
<td class="text-right">{$_c['currency_code']} {number_format($ds['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))} {$ds['time']}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td class="text-center">{$ds['method']}</td>
<td class="text-center">{$ds['routers']}</td>
</tr>
{/foreach}
</table>
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
</div>
</div>
<button type="button" id="actprint" class="btn btn-default btn-sm no-print">{$_L['Click_Here_to_Print']}</button>
</div>
</div>
<script src="{$_theme}/scripts/jquery-1.10.2.js"></script>
<script src="{$_theme}/scripts/bootstrap.min.js"></script>
{if isset($xfooter)}
{$xfooter}
{/if}
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
$("#actprint").click(function() {
window.print();
return false;
});
});
</script>
</body>
</html>

View File

@ -1,72 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>{$_title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{$_theme}/styles/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" type="image/x-icon" href="{$_theme}/images/favicon.ico">
<style type="text/css">
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
</style>
</head>
<body>
<div class="row">
<div class="col-md-12">
<div id="printable">
<h4>{$_L['All_Transactions_at_Date']}: {date( $_c['date_format'], strtotime($fdate))} - {date( $_c['date_format'], strtotime($tdate))}</h4>
<table class="table table-condensed table-bordered" style="background: #ffffff">
<th class="text-center">{$_L['Username']}</th>
<th class="text-center">{$_L['Plan_Name']}</th>
<th class="text-center">{$_L['Type']}</th>
<th class="text-center">{$_L['Plan_Price']}</th>
<th class="text-center">{$_L['Created_On']}</th>
<th class="text-center">{$_L['Expires_On']}</th>
<th class="text-center">{$_L['Method']}</th>
<th class="text-center">{$_L['Routers']}</th>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td class="text-center">{$ds['plan_name']}</td>
<td class="text-center">{$ds['type']}</td>
<td class="text-right">{$_c['currency_code']} {number_format($ds['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))} {$ds['time']}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td class="text-center">{$ds['method']}</td>
<td class="text-center">{$ds['routers']}</td>
</tr>
{/foreach}
</table>
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
</div>
</div>
<button type="button" id="actprint" class="btn btn-default btn-sm no-print">{$_L['Click_Here_to_Print']}</button>
</div>
</div>
<script src="{$_theme}/scripts/jquery-1.10.2.js"></script>
<script src="{$_theme}/scripts/bootstrap.min.js"></script>
{if isset($xfooter)}
{$xfooter}
{/if}
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
$("#actprint").click(function() {
window.print();
return false;
});
});
</script>
</body>
</html>

View File

@ -1,61 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-md-12">
<div class="invoice-wrap">
<div class="clearfix invoice-head">
<h3 class="brand-logo text-uppercase text-bold left mt15">
<span class="text">{$_L['Daily_Report']}</span>
</h3>
</div>
<div class="clearfix invoice-subhead mb20">
<div class="group clearfix left">
<p class="text-bold mb5">{$_L['All_Transactions_at_Date']}:</p>
<p class="small">{date($_c['date_format'], strtotime($mdate))} {$mtime}</p>
</div>
<div class="group clearfix right">
<a href="{$_url}export/print-by-date" class="btn btn-default" target="_blank"><i class="ion ion-printer"></i>{$_L['Export_for_Print']}</a>
<a href="{$_url}export/pdf-by-date" class="btn btn-default"><i class="fa fa-file-pdf-o"></i>{$_L['Export_to_PDF']}</a>
</div>
</div>
<table class="table table-bordered invoice-table mb10">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
<th>{$_L['Routers']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['type']}</td>
<td>{$ds['plan_name']}</td>
<td class="text-right">{$_c['currency_code']} {number_format($ds['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))} {$ds['time']}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
</div>
<p class="text-center small text-info">{$_L['All_Transactions_at_Date']}: {date($_c['date_format'], strtotime($mdate))} {$mtime}</p>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,69 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-md-12">
<div class="invoice-wrap">
<div class="clearfix invoice-head">
<h3 class="brand-logo text-uppercase text-bold left mt15">
<span class="text">{$_L['Daily_Report']}</span>
</h3>
</div>
<div class="clearfix invoice-subhead mb20">
<div class="group clearfix left">
<p class="text-bold mb5">{$_L['All_Transactions_at_Date']}:</p>
<p class="small">{$stype} [{date( $_c['date_format'], strtotime($fdate))} - {date( $_c['date_format'], strtotime($tdate))}]</p>
</div>
<div class="group clearfix right">
<form method="post" action="{$_url}export/print-by-period" target="_blank">
<input type="hidden" name="fdate" value="{$fdate}">
<input type="hidden" name="tdate" value="{$tdate}">
<input type="hidden" name="stype" value="{$stype}">
<button type="submit" class="btn btn-default"><i class="fa fa-print"></i> {$_L['Export_for_Print']}</button>
</form>
<form method="post" action="{$_url}export/pdf-by-period" target="_blank">
<input type="hidden" name="fdate" value="{$fdate}">
<input type="hidden" name="tdate" value="{$tdate}">
<input type="hidden" name="stype" value="{$stype}">
<button type="submit" class="btn btn-default"><i class="fa fa-file-pdf-o"></i> {$_L['Export_to_PDF']}</button>
</form>
</div>
</div>
<table class="table table-bordered invoice-table mb10">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
<th>{$_L['Routers']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['type']}</td>
<td>{$ds['plan_name']}</td>
<td class="text-right">{$_c['currency_code']} {number_format($ds['price'],0,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))} {$ds['time']}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
</tr>
{/foreach}
</tbody>
</table>
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
</div>
<p class="text-center small text-info">{$stype} [{date( $_c['date_format'], strtotime($fdate))} - {date( $_c['date_format'], strtotime($tdate))}]</p>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,55 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Router']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}routers/add-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="ip_address" name="ip_address">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="username" name="username">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Secret']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="password" name="password">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Description']}</label>
<div class="col-md-6">
<textarea class="form-control" id="description" name="description"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}routers/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,55 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Router']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}routers/edit-post" >
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name" value="{$d['name']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="ip_address" name="ip_address" value="{$d['ip_address']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="username" name="username" value="{$d['username']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Secret']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="password" name="password" value="{$d['password']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Description']}</label>
<div class="col-md-6">
<textarea class="form-control" id="description" name="description">{$d['description']}</textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}routers/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,60 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">{$_L['Routers']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}routers/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}routers/add" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['New_Router']}</a>
</div>&nbsp;
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{$_L['Router_Name']}</th>
<th>{$_L['IP_Address']}</th>
<th>{$_L['Username']}</th>
<th>{$_L['Description']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['name']}</td>
<td>{$ds['ip_address']}</td>
<td>{$ds['username']}</td>
<td>{$ds['description']}</td>
<td>
<a href="{$_url}routers/edit/{$ds['id']}" class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}routers/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,40 +0,0 @@
{include file="sections/user-header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel mb20 panel-hovered panel-default">
<div class="panel-heading">{$_L['List_Activated_Voucher']}</div>
<div class="panel-body">
<table id="datatable" class="table table-striped table-bordered">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['plan_name']}</td>
<td>{$ds['type']}</td>
<td class="text-success">{date($_c['date_format'], strtotime($ds['recharged_on']))} {$ds['time']}</td>
<td class="text-danger">{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
</tr>
{/foreach}
</tbody>
</table>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/user-footer.tpl"}

View File

@ -1,79 +0,0 @@
{include file="sections/user-header.tpl"}
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">{$_L['Welcome']}, {$_user['fullname']}</div>
<div class="panel-body" style="height:296px;max-height:296px;overflow:scroll;">
<p>{$_L['Welcome_Text_User']}</p>
<ul>
<li> {$_L['Account_Information']}</li>
<li> <a href="{$_url}voucher/activation">{$_L['Voucher_Activation']}</a></li>
<li> <a href="{$_url}voucher/list-activated">{$_L['List_Activated_Voucher']}</a></li>
<li> <a href="{$_url}accounts/change-password">{$_L['Change_Password']}</a></li>
<li> {$_L['Order_Voucher']}</li>
<li> {$_L['Private_Message']}</li>
</ul>
</div>
</div>
</div>
<div class="col-md-6">
<br class="visible-xs-inline visible-sm-inline">
<div class="panel panel-default">
<div class="panel-heading">{$_L['Announcement']}</div>
<div class="panel-body" style="height:296px;max-height:296px;overflow:scroll;">
{include file="$_path/../pages/Announcement.html"}
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default table-condensed">
<div class="panel-heading">{$_L['Account_Information']}</div>
<table class="table table-striped table-bordered">
<tr>
<td class="small text-success text-uppercase text-normal">{$_L['Username']}</td>
<td class="small mb15">{$_bill['username']}</td>
</tr>
<tr>
<td class="small text-primary text-uppercase text-normal">{$_L['Plan_Name']}</td>
<td class="small mb15">{$_bill['namebp']}</td>
</tr>
<tr>
<td class="small text-info text-uppercase text-normal">{$_L['Created_On']}</td>
<td class="small mb15">{if $_bill['time'] ne ''}{date($_c['date_format'], strtotime($_bill['recharged_on']))} {$_bill['time']}{/if}&nbsp;</td>
</tr>
<tr>
<td class="small text-danger text-uppercase text-normal">{$_L['Expires_On']}</td>
<td class="small mb15">{if $_bill['time'] ne ''}{date($_c['date_format'], strtotime($_bill['expiration']))} {$_bill['time']}{/if}&nbsp;</td>
</tr>
</table>
</div>
</div>
<div class="col-sm-6">
<br class="visible-xs-inline visible-sm-inline">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Voucher_Activation']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}voucher/activation-post" >
<div class="form-group">
<label class="col-md-4 control-label">{$_L['Code_Voucher']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="code" name="code" placeholder="{$_L['Enter_Voucher_Code']}">
</div>
</div>
<div class="form-group">
<div align="center">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Recharge']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/user-footer.tpl"}

View File

@ -1,8 +0,0 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -1,8 +0,0 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -1,10 +1,10 @@
{include file="sections/user-header.tpl"}
<div class="page page-err clearfix">
<div class="err-container">
<h1 class="m404 mb0">404 <a href="{$_url}home" class="ion ion-forward" title="go to dashboard"></a></h1>
<p class="text-desc mb20">Coming Soon!! Next Version...</p>
</div>
</div>
{include file="sections/user-header.tpl"}
<div class="page page-err clearfix">
<div class="err-container">
<h1 class="m404 mb0">404 <a href="{$_url}home" class="ion ion-forward" title="go to dashboard"></a></h1>
<p class="text-desc mb20">Coming Soon!! Next Version...</p>
</div>
</div>
{include file="sections/user-footer.tpl"}

View File

@ -1,10 +1,10 @@
{include file="sections/header.tpl"}
<div class="page page-err clearfix">
<div class="err-container">
<h1 class="m404 mb0">404 <a href="{$_url}dashboard" class="ion ion-forward" title="go to dashboard"></a></h1>
<p class="text-desc mb20">Coming Soon!! Next Version...</p>
</div>
</div>
{include file="sections/header.tpl"}
<div class="page page-err clearfix">
<div class="err-container">
<h1 class="m404 mb0">404 <a href="{$_url}dashboard" class="ion ion-forward" title="go to dashboard"></a></h1>
<p class="text-desc mb20">Coming Soon!! Next Version...</p>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -1,72 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{$_title} - {$_L['Login']}</title>
<link rel="shortcut icon" href="{$_theme}/images/logo.png" type="image/x-icon" />
<!-- Icons -->
<link rel="stylesheet" href="{$_theme}/fonts/ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="{$_theme}/fonts/font-awesome/css/font-awesome.min.css">
<!-- Plugins -->
<link rel="stylesheet" href="{$_theme}/styles/plugins/waves.css">
<link rel="stylesheet" href="{$_theme}/styles/plugins/perfect-scrollbar.css">
<!-- Css/Less Stylesheets -->
<link rel="stylesheet" href="{$_theme}/styles/bootstrap.min.css">
<link rel="stylesheet" href="{$_theme}/styles/main.min.css">
<!-- <link href='http://fonts.googleapis.com/css?family=Roboto:400,500,700,300' rel='stylesheet' type='text/css'> -->
<!-- Match Media polyfill for IE9 -->
<!--[if IE 9]> <script src="{$_theme}/scripts/ie/matchMedia.js"></script> <![endif]-->
</head>
<body id="app" class="app off-canvas body-full">
<div class="main-container clearfix">
<div class="content-container" id="content">
<div class="page page-auth">
<div class="auth-container">
<div class="form-head mb20">
<h1 class="site-logo h2 mb5 mt5 text-center text-uppercase text-bold">{$_L['Logo']}</h1>
<h5 class="text-normal h5 text-center">{$_L['Sign_In_Admin']}</h5>
</div>
{if isset($notify)}
{$notify}
{/if}
<div class="form-container">
<form class="form-horizontal" action="{$_url}admin/post" method="post">
<div class="md-input-container md-float-label">
<input type="text" name="username" class="md-input">
<label>{$_L['Username']}</label>
</div>
<div class="md-input-container md-float-label">
<input type="password" name="password" class="md-input">
<label>{$_L['Password']}</label>
</div>
<div class="clearfix">
<div class="ui-checkbox ui-checkbox-primary right">
<label>
<input type="checkbox">
<span>Remember me</span>
</label>
</div>
</div>
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<button type="submit" class="btn btn-success">{$_L['Login']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="scripts/vendors.js"></script>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{$_title} - {$_L['Login']}</title>
<link rel="shortcut icon" href="{$_theme}/images/logo.png" type="image/x-icon" />
<!-- Icons -->
<link rel="stylesheet" href="{$_theme}/fonts/ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="{$_theme}/fonts/font-awesome/css/font-awesome.min.css">
<!-- Plugins -->
<link rel="stylesheet" href="{$_theme}/styles/plugins/waves.css">
<link rel="stylesheet" href="{$_theme}/styles/plugins/perfect-scrollbar.css">
<!-- Css/Less Stylesheets -->
<link rel="stylesheet" href="{$_theme}/styles/bootstrap.min.css">
<link rel="stylesheet" href="{$_theme}/styles/main.min.css">
<!-- Match Media polyfill for IE9 -->
<!--[if IE 9]> <script src="{$_theme}/scripts/ie/matchMedia.js"></script> <![endif]-->
</head>
<body id="app" class="app off-canvas body-full">
<div class="main-container clearfix">
<div class="content-container" id="content">
<div class="page page-auth">
<div class="auth-container">
<div class="form-head mb20">
<h1 class="site-logo h2 mb5 mt5 text-center text-uppercase text-bold">{$_L['Logo']}</h1>
<h5 class="text-normal h5 text-center">{$_L['Sign_In_Admin']}</h5>
</div>
{if isset($notify)}
{$notify}
{/if}
<div class="form-container">
<form class="form-horizontal" action="{$_url}admin/post" method="post">
<div class="md-input-container md-float-label">
<input type="text" name="username" class="md-input">
<label>{$_L['Username']}</label>
</div>
<div class="md-input-container md-float-label">
<input type="password" name="password" class="md-input">
<label>{$_L['Password']}</label>
</div>
<div class="clearfix">
<div class="ui-checkbox ui-checkbox-primary right">
<label>
<input type="checkbox">
<span>Remember me</span>
</label>
</div>
</div>
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<button type="submit" class="btn btn-success">{$_L['Login']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="scripts/vendors.js"></script>
</body>
</html>

View File

@ -1,80 +1,80 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Localisation']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/localisation-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Timezone']}</label>
<div class="col-md-6">
<select name="tzone" id="tzone" class="form-control">
{foreach $tlist as $value => $label}
<option value="{$value}" {if $_c['timezone'] eq $value}selected="selected" {/if}>{$label}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Date_Format']}</label>
<div class="col-md-6">
<select class="form-control" name="date_format" id="date_format">
<option value="d/m/Y" {if $_c['date_format'] eq 'd/m/Y'} selected="selected" {/if}>{date('d/m/Y')}</option>
<option value="d.m.Y" {if $_c['date_format'] eq 'd.m.Y'} selected="selected" {/if}>{date('d.m.Y')}</option>
<option value="d-m-Y" {if $_c['date_format'] eq 'd-m-Y'} selected="selected" {/if}>{date('d-m-Y')}</option>
<option value="m/d/Y" {if $_c['date_format'] eq 'm/d/Y'} selected="selected" {/if}>{date('m/d/Y')}</option>
<option value="Y/m/d" {if $_c['date_format'] eq 'Y/m/d'} selected="selected" {/if}>{date('Y/m/d')}</option>
<option value="Y-m-d" {if $_c['date_format'] eq 'Y-m-d'} selected="selected" {/if}>{date('Y-m-d')}</option>
<option value="M d Y" {if $_c['date_format'] eq 'M d Y'} selected="selected" {/if}>{date('M d Y')}</option>
<option value="d M Y" {if $_c['date_format'] eq 'd M Y'} selected="selected" {/if}>{date('d M Y')}</option>
<option value="jS M y" {if $_c['date_format'] eq 'jS M y'} selected="selected" {/if}>{date('jS M y')}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Default_Language']}</label>
<div class="col-md-4">
<select class="form-control" name="lan" id="lan">
{foreach $lan as $lans}
<option value="{$lans['folder']}" {if $_c['language'] eq $lans['folder']} selected="selected" {/if}>{$lans['name']}</option>
{/foreach}
</select>
</div>
<div class="col-md-2">
<a href="{$_url}settings/language" type="button" class="btn btn-line-success btn-icon-inline"><i class="ion ion-android-add"></i>{$_L['Add_Language']}</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Decimal_Point']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="dec_point" name="dec_point" value="{$_c['dec_point']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Thousands_Separator']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="thousands_sep" name="thousands_sep" value="{$_c['thousands_sep']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Currency_Code']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="currency_code" name="currency_code" value="{$_c['currency_code']}">
<span class="help-block">{$_L['currency_help']}</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Localisation']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/localisation-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Timezone']}</label>
<div class="col-md-6">
<select name="tzone" id="tzone" class="form-control">
{foreach $tlist as $value => $label}
<option value="{$value}" {if $_c['timezone'] eq $value}selected="selected" {/if}>{$label}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Date_Format']}</label>
<div class="col-md-6">
<select class="form-control" name="date_format" id="date_format">
<option value="d/m/Y" {if $_c['date_format'] eq 'd/m/Y'} selected="selected" {/if}>{date('d/m/Y')}</option>
<option value="d.m.Y" {if $_c['date_format'] eq 'd.m.Y'} selected="selected" {/if}>{date('d.m.Y')}</option>
<option value="d-m-Y" {if $_c['date_format'] eq 'd-m-Y'} selected="selected" {/if}>{date('d-m-Y')}</option>
<option value="m/d/Y" {if $_c['date_format'] eq 'm/d/Y'} selected="selected" {/if}>{date('m/d/Y')}</option>
<option value="Y/m/d" {if $_c['date_format'] eq 'Y/m/d'} selected="selected" {/if}>{date('Y/m/d')}</option>
<option value="Y-m-d" {if $_c['date_format'] eq 'Y-m-d'} selected="selected" {/if}>{date('Y-m-d')}</option>
<option value="M d Y" {if $_c['date_format'] eq 'M d Y'} selected="selected" {/if}>{date('M d Y')}</option>
<option value="d M Y" {if $_c['date_format'] eq 'd M Y'} selected="selected" {/if}>{date('d M Y')}</option>
<option value="jS M y" {if $_c['date_format'] eq 'jS M y'} selected="selected" {/if}>{date('jS M y')}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Default_Language']}</label>
<div class="col-md-4">
<select class="form-control" name="lan" id="lan">
{foreach $lan as $lans}
<option value="{$lans['folder']}" {if $_c['language'] eq $lans['folder']} selected="selected" {/if}>{$lans['name']}</option>
{/foreach}
</select>
</div>
<div class="col-md-2">
<a href="{$_url}settings/language" type="button" class="btn btn-line-success btn-icon-inline"><i class="ion ion-android-add"></i>{$_L['Add_Language']}</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Decimal_Point']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="dec_point" name="dec_point" value="{$_c['dec_point']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Thousands_Separator']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="thousands_sep" name="thousands_sep" value="{$_c['thousands_sep']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Currency_Code']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="currency_code" name="currency_code" value="{$_c['currency_code']}">
<span class="help-block">{$_L['currency_help']}</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

119
ui/ui/app-settings.tpl Normal file
View File

@ -0,0 +1,119 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" >
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['General_Settings']}</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['App_Name']}</label>
<div class="col-md-6">
<input type="text" required class="form-control" id="company" name="company" value="{$_c['CompanyName']}">
<span class="help-block">{$_L['App_Name_Help_Text']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea class="form-control" id="address" name="address" rows="3">{$_c['address']}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
</div>
</div>
<div class="form-group hidden">
<label class="col-md-2 control-label">Radius Mode?</label>
<div class="col-md-6">
<select name="radius_mode" id="radius_mode" class="form-control">
<option value="0">No</option>
<option value="1" {if $_c['radius_mode']}selected="selected" {/if}>Yes</option>
</select>
<p class="help-block">Still on Testing.</p>
<p class="help-block">Changing from Radius will not add existing user to Mikrotik Hotspot.</p>
<p class="help-block">With Radius user can use Hotspot or PPOE.</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">APP URL</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" value="{$app_url}">
<p class="help-block">system/config.php</p>
</div>
</div>
</div>
<div class="panel-heading">Telegram Notification</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Telegram Bot Token</label>
<div class="col-md-6">
<input type="text" class="form-control" id="telegram_bot" name="telegram_bot" value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Telegram Target ID</label>
<div class="col-md-6">
<input type="text" class="form-control" id="telegram_target_id" name="telegram_target_id" value="{$_c['telegram_target_id']}" placeholder="12345678">
</div>
</div>
</div>
<div class="panel-heading">SMS OTP Registration</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">SMS Server URL</label>
<div class="col-md-6">
<input type="text" class="form-control" id="sms_url" name="sms_url" value="{$_c['sms_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
</div>
</div>
</div>
<div class="panel-heading">Whatsapp Notification</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Whatsapp Server URL</label>
<div class="col-md-6">
<input type="text" class="form-control" id="wa_url" name="wa_url" value="{$_c['wa_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
</div>
</div>
</div>
<div class="panel-heading">Tawk.to Chat Widget</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">https://tawk.to/chat/</label>
<div class="col-md-6">
<input type="text" class="form-control" id="tawkto" name="tawkto" value="{$_c['tawkto']}" placeholder="62f1ca7037898912e961f5/1ga07df">
<p class="help-block">From Direct Chat Link.</p>
<pre>/ip hotspot walled-garden
add dst-host=tawk.to
add dst-host=*.tawk.to</pre>
</div>
</div>
</div>
<div class="panel-heading">Invoice</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Note Invoice</label>
<div class="col-md-6">
<textarea class="form-control" id="note" name="note" rows="3">{$_c['note']}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</div>
<pre>/ip hotspot walled-garden
add dst-host={$_domain}
add dst-host=*.{$_domain}</pre>
</div>
</div>
</div>
</form>
{include file="sections/footer.tpl"}

View File

@ -1,4 +1,4 @@
{foreach $d as $ds}
<option value="{$ds['pool_name']}">{$ds['pool_name']}</option>
{foreach $d as $ds}
<option value="{$ds['pool_name']}">{$ds['pool_name']}</option>
{/foreach}

View File

@ -1,4 +1,4 @@
<option value="">Select Routers</option>
{foreach $d as $ds}
<option value="{$ds['name']}">{$ds['name']}</option>
<option value="">Select Routers</option>
{foreach $d as $ds}
<option value="{$ds['name']}">{$ds['name']}</option>
{/foreach}

Some files were not shown because too many files have changed in this diff Show More