Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- codesource
- /*
- * TopListed Games example script
- * to dynamically load your game
- * content to be viewed by other
- * site visitors
- * Copyright � TopListed Games 2013
- */
- define("API_KEY","eukz6t1fdtr2aj1gnmwtmh57efvjt9pxtzmpidvmxdfym65zir");
- if($_GET["api_code"] !== API_KEY)
- {
- $json["error_message"] = "Error Loading API";
- }
- else
- {
- $online = mysql_query("SELECT
- COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 60), 1, null)) AS `last_min`,
- COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 300), 1, null)) AS `last_five`,
- COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 3600), 1, null)) AS `last_hour`,
- COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 21600), 1, null)) AS `last_six`,
- COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 43200), 1, null)) AS `last_twelve`,
- COUNT(IF(`laston` > (UNIX_TIMESTAMP() - 86400), 1, null)) AS `last_day`,
- COUNT(IF(`gender` = 'Male', 1, null)) AS `males`,
- COUNT(IF(`gender` = 'Female', 1, null)) AS `females`,
- COUNT(IF(`userid` > 0, 1, null)) AS `total_membs`
- FROM `users`");
- $get = mysql_fetch_array($online);
- $json = array();
- $json["users"] = $get["total_membs"]+0;
- $json["male"] = $get["males"]+0;
- $json["female"] = $get["females"]+0;
- $json["24_hrs"] = $get["last_day"]+0;
- $json["12_hrs"] = $get["last_twelve"]+0;
- $json["6_hrs"] = $get["last_six"]+0;
- $json["1_hr"] = $get["last_hour"]+0;
- $json["5_mins"] = $get["last_five"]+0;
- $json["1_min"] = $get["last_min"]+0;
- }
- echo json_encode($json);
Advertisement
Add Comment
Please, Sign In to add comment