forked from kevinowino869/mitrobill
Minutes and Hour Plan Validity
This commit is contained in:
parent
ba83833e94
commit
e6eff99632
@ -86,7 +86,19 @@ switch ($action) {
|
|||||||
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
|
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
|
||||||
|
|
||||||
$mikrotik = Router::_info($server);
|
$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 ($type == 'Hotspot') {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
@ -708,7 +720,20 @@ switch ($action) {
|
|||||||
$time = date("H:i:s");
|
$time = date("H:i:s");
|
||||||
|
|
||||||
$mikrotik = Router::_info($v1['routers']);
|
$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) {
|
||||||
if ($v1['type'] == 'Hotspot') {
|
if ($v1['type'] == 'Hotspot') {
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
/**
|
/**
|
||||||
* 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();
|
_auth();
|
||||||
$ui->assign('_title', $_L['Voucher'] . '- ' . $config['CompanyName']);
|
$ui->assign('_title', $_L['Voucher'] . '- ' . $config['CompanyName']);
|
||||||
@ -40,8 +36,19 @@ switch ($action) {
|
|||||||
$time = date("H:i:s");
|
$time = date("H:i:s");
|
||||||
|
|
||||||
$mikrotik = Router::_info($v1['routers']);
|
$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) {
|
||||||
if ($v1['type'] == 'Hotspot') {
|
if ($v1['type'] == 'Hotspot') {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
@ -143,10 +150,6 @@ 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']);
|
||||||
@ -238,15 +241,15 @@ 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";
|
||||||
$v1->user = $c['username'];
|
$v1->user = $c['username'];
|
||||||
$v1->save();
|
$v1->save();
|
||||||
|
// Telegram to Admin
|
||||||
|
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
|
||||||
|
"\nRouter: ".$v1['routers'].
|
||||||
|
"\nPrice: ".$p['price']);
|
||||||
} else {
|
} else {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
@ -299,10 +302,6 @@ 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']);
|
||||||
@ -346,14 +345,15 @@ 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";
|
||||||
$v1->user = $c['username'];
|
$v1->user = $c['username'];
|
||||||
$v1->save();
|
$v1->save();
|
||||||
|
// Telegram to Admin
|
||||||
|
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
|
||||||
|
"\nRouter: ".$v1['routers'].
|
||||||
|
"\nPrice: ".$p['price']);
|
||||||
}
|
}
|
||||||
|
|
||||||
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
|
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="panel-heading">{$_L['Add_Plan']}</div>
|
<div class="panel-heading">{$_L['Add_Plan']}</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/add-post" >
|
<form class="form-horizontal" method="post" role="form" action="{$_url}services/add-post" >
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -16,17 +16,17 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
|
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input type="radio" id="Unlimited" name="typebp" value="Unlimited" checked> {$_L['Unlimited']}
|
<input type="radio" id="Unlimited" name="typebp" value="Unlimited" checked> {$_L['Unlimited']}
|
||||||
<input type="radio" id="Limited" name="typebp" value="Limited"> {$_L['Limited']}
|
<input type="radio" id="Limited" name="typebp" value="Limited"> {$_L['Limited']}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display:none;" id="Type">
|
<div style="display:none;" id="Type">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
|
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
|
||||||
<div class="col-md-10">
|
<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="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="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']}
|
<input type="radio" id="Both_Limit" name="limit_type" value="Both_Limit"> {$_L['Both_Limit']}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -88,8 +88,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||||
<option value="Days">{$_L['Days']}</option>
|
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}</option>
|
||||||
<option value="Months">{$_L['Months']}</option>
|
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}</option>
|
||||||
|
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}</option>
|
||||||
|
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>{$_L['Months']}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -103,7 +105,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</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-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
||||||
@ -111,7 +113,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,17 +17,17 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
|
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input type="radio" id="Unlimited" name="typebp" value="Unlimited" {if $d['typebp'] eq 'Unlimited'} checked {/if}> {$_L['Unlimited']}
|
<input type="radio" id="Unlimited" name="typebp" value="Unlimited" {if $d['typebp'] eq 'Unlimited'} checked {/if}> {$_L['Unlimited']}
|
||||||
<input type="radio" id="Limited" name="typebp" value="Limited" {if $d['typebp'] eq 'Limited'} checked {/if}> {$_L['Limited']}
|
<input type="radio" id="Limited" name="typebp" value="Limited" {if $d['typebp'] eq 'Limited'} checked {/if}> {$_L['Limited']}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {/if} id="Type">
|
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {/if} id="Type">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
|
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input type="radio" id="Time_Limit" name="limit_type" value="Time_Limit" {if $d['limit_type'] eq 'Time_Limit'} checked {/if}> {$_L['Time_Limit']}
|
<input type="radio" id="Time_Limit" name="limit_type" value="Time_Limit" {if $d['limit_type'] eq 'Time_Limit'} checked {/if}> {$_L['Time_Limit']}
|
||||||
<input type="radio" id="Data_Limit" name="limit_type" value="Data_Limit" {if $d['limit_type'] eq 'Data_Limit'} checked {/if}> {$_L['Data_Limit']}
|
<input type="radio" id="Data_Limit" name="limit_type" value="Data_Limit" {if $d['limit_type'] eq 'Data_Limit'} checked {/if}> {$_L['Data_Limit']}
|
||||||
<input type="radio" id="Both_Limit" name="limit_type" value="Both_Limit" {if $d['limit_type'] eq 'Both_Limit'} checked {/if}> {$_L['Both_Limit']}
|
<input type="radio" id="Both_Limit" name="limit_type" value="Both_Limit" {if $d['limit_type'] eq 'Both_Limit'} checked {/if}> {$_L['Both_Limit']}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -88,6 +88,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||||
|
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}</option>
|
||||||
|
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}</option>
|
||||||
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}</option>
|
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}</option>
|
||||||
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>{$_L['Months']}</option>
|
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>{$_L['Months']}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -99,7 +101,7 @@
|
|||||||
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
|
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
|
||||||
</div>
|
</div>
|
||||||
</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-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
||||||
@ -107,7 +109,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user