From 980af58eb1d6252eb12807185a697b1f51853da5 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 29 Apr 2024 13:20:57 +0700 Subject: [PATCH] fix logic extend from admin --- system/controllers/plan.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/system/controllers/plan.php b/system/controllers/plan.php index 7b1c387f..671a3587 100644 --- a/system/controllers/plan.php +++ b/system/controllers/plan.php @@ -738,18 +738,18 @@ switch ($action) { } $tur = ORM::for_table('tbl_user_recharges')->find_one($id); $status = $tur['status']; - if (strtotime($tur['expiration'] . ' ' . $tur['time']) > time()) { - // not expired - $expiration = date('Y-m-d', strtotime($tur['expiration'] . " +$days day")); - } else { - //expired - $expiration = date('Y-m-d', strtotime(" +$days day")); - } - $tur->expiration = $expiration; - $tur->status = "on"; - $tur->save(); - App::setToken($stoken, $id); if ($status == 'off') { + if (strtotime($tur['expiration'] . ' ' . $tur['time']) > time()) { + // not expired + $expiration = date('Y-m-d', strtotime($tur['expiration'] . " +$days day")); + } else { + //expired + $expiration = date('Y-m-d', strtotime(" +$days day")); + } + $tur->expiration = $expiration; + $tur->status = "on"; + $tur->save(); + App::setToken($stoken, $id); if ($tur['routers'] != 'radius') { $mikrotik = Mikrotik::info($tur['routers']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);