Esempio n. 1
0
 $uid = $UserManager->uID;
 if (!($res = QuerySql("SELECT id,time,cmtval,IP,\n\t\tNoBSSID,BSSID,ESSID,\n\t\tSecurity,WiFiKey,WPSPIN,\n\t\tWANIP,latitude,longitude \n\t\tFROM favorites \n\t\tINNER JOIN BASE_TABLE USING(id) \n\t\tLEFT JOIN comments USING(cmtid) \n\t\tLEFT JOIN GEO_TABLE USING(BSSID) \n\t\tWHERE uid={$uid}"))) {
     $json['error'] = 'database';
     break;
 }
 $json['result'] = true;
 $json['data'] = array();
 while ($row = $res->fetch_row()) {
     $ap = array();
     $ap['id'] = (int) $row[0];
     $ap['time'] = $row[1];
     $ap['comment'] = $row[2];
     $ip = _long2ip($row[3]);
     $wanip = _long2ip($row[10]);
     $ap['range'] = $ip != '' ? $ip : ($wanip != '' ? $wanip : '');
     if (isLocalIP($ap['range']) && $ap['range'] != $wanip && isValidIP($wanip) && !isLocalIP($wanip)) {
         $ap['range'] = $wanip;
     }
     if (isValidIP($ap['range'])) {
         $oct = explode('.', $ap['range']);
         array_pop($oct);
         array_pop($oct);
         $ap['range'] = implode('.', $oct) . '.0.0/16';
     } else {
         $ap['range'] = '';
     }
     $ap['bssid'] = $row[4] == 0 ? dec2mac($row[5]) : '';
     $ap['essid'] = $row[6];
     $ap['sec'] = sec2str((int) $row[7]);
     $ap['key'] = $row[8];
     $ap['wps'] = $row[9] == 1 ? '' : str_pad($row[9], 8, '0', STR_PAD_LEFT);
Esempio n. 2
0
 $entry['comment'] = $row[2] == null ? '' : $row[3];
 $ip = _long2ip($row[4]);
 $wanip = _long2ip($row[14]);
 if ($UserManager->Level > 1) {
     $entry['ipport'] = $ip != '' ? $ip : ($wanip != '' ? $wanip : '');
     if (isLocalIP($entry['ipport']) && $entry['ipport'] != $wanip && isValidIP($wanip) && !isLocalIP($wanip)) {
         $entry['ipport'] = $wanip;
     }
     if ($entry['ipport'] != '' && $row[5] != null) {
         $entry['ipport'] .= ':' . $row[5];
     }
     $entry['auth'] = $row[6];
     $entry['name'] = $row[7];
 } else {
     $entry['range'] = $ip != '' ? $ip : ($wanip != '' ? $wanip : '');
     if (isLocalIP($entry['range']) && $entry['range'] != $wanip && isValidIP($wanip) && !isLocalIP($wanip)) {
         $entry['range'] = $wanip;
     }
     if (isValidIP($entry['range'])) {
         $oct = explode('.', $entry['range']);
         array_pop($oct);
         array_pop($oct);
         $entry['range'] = implode('.', $oct) . '.0.0/16';
     } else {
         $entry['range'] = '';
     }
 }
 $entry['bssid'] = '';
 if ((int) $row[8] == 0) {
     $entry['bssid'] = dec2mac($row[9]);
 }