KyleMassacre

Untitled

Sep 8th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. codesource
  2. /*
  3. *    TopListed Games example script
  4. *    to dynamically load your game
  5. *    content to be viewed by other
  6. *    site visitors
  7. *    Copyright � TopListed Games 2013
  8. */
  9. define("API_KEY","eukz6t1fdtr2aj1gnmwtmh57efvjt9pxtzmpidvmxdfym65zir");
  10.  
  11. if($_GET["api_code"] !== API_KEY)
  12. {
  13.      $json["error_message"] = "Error Loading API";
  14. }
  15. else
  16. {
  17.     $online = mysql_query("SELECT
  18.        COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 60),    1, null)) AS `last_min`,
  19.        COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 300),   1, null)) AS `last_five`,
  20.        COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 3600),  1, null)) AS `last_hour`,
  21.        COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 21600), 1, null)) AS `last_six`,
  22.        COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 43200), 1, null)) AS `last_twelve`,
  23.        COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 86400), 1, null)) AS `last_day`,
  24.        COUNT(IF(`gender` = 'Male', 1, null)) AS `males`,
  25.        COUNT(IF(`gender` = 'Female', 1, null)) AS `females`,
  26.        COUNT(IF(`userid` > 0, 1, null)) AS `total_membs`
  27.        FROM `users`");
  28.  
  29.     $get = mysql_fetch_array($online);
  30.  
  31.     $json = array();
  32.     $json["users"] = $get["total_membs"]+0;
  33.     $json["male"] = $get["males"]+0;
  34.     $json["female"] = $get["females"]+0;
  35.     $json["24_hrs"] = $get["last_day"]+0;
  36.     $json["12_hrs"] = $get["last_twelve"]+0;
  37.     $json["6_hrs"] = $get["last_six"]+0;
  38.     $json["1_hr"] = $get["last_hour"]+0;
  39.     $json["5_mins"] = $get["last_five"]+0;
  40.     $json["1_min"] = $get["last_min"]+0;
  41. }
  42. echo json_encode($json);
Advertisement
Add Comment
Please, Sign In to add comment