public function latestMacFromIP($ipaddress)
 {
     // We limit the selection to a machine that has connected in the last
     // hour, (this may need to be updated in the future with
     // CallingStationId for multiple APs)
     $sql = sprintf("SELECT username from radpostauth\n                        WHERE FramedIPAddress=%s\n                        AND username LIKE '__-__-__-__-__-__'\n                        AND authdate > TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 HOUR))\n\n                        ORDER BY ID DESC\n                        LIMIT 1", $this->db->quote($ipaddress));
     $mac = $this->db->queryOne($sql);
     if (PEAR::isError($mac)) {
         \Grase\ErrorHandling::fatalDatabaseError(T_('Retrieving MAC from IP failed: '), $mac);
     }
     // Check its a MAC address??
     return $mac;
 }
Пример #2
0
 public function deleteVoucher($vouchername)
 {
     $delete = $this->radmin->prepare("DELETE FROM vouchers WHERE VoucherName=?");
     $result = $delete->execute(array($vouchername));
     if ($result === false) {
         ErrorHandling::fatalDatabaseError(T_('Delete Voucher query failed:  '), $result);
     }
     \AdminLog::getInstance()->log("Voucher {$vouchername} deleted");
     return $result;
 }