- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php
r860 r873 70 70 $IPAddress = GetRemoteAddress(); 71 71 $Output = 'Vaše IP adresa je: '.$IPAddress.'<br/>'; 72 if (IsInternetAddr($IPAddress)) {72 if (IsInternetAddr($IPAddress)) { 73 73 $Output .= '<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>'; 74 return ($Output);74 return ($Output); 75 75 } 76 76 $Time = time(); … … 78 78 $DbResult = $this->Database->select('NetworkFreeAccess', '*', '(IPAddress="'.$IPAddress. 79 79 '") ORDER BY Time DESC LIMIT 1'); 80 if ($DbResult->num_rows > 0)80 if ($DbResult->num_rows > 0) 81 81 { 82 82 $DbRow = $DbResult->fetch_assoc(); 83 83 $ActivationTime = MysqlDateTimeToTime($DbRow['Time']); 84 if (($ActivationTime + $this->Timeout) < $Time)84 if (($ActivationTime + $this->Timeout) < $Time) 85 85 { 86 86 $Activated = false; … … 88 88 } else $Activated = false; 89 89 90 if (array_key_exists('a', $_GET))90 if (array_key_exists('a', $_GET)) 91 91 { 92 if ($_GET['a'] == 'activate')92 if ($_GET['a'] == 'activate') 93 93 { 94 if ($Activated == false)94 if ($Activated == false) 95 95 { 96 96 $DbResult = $this->Database->insert('NetworkFreeAccess', … … 108 108 109 109 $PrefixMultiplier = new PrefixMultiplier(); 110 if ($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');110 if ($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time'); 111 111 else $Output .= '<a href="?a=activate">Aktivovat</a>'; 112 112 113 return ($Output);113 return ($Output); 114 114 } 115 115 } … … 122 122 $Commands = array(); 123 123 $DbResult = $this->Database->select('NetworkFreeAccess', '`Id`, `IPAddress`', '(`Configured`=0)'); 124 while ($DbRow = $DbResult->fetch_assoc())124 while ($DbRow = $DbResult->fetch_assoc()) 125 125 { 126 126 $Commands[] = '/ip firewall address-list add address='.$DbRow['IPAddress']. … … 135 135 $Routerboard->ExecuteBatch(implode(';', $Commands)); 136 136 137 return ($Output);137 return ($Output); 138 138 } 139 139 }
Note:
See TracChangeset
for help on using the changeset viewer.