require_once __DIR__ . '/php/shittalk_functions.php'; $totalUpvotes = getTotalUpvotes(); $totalDownvotes = getTotalDownvotes(); $totalVotes = $totalUpvotes + $totalDownvotes; $activeVoteStats = getActiveVoteStats(); $totalActiveVotes = $activeVoteStats['total']; $totalActiveUpvotes = $activeVoteStats['upvoteTotal']; $totalActiveDownvotes = $activeVoteStats['downvoteTotal']; $totalBindCount = getTotalBindCount(); $totalSubmissionCount = getTotalSubmissionCount(); $deletionStats = getDeletedStats(); $totalDeletedInsultCount = $deletionStats['num_deleted']; $totalDeletedUpvoteCount = $deletionStats['upvotes_deleted']; $totalDeletedDownvoteCount = $deletionStats['downvotes_deleted']; $includedBindCount = getIncludedBindCount(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <!-- <meta name="description" content="Page Description">--> <meta name="author" content="Davis"> <title>Stats</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
//returns an array of table rows break; case 'get_RandomList': $response = getRandomList(); break; case 'get_TopList': $response = getTopList(); break; case 'get_RecentList': $response = getRecentList(); break; case 'get_TotalBindCount': $response = getTotalBindCount(); break; case 'get_IncludedBindCount': $response = getIncludedBindCount(); break; } } returnResponse($response); //sends back the message } function getRecentList() { $sql = "SELECT `id`, `text`, `upvotes`-`downvotes` AS `netVotes` FROM shittalkDB WHERE (`upvotes` - `downvotes`) > -5 ORDER by `date_created` DESC LIMIT 20;"; $result = mySqlQuery($sql); $response = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $response[] = array('id' => $row['id'], 'netVotes' => $row['netVotes'], 'text' => htmlspecialchars($row['text'])); }