예제 #1
0
파일: user.php 프로젝트: binarymaster/3WiFi
         $json['error'] = 'lowlevel';
         break;
     }
     $uid = $UserManager->uID;
     $json['stat']['top'] = TOP_BSSID;
     if ($res = QuerySql("SELECT COUNT(DISTINCT BSSID) FROM (SELECT NoBSSID,BSSID FROM uploads JOIN BASE_TABLE USING(id) WHERE uid={$uid}) bss WHERE NoBSSID = 0")) {
         $row = $res->fetch_row();
         $json['stat']['total'] = (int) $row[0];
         $res->close();
     }
     if ($res = QuerySql("SELECT BSSID, COUNT(BSSID) FROM (SELECT NoBSSID,BSSID FROM uploads JOIN BASE_TABLE USING(id) WHERE uid={$uid}) bss WHERE NoBSSID = 0 GROUP BY BSSID ORDER BY COUNT(BSSID) DESC LIMIT " . TOP_BSSID)) {
         $json['stat']['data'] = array();
         while ($row = $res->fetch_row()) {
             $data = array();
             $data[] = (int) $row[1];
             $data[] = dec2mac($row[0]);
             $json['stat']['data'][] = $data;
         }
         $res->close();
     }
     $json['result'] = true;
     break;
     // Статистика пользователя по ESSID
 // Статистика пользователя по ESSID
 case 'stess':
     set_time_limit(30);
     if (!$UserManager->isLogged()) {
         $json['error'] = 'unauthorized';
         break;
     }
     if ($UserManager->Level < 1) {
예제 #2
0
 $res = QuerySql('SELECT `BSSID` FROM GEO_TABLE WHERE `latitude` IS NULL');
 $total = $res->num_rows;
 if ($total == 0) {
     logt('No new BSSIDs was fetched.');
 } else {
     $done = 0;
     $found = 0;
     $hangcheck = 5;
     $time = microtime(true);
     while ($row = $res->fetch_row()) {
         $done++;
         $bssid = $row[0];
         $latitude = 0;
         $longitude = 0;
         $quadkey = 'NULL';
         $coords = GeoLocateAP(dec2mac($bssid));
         if ($coords != '') {
             $found++;
             $coords = explode(';', $coords);
             $latitude = (double) $coords[0];
             $longitude = (double) $coords[1];
             $quadkey = base_convert(latlon_to_quadkey($latitude, $longitude, MAX_ZOOM_LEVEL), 2, 10);
         }
         QuerySql("UPDATE GEO_TABLE SET `latitude`={$latitude},`longitude`={$longitude}, `quadkey`={$quadkey} WHERE `BSSID`={$bssid}");
         if (microtime(true) - $time > $hangcheck && $done < $total) {
             logt("Status: {$done} of {$total}, {$found} found on map (Working)");
             $time = microtime(true);
         }
     }
     logt("Status: {$done} of {$total}, {$found} found on map (Done!)");
 }