Guest User

areagames

a guest
Oct 6th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ob_start();
  4. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  5. ini_set("display_errors", 1);
  6. set_time_limit(10);
  7.  
  8. // database connection
  9. $sql_ip = "localhost";
  10. $sql_user = "mysql_user";
  11. $sql_password = "mysql_password";
  12. $sql_database = "database_name";
  13.  
  14. $dbc = mysql_connect($sql_ip, $sql_user, $sql_password);
  15. if (!$dbc) {
  16. die('Could not connect: ' . mysql_error());
  17. }
  18. mysql_select_db($sql_database);
  19.  
  20. if($_GET["order"]){
  21. if($_SESSION["orders"][$_GET["order"]]=="ASC" || $_SESSION["orders"][$_GET["order"]]==""){
  22. $order=" ".$_GET["order"]." DESC ";
  23. $_SESSION["orders"][$_GET["order"]]="DESC";
  24. }
  25. elseif($_SESSION["orders"][$_GET["order"]]=="DESC"){
  26. $order=" ".$_GET["order"]." ASC ";
  27. $_SESSION["orders"][$_GET["order"]]="ASC";
  28. }
  29. }else{
  30. $order="skillpoints DESC";
  31. }
  32.  
  33. $sql="SELECT * FROM skillpoints_v2 ORDER BY $order LIMIT 30";
  34. $db=mysql_query($sql);
  35. while($b=mysql_fetch_array($db, MYSQL_ASSOC)) {
  36. $players[]=$b;
  37. }
  38.  
  39. function convert_steamid($string) {
  40. $steamid = strtolower($string);
  41. $tmp = explode(':',$steamid);
  42. $steamcid = (($tmp[2]*2)+$tmp[1]) + 1197960265728;
  43. $formatted_cid = number_format($steamcid, 0, '.', '');
  44. return 'http://steamcommunity.com/profiles/7656' . $formatted_cid;
  45. }
  46. ?>
  47.  
  48. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  49. <html xmlns="http://www.w3.org/1999/xhtml">
  50. <head>
  51. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  52. <title>SkillPoints</title>
  53. <link href="style.css" rel="stylesheet" type="text/css" />
  54. </head>
  55. <body>
  56. <table id="mytable" cellspacing="0">
  57. <tr>
  58. <th scope="col" abbr="POSITION">#</th>
  59. <th scope="col" abbr="NICK">NICK</th>
  60. <th scope="col" abbr="KILLS"><a href="?order=kills">KILLS</a></th>
  61. <th scope="col" abbr="DEATHS"><a href="?order=deaths">DEATHS</a></th>
  62. <th scope="col" abbr="HEADSHOTS"><a href="?order=headshots">HEADSHOTS</a></th>
  63. <th scope="col" abbr="KNIFE-KILLS"><a href="?order=knife_kills">KNIFE KILLS</a></th>
  64. <th scope="col" abbr="KNIFE-DEATHS"><a href="?order=knife_deaths">KNIFE DEATHS</a></th>
  65. <th scope="col" abbr="GRENADE-KILLS"><a href="?order=grenade_kills">GRENADE KILLS</a></th>
  66. <th scope="col" abbr="GRENADE-DEATHS"><a href="?order=grenade_deaths">GRENADE DEATHS</a></th>
  67. <th scope="col" abbr="BOMB-EXPLOSIONS"><a href="?order=bomb_explosions">BOMB EXPLOSIONS</a></th>
  68. <th scope="col" abbr="DEFUSED-BOMBS"><a href="?order=defused_bombs">DEFUSED BOMBS</a></th>
  69. <th scope="col" abbr="OWN-ROUNDS"><a href="?order=own_rounds">OWN ROUNDS</a></th>
  70. <th scope="col" abbr="SKILLPOINTS"><a href="?order=skillpoints">SKILLPOINTS</a></th>
  71. </tr>
  72. <?php $i=0;foreach($players as $player){$i++;?>
  73. <tr>
  74. <th scope="row" class="spec<?php print ($i%2==0?'alt':'')?>"><?php print $i?></th>
  75. <td><a href="<?php print convert_steamid($player["authid"])?>" target="_blank"><?php print $player["nick"]?></a></td>
  76. <td><?php print $player["kills"]?></td>
  77. <td><?php print $player["deaths"]?></td>
  78. <td><?php print $player["headshots"]?></td>
  79. <td><?php print $player["knife_kills"]?></td>
  80. <td><?php print $player["knife_deaths"]?></td>
  81. <td><?php print $player["grenade_kills"]?></td>
  82. <td><?php print $player["grenade_deaths"]?></td>
  83. <td><?php print $player["bomb_explosions"]?></td>
  84. <td><?php print $player["defused_bombs"]?></td>
  85. <td><?php print $player["own_rounds"]?></td>
  86. <td><?php print $player["skillpoints"]?></td>
  87. </tr>
  88. <?php }?>
  89. </table>
  90. </body>
  91. </html>
Add Comment
Please, Sign In to add comment