Advertisement
Guest User

Le sigh

a guest
Feb 5th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.06 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <link rel="stylesheet" href="StylesTSL.css" type="text/css" media="screen">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Terraria Server List</title>
  7. </head>
  8. <body>
  9. <div id="page">
  10. <div id="logobase">
  11. <div class="filler"></div>
  12. <center><img src="logo.png" width="400" height="100"/></center>
  13. </div>
  14. <div class="filler"></div>
  15. <div class="header"><center><a href="http://bobcraft-games.com/TSL/search.php">Search</a> - <a href="http://bobcraft-games.com/TSL/">Home</a> - <a href="http://bobcraft-games.com/TSL/guide.php">Guide to submitting a server</a></center></div>
  16. <div class="filler"></div>
  17. <?php
  18. $cip = $_SERVER['REMOTE_ADDR'];
  19. $page = $_GET['id'];
  20. addslashes($page);
  21.      
  22. $conn = mysql_connect("localhost","x","px");
  23. if (!$conn) {
  24.     die('Could not connect: ' . mysql_error());
  25. }
  26.      
  27. mysql_select_db("x", $conn);
  28. $check = mysql_query("SELECT * FROM `Servers_votes` WHERE `id` = '$page'");
  29. $checka = mysql_fetch_assoc($check);
  30. if (strpos($checka['clientIP'], $cip)) {
  31. `   echo "<div class='header'><center>You've already voted for this server!<br><a href='http://bobcraft-games.com/TSL/'>Return to our homepage</a></center></div>";
  32. }
  33. else {
  34.     mysql_query("INSERT INTO `Servers_votes` (`id`, `clientIP`) VALUES('".mysql_real_escape_string($page)."', '".mysql_real_escape_string($cip)."')") or die(mysql_error());
  35.     $voting = mysql_query("SELECT SUM(vote) AS fCount FROM `Servers_votes` WHERE `id` = '$page'");
  36.     $result = mysql_fetch_array($voting);
  37.     $fCount = $result["fCount"];  
  38.     $result = mysql_query("SELECT * FROM Servers WHERE id = '$page'");
  39.     mysql_query("UPDATE `Servers` SET `votes`='".$fCount."' WHERE `Servers`.`id`='".$page."'") or die(mysql_error());
  40.     echo "<div class='header'><center>You've successfully voted for this server!<br><a href='http://bobcraft-games.com/TSL/'>Return to our homepage</a></center></div>";
  41. }
  42. ?>
  43. </div>
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement