Home"; $getQuotes = mysql_query("SELECT * FROM quotes ORDER BY id DESC LIMIT 10") or die(mysql_error()); while($quotes = mysql_fetch_array($getQuotes)) { echo "
\n";
            echo htmlspecialchars($quotes['content'])."\n";
            echo "
\n"; echo ""; echo "#{$quotes['id']} | {$quotes['date']} | + [5] - | POC"; echo ""; } } elseif(isset($_GET['add'])) { echo "

Add Comment

"; if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['proof']) && isset($_POST['comment'])) { $message = $_POST['name']."
"; $message .= $_POST['email']."
"; $message .= $_POST['proof']."

"; $message .= $_POST['comment']; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $mail = mail('nicosaan@gmail.com', 'Code Bash [Submission]', stripslashes($message), $headers); if($mail) { echo ""; } } else { echo '

Enter your name:

Enter your email address:

Enter your POC:

Enter your code comment:

'; } } elseif(isset($_GET['latest'])) { echo "

Latest 50

"; $getQuotes = mysql_query("SELECT * FROM quotes ORDER BY id DESC LIMIT 50") or die(mysql_error()); while($quotes = mysql_fetch_array($getQuotes)) { echo "
\n";
            echo htmlspecialchars($quotes['content'])."\n";
            echo "
\n"; echo ""; echo "#{$quotes['id']} | {$quotes['date']} | + [5] - | POC"; echo ""; } } elseif(isset($_GET['random'])) { echo "

Random 10

"; $getQuotes = mysql_query("SELECT * FROM quotes ORDER BY rand() DESC LIMIT 10") or die(mysql_error()); while($quotes = mysql_fetch_array($getQuotes)) { echo "
\n";
            echo htmlspecialchars($quotes['content'])."\n";
            echo "
\n"; echo ""; echo "#{$quotes['id']} | {$quotes['date']} | + [5] - | POC"; echo ""; } } elseif(isset($_GET['vote'])) { function castVote($quote_id, $vote) { $ip_address = $_SERVER['REMOTE_ADDR']; $result = mysql_query("SELECT `id` FROM `ratings` WHERE quote_id = $quote_id AND `ip_address` = '$ip_address'"); if ($result) { echo 'Sorry, you\'ve already voted'; return; } $result = mysql_query("SELECT `id` FROM `ratings` WHERE quote_id = $quote_id"); if ($result) { if ($vote == 'up') { mysql_query("UPDATE `ratings` SET `current_rating` = `current_rating` + 1 WHERE quote_id = $quote_id"); } else { mysql_query("UPDATE `ratings` SET `current_rating` = `current_rating` - 1 WHERE quote_id = $quote_id"); } } else { mysql_query("INSERT INTO `ratings` VALUES(null, $query_id, 5, '$ip_address')"); } if(isset($_GET['id'])) { castVote($_GET['id'], $_GET['vote']); echo"

Thanks for voting

"; } } } elseif(isset($_GET['top'])) { echo "

Top 100

"; $getQuotes = mysql_query("SELECT quotes.*, ratings.current_rating, ratings.quote_id FROM quotes LEFT JOIN ratings ON ratings.quote_id = quotes.id ORDER BY ratings.current_rating DESC LIMIT 100") or die(mysql_error()); while($quotes = mysql_fetch_array($getQuotes)) { echo "
\n";
            echo htmlspecialchars($quotes['content'])."\n";
            echo "
\n"; echo ""; echo "#{$quotes['id']} | {$quotes['date']} | + [5] - | POC"; echo ""; } } include("./includes/footer.inc"); ?>