diff --git a/system/autoload/Package.php b/system/autoload/Package.php index 4b3a491e..7eadb406 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -97,6 +97,8 @@ class Package if ($b) { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addHotspotUser($client, $p, $c); @@ -152,6 +154,8 @@ class Package } else { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addHotspotUser($client, $p, $c); @@ -197,6 +201,8 @@ class Package if ($b) { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addPpoeUser($client, $p, $c); @@ -253,6 +259,8 @@ class Package } else { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addPpoeUser($client, $p, $c); @@ -332,6 +340,8 @@ class Package if ($b) { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addHotspotUser($client, $p, $c); @@ -339,6 +349,8 @@ class Package } else { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addHotspotUser($client, $p, $c); @@ -348,6 +360,8 @@ class Package if ($b) { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addPpoeUser($client, $p, $c); @@ -355,6 +369,8 @@ class Package } else { if (!$_c['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + Mikrotik::removeHotspotActiveUser($client, $c['username']); + Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::addPpoeUser($client, $p, $c); diff --git a/system/cron.php b/system/cron.php index da89c13e..2ab7cc5d 100644 --- a/system/cron.php +++ b/system/cron.php @@ -28,6 +28,12 @@ function _autoloader($class) } spl_autoload_register('_autoloader'); + +if(php_sapi_name() !== 'cli'){ + echo "
"; +} + + require_once '../config.php'; require_once 'orm.php'; require_once 'autoload/PEAR2/Autoload.php'; @@ -56,6 +62,14 @@ foreach ($result as $value) { $config[$value['setting']] = $value['value']; } +echo "PHP Time\t" . date('Y-m-d H:i:s') . "\n"; +$res = ORM::raw_execute('SELECT NOW() AS WAKTU;'); +$statement = ORM::get_last_statement(); +$rows = array(); +while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { + echo "MYSQL Time\t" . $row['WAKTU'] . "\n"; +} + $_c = $config; date_default_timezone_set($config['timezone']); diff --git a/system/cron_reminder.php b/system/cron_reminder.php index e06e6aa4..5a55e180 100644 --- a/system/cron_reminder.php +++ b/system/cron_reminder.php @@ -12,16 +12,16 @@ function _autoloader($class) { if (strpos($class, '_') !== false) { $class = str_replace('_', DIRECTORY_SEPARATOR, $class); - if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { - include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; + if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { + include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; } else { $class = str_replace("\\", DIRECTORY_SEPARATOR, $class); if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; } } else { - if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { - include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; + if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { + include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; } else { $class = str_replace("\\", DIRECTORY_SEPARATOR, $class); if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) @@ -31,10 +31,14 @@ function _autoloader($class) } spl_autoload_register('_autoloader'); - require_once '../config.php'; - require_once 'orm.php'; - require_once 'autoload/PEAR2/Autoload.php'; - include "autoload/Hookers.php"; +if(php_sapi_name() !== 'cli'){ + echo ""; +} + +require_once '../config.php'; +require_once 'orm.php'; +require_once 'autoload/PEAR2/Autoload.php'; +include "autoload/Hookers.php"; ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure('username', $db_user); @@ -65,6 +69,14 @@ $d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many(); run_hook('cronjob_reminder'); #HOOK +echo "PHP Time\t" . date('Y-m-d H:i:s') . "\n"; +$res = ORM::raw_execute('SELECT NOW() AS WAKTU;'); +$statement = ORM::get_last_statement(); +$rows = array(); +while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { + echo "MYSQL Time\t" . $row['WAKTU'] . "\n"; +} + $day7 = date('Y-m-d', strtotime("+7 day")); $day3 = date('Y-m-d', strtotime("+3 day"));