notif to telegram

This commit is contained in:
Ibnu Maksum 2022-09-01 15:35:54 +07:00
parent dd116ee248
commit a0dc6c7274
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
11 changed files with 270 additions and 278 deletions

View File

@ -179,6 +179,27 @@ function _log($description, $type = '', $userid = '0')
$d->save(); $d->save();
} }
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 time_elapsed_string($datetime, $full = false) function time_elapsed_string($datetime, $full = false)
{ {
$now = new DateTime; $now = new DateTime;

View File

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

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

@ -190,6 +190,9 @@ switch ($action) {
$t->routers = $server; $t->routers = $server;
$t->type = "Hotspot"; $t->type = "Hotspot";
$t->save(); $t->save();
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else { } else {
try { try {
$iport = explode(":", $mikrotik['ip_address']); $iport = explode(":", $mikrotik['ip_address']);
@ -282,6 +285,9 @@ switch ($action) {
$t->routers = $server; $t->routers = $server;
$t->type = "Hotspot"; $t->type = "Hotspot";
$t->save(); $t->save();
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} }
} else { } else {
@ -339,6 +345,9 @@ switch ($action) {
$t->routers = $server; $t->routers = $server;
$t->type = "PPPOE"; $t->type = "PPPOE";
$t->save(); $t->save();
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else { } else {
try { try {
$iport = explode(":", $mikrotik['ip_address']); $iport = explode(":", $mikrotik['ip_address']);
@ -382,6 +391,9 @@ switch ($action) {
$t->routers = $server; $t->routers = $server;
$t->type = "PPPOE"; $t->type = "PPPOE";
$t->save(); $t->save();
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} }
} }
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one(); $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();

View File

@ -143,6 +143,10 @@ switch ($action) {
$t->routers = $v1['routers']; $t->routers = $v1['routers'];
$t->type = "Hotspot"; $t->type = "Hotspot";
$t->save(); $t->save();
// Telegram to Admin
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else { } else {
try { try {
$iport = explode(":", $mikrotik['ip_address']); $iport = explode(":", $mikrotik['ip_address']);
@ -234,6 +238,10 @@ switch ($action) {
$t->routers = $v1['routers']; $t->routers = $v1['routers'];
$t->type = "Hotspot"; $t->type = "Hotspot";
$t->save(); $t->save();
// Telegram to Admin
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} }
$v1->status = "1"; $v1->status = "1";
@ -291,6 +299,10 @@ switch ($action) {
$t->routers = $v1['routers']; $t->routers = $v1['routers'];
$t->type = "PPPOE"; $t->type = "PPPOE";
$t->save(); $t->save();
// Telegram to Admin
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else { } else {
try { try {
$iport = explode(":", $mikrotik['ip_address']); $iport = explode(":", $mikrotik['ip_address']);
@ -334,6 +346,9 @@ switch ($action) {
$t->routers = $v1['routers']; $t->routers = $v1['routers'];
$t->type = "PPPOE"; $t->type = "PPPOE";
$t->save(); $t->save();
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} }
$v1->status = "1"; $v1->status = "1";

View File

@ -26,7 +26,7 @@
<input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}"> <input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group hidden">
<label class="col-md-2 control-label">Theme</label> <label class="col-md-2 control-label">Theme</label>
<div class="col-md-6"> <div class="col-md-6">
<select name="theme" id="theme" class="form-control"> <select name="theme" id="theme" class="form-control">
@ -40,13 +40,13 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">Telegram Bot Token</label> <label class="col-md-2 control-label">Telegram Bot Token</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="telegram_bot" name="telegram_bot" value="{$_c['telegram_bot']}"> <input type="text" class="form-control" id="telegram_bot" name="telegram_bot" value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">Telegram Target ID</label> <label class="col-md-2 control-label">Telegram Target ID</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="telegram_target_id" name="telegram_target_id" value="{$_c['telegram_target_id']}"> <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>
</div> </div>

View File

@ -1,34 +1,34 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12"> <div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30"> <div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Contact']}</div> <div class="panel-heading">{$_L['Add_Contact']}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post" > <form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post" >
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label> <label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="username" name="username"> <input type="text" class="form-control" id="username" name="username" required placeholder="Phone number">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Full_Name']}</label> <label class="col-md-2 control-label">{$_L['Full_Name']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="fullname" name="fullname"> <input type="text" required class="form-control" id="fullname" name="fullname">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Password']}</label> <label class="col-md-2 control-label">{$_L['Password']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="password" class="form-control" id="password" name="password"> <input type="password" class="form-control" required id="password" name="password">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Confirm_Password']}</label> <label class="col-md-2 control-label">{$_L['Confirm_Password']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="password" class="form-control" id="cpassword" name="cpassword"> <input type="password" class="form-control" required id="cpassword" name="cpassword">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -37,13 +37,7 @@
<textarea name="address" id="address" class="form-control"></textarea> <textarea name="address" id="address" class="form-control"></textarea>
</div> </div>
</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="phonenumber" name="phonenumber">
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button> <button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
@ -56,6 +50,6 @@
</div> </div>
</div> </div>
</div> </div>
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}

View File

@ -5,13 +5,13 @@
<div class="panel panel-default panel-hovered panel-stacked mb30"> <div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Contact']}</div> <div class="panel-heading">{$_L['Edit_Contact']}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post" > <form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post" >
<input type="hidden" name="id" value="{$d['id']}"> <input type="hidden" name="id" value="{$d['id']}">
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label> <label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="username" name="username" value="{$d['username']}"> <input type="text" class="form-control" id="username" name="username" value="{$d['username']}" placeholder="Phone Number" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

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

@ -5,7 +5,7 @@
<div class="panel panel-default panel-hovered panel-stacked mb30"> <div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Recharge_Account']}</div> <div class="panel-heading">{$_L['Recharge_Account']}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/recharge-post" > <form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/recharge-post" >
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label> <label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6"> <div class="col-md-6">
@ -24,8 +24,8 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Type']}</label> <label class="col-md-2 control-label">{$_L['Type']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="radio" id="Hot" name="type" value="Hotspot"> {$_L['Hotspot_Plans']} <input type="radio" id="Hot" name="type" value="Hotspot"> {$_L['Hotspot_Plans']}
<input type="radio" id="POE" name="type" value="PPPOE"> {$_L['PPPOE_Plans']} <input type="radio" id="POE" name="type" value="PPPOE"> {$_L['PPPOE_Plans']}
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -36,7 +36,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label> <label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6"> <div class="col-md-6">
@ -48,7 +48,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Recharge']}</button> <button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Recharge']}</button>
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a> Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
</div> </div>
</div> </div>
@ -57,6 +57,6 @@
</div> </div>
</div> </div>
</div> </div>
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}

View File

@ -5,7 +5,7 @@
<div class="panel panel-default panel-hovered panel-stacked mb30"> <div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Recharge_Account']}</div> <div class="panel-heading">{$_L['Recharge_Account']}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/recharge-post" > <form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/recharge-post" >
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label> <label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6"> <div class="col-md-6">
@ -20,8 +20,8 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Type']}</label> <label class="col-md-2 control-label">{$_L['Type']}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="radio" id="Hot" name="type" value="Hotspot"> {$_L['Hotspot_Plans']} <input type="radio" id="Hot" name="type" value="Hotspot"> {$_L['Hotspot_Plans']}
<input type="radio" id="POE" name="type" value="PPPOE"> {$_L['PPPOE_Plans']} <input type="radio" id="POE" name="type" value="PPPOE"> {$_L['PPPOE_Plans']}
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -32,7 +32,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label> <label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6"> <div class="col-md-6">
@ -44,7 +44,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Recharge']}</button> <button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Recharge']}</button>
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a> Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
</div> </div>
</div> </div>