Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. <?php
  2. $host="localhost";
  3. $user="mysqluser"; // mysql user
  4. $pass="mysqluserpass"; // mysql user pass
  5. $database="mysqdb"; // mysql database
  6. $mode = "ctf";
  7. $mingames=20; // debe ser el mismo que en el archivo de configacion del bot gatherbot.cfg
  8. $inactivedays=30; // debe ser el mismo que en el archivo de configacion del bot gatherbot.cfg
  9. $pagesize=10;
  10. $filtername_sql="";
  11. $offset=0;
  12.  
  13. $link = @mysql_connect($host,$user,$pass);
  14. mysql_select_db($database, $link) or die ($database. " Database not found." . $user);
  15.  
  16. $result=@mysql_query("
  17. SELECT
  18. ROUND((COALESCE(killed/death,killed) * (COALESCE(win/(win+lose),0) + COALESCE(cap/teamcap,0)))*1000+points) AS score,
  19. COALESCE(ROUND(killed/death,2),'Inf') AS kpd,
  20. COALESCE(ROUND(cap/teamcap*100),0) AS capratio,
  21. win+tie+lose AS played,
  22. COALESCE(ROUND(win/(win+lose)*100),0) AS winratio,
  23. (SELECT COUNT(*)+1 FROM $mode WHERE
  24. time_updated > TIMESTAMPADD(DAY,-$inactivedays,NOW())
  25. AND
  26. ROUND((COALESCE(killed/death,killed) * (COALESCE(win/(win+lose),0) + COALESCE(cap/teamcap,0)))*1000+points)>score
  27. AND
  28. (win+tie+lose) >= $mingames
  29. ) AS place,
  30. id,name,time_updated,killed,death
  31. FROM $mode
  32. WHERE
  33. time_updated > TIMESTAMPADD(DAY,-$inactivedays,NOW())
  34. AND
  35. (win+tie+lose) >= $mingames
  36. $filtername_sql
  37. ORDER BY score DESC, killed DESC, DEATH ASC, name ASC
  38. LIMIT $offset, $pagesize
  39. ",$link);
  40.  
  41. echo '<table width="100%"><tr><td><div align=center>Player</div></td><td><div align=center>Points</div></td></tr>';
  42. while ($row = mysql_fetch_array($result)) {
  43. echo '<tr><td>'.$row[name].'</td><td><div= align=center>'.$row['score'].'</div></td></tr>';
  44. // echo '<p>'.$row[name].' '.$row['points'].'</p>';
  45. }
  46. echo '</table>';
  47.  
  48. mysql_close($link);
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement