Advertisement
draganrakita

Advance Bans List

Apr 28th, 2013
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Contact: dragan.rakita@live.com
  2. <!doctype html>
  3. <head>
  4. <title>Advance Bans List</title>
  5.  <?php
  6.  
  7. $ftp_ip="193.104.68.46"; // Zamenite svoj ip servera
  8. $ftp_user="srv134530";   // zamenite sa svojim userom od FTPa
  9. $ftp_pass="qOIb_aCuam";  // Zamenite sa svojim passwordom od FTPa
  10. $ftp_log_path="cstrike/addons/amxmodx/data/advanced_bans.txt";
  11. $temporary_file="bans.tmp";
  12. //END VARS
  13.  
  14.  
  15.  
  16.  
  17. $conn_id = ftp_connect($ftp_ip);
  18. $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
  19.  
  20. /*
  21. if ((!$conn_id) || (!$login_result)) {
  22. echo "<font color=\"#FF0000\">Could not retrieve ban list.</font>";
  23. exit;
  24. } else {
  25. echo "<font color=\"#00FF00\">Retrieved ban list successfully.</font>\n";
  26. echo "<br />\n";
  27. echo "<br />\n";
  28. }
  29. */
  30.  
  31. // get the file
  32. $local = fopen($temporary_file, "w");
  33. $result = ftp_fget($conn_id, $local, $ftp_log_path, FTP_ASCII);
  34.  
  35. // close the FTP stream
  36. ftp_close($conn_id);
  37.  
  38.  
  39. $myFile = $temporary_file;
  40. $fh = fopen($myFile, 'r');
  41. $theData = fread($fh, filesize($myFile));
  42. fclose($fh);
  43.  
  44.  
  45. echo "<table border=\"0\" cellpadding=\"3\" style=\"width: 100%;\">\n";
  46. echo "<tr>\n";
  47. echo "<td style=\"background-color: #333333; color: #FFFFFF; font-size: small;\">Player name:</td>\n";
  48. echo "<td style=\"background-color: #333333; color: #FFFFFF; font-size: small;\">Player SteamID:</td>\n";
  49. echo "<td style=\"background-color: #333333; color: #FFFFFF; font-size: small;\">Reason for ban:</td>\n";
  50. echo "<td style=\"background-color: #333333; color: #FFFFFF; font-size: small;\">Ban duration:</td>\n";
  51. echo "<td style=\"background-color: #333333; color: #FFFFFF; font-size: small;\">Time of Unban:</td>\n";
  52. echo "<td style=\"background-color: #333333; color: #FFFFFF; font-size: small;\">Admin name:</td>\n";
  53. echo "</tr>\n";
  54.  
  55. function steam2friend($steam_id){
  56.     $steam_id=strtolower($steam_id);
  57.     if (substr($steam_id,0,7)=='steam_0') {
  58.         $tmp=explode(':',$steam_id);
  59.         if ((count($tmp)==3) && is_numeric($tmp[1]) && is_numeric($tmp[2])){
  60.             return bcadd((($tmp[2]*2)+$tmp[1]),'76561197960265728');
  61.         }else return false;
  62.         }else{
  63.             return false;
  64.         }
  65.     }
  66.  
  67.  
  68. $file1 = $temporary_file;
  69. $lines = file($file1);
  70. $line_num = -1;
  71. foreach($lines as $linenum => $line){
  72.  $line_num++;
  73. }
  74. while($line_num > -1){
  75.  
  76. $line = $lines[$line_num];
  77.  
  78. list($steamidraw, $nickdurationtimeraw, $reason, $admin, $adminidraw) = explode('" "', $line);
  79. $steamid = str_replace("\"", "", $steamidraw);
  80. list($nick, $durationraw, $time) = explode('"', $nickdurationtimeraw);
  81.  
  82. $duration = str_replace(" ", "", $durationraw);
  83. $adminidraw2 = str_replace("\"", "", $adminidraw);
  84. $adminid = trim($adminidraw2);
  85. $friendid = steam2friend($steamid);
  86. $adminfriendid = steam2friend($adminid);
  87.  
  88. echo "<tr>\n";
  89.  
  90.  
  91. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  92. echo $nick;
  93. echo "</td>\n";
  94.  
  95. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  96. //echo $steamid;
  97. echo "<a style=\"color: #0000FF;\" href=\"http://steamcommunity.com/profiles/";
  98. echo $friendid;
  99. echo "\" target=\"_blank\">";
  100. echo $steamid;
  101. echo "</a>";
  102. echo "</td>\n";
  103.  
  104. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  105. if($reason == "") {
  106.     echo "No reason specified.";
  107. }
  108. else {
  109.     echo $reason;
  110. }
  111. echo "</td>\n";
  112.  
  113. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  114. if($duration == "0") {
  115.     echo "Permanent";
  116. }
  117. elseif($duration == "1") {
  118.     echo $duration;
  119.     echo " minute";
  120. }
  121. else {
  122.     echo $duration;
  123.     echo " minutes";
  124. }
  125. echo "</td>\n";
  126.  
  127. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  128. if($time == "Permanent Ban") {
  129.     echo "Never";
  130. }
  131. else {
  132.     echo $time;
  133. }
  134. echo "</td>\n";
  135.  
  136. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  137. //echo $admin;
  138. echo "<a style=\"color: #0000FF;\" href=\"http://steamcommunity.com/profiles/";
  139. echo $adminfriendid;
  140. echo "\" target=\"_blank\">";
  141. echo $admin;
  142. echo "</a>";
  143. echo "</td>\n";
  144.  
  145. echo "</tr>\n";
  146. $line_num--;
  147. }
  148. ?>
  149. </table>
  150. </body>
  151. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement