Arxero

Gag list script for Awesome Cars | https://awesomecs.syntrwa

Aug 18th, 2019
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.71 KB | None | 0 0
  1. //plugin to use it with: https://www.amxx-bg.info/viewtopic.php?t=2744
  2. //source script: https://forum.kgb-hosting.com/showthread.php?t=84992
  3. //our server and forum: https://awesomecs.syntrwave.com/index.php
  4. //instructions: you need to add your ftp login info of you cs server and then put the file in the root directory of you phpbb forum
  5. //then just load your-website/{how ever you named this file}.php
  6. <!doctype html>
  7. <head>
  8. <title>Gaglist</title>
  9. <style type="text/css">
  10. body {
  11.     background-color: #111111;
  12.     width:100%;
  13.     margin:0px auto;
  14. }
  15. </style><!-- your html stuff -->
  16. <meta charset="UTF-8">
  17. </head>
  18. <body>
  19. <?php
  20.  
  21. $ftp_ip=""; //
  22. $ftp_user=""; //
  23. $ftp_pass=""; //
  24.  
  25.  
  26. $ftp_log_path="cstrike/addons/amxmodx/logs/gag_system.log";
  27. $temporary_file="gags.tmp";
  28.  
  29. $conn_id = ftp_connect($ftp_ip);
  30. $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
  31.  
  32. $local = fopen($temporary_file, "w");
  33. $result = ftp_fget($conn_id, $local, $ftp_log_path, FTP_ASCII);
  34.  
  35. ftp_close($conn_id);
  36.  
  37.  
  38. $myFile = $temporary_file;
  39. $fh = fopen($myFile, 'r');
  40. $theData = fread($fh, filesize($myFile));
  41. fclose($fh);
  42.  
  43. echo '<h1 style="color:#DADADA;margin:0px;padding:0px;font-size:50px;"><center>Gaglist - Awesome Cars</center></h1>'; //NASLOV
  44. echo "<table border=\"0\" cellpadding=\"2\" style=\"width: 100%;\">\n";
  45. echo "<tr>\n";
  46. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">Player</td>\n";
  47. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">IP</td>\n";
  48. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">Time</td>\n";
  49. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">Gag length</td>\n";
  50. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">Gagged by</td>\n";
  51. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">Reason</td>\n";
  52. echo "<td style=\"background-color: #333333; color: #DADADA; font-size: small;\">Type</td>\n";
  53. echo "</tr>\n";
  54.  
  55.  
  56. $file1 = $temporary_file;
  57. $lines = file($file1);
  58.  
  59.  
  60. function date_sort($a, $b) {
  61.     $extrxtedDateA = null;
  62.     $extrxtedDateB = null;
  63.  
  64.     $dateRegex = '/([0-9]{2}\/){2}[0-9]{4}\s-\s([0-9]{2}:){2}[0-9]{2}/';
  65.     preg_match($dateRegex, $a, $extrxtedDateA);
  66.     preg_match($dateRegex, $b, $extrxtedDateB);
  67.  
  68.     $format = 'm/d/Y - H:i:s';
  69.     $aDate = DateTime::createFromFormat($format, $extrxtedDateA[0]);
  70.     $aDate = $aDate->format('Y-m-d');
  71.     $bDate = DateTime::createFromFormat($format, $extrxtedDateB[0]);
  72.     $bDate = $bDate->format('Y-m-d');
  73.  
  74.  
  75.     return strtotime($aDate) - strtotime($bDate);
  76. }
  77. usort($lines, "date_sort");
  78.  
  79.  
  80. $line_num = -1;
  81. foreach($lines as $linenum => $line){
  82.  $line_num++;
  83. }
  84. while($line_num > -1){
  85. $line = $lines[$line_num];
  86. if(strlen($line) == 1){
  87.     $line_num--;
  88.     continue;
  89. }
  90.  
  91. $player = null;
  92. $ip = null;
  93. $time = null;
  94. $gagLength = null;
  95. $adminName = null;
  96. $reason = null;
  97. $type = null;
  98.  
  99. $playerRegex = '/(?<=PLAYER: |TARGET_NAME: ).+(?= \[IP:)/';
  100. $ipRegex = '/((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/';
  101. $timeRegex = '/([0-9]{2}\/){2}[0-9]{4}\s-\s([0-9]{2}:){2}[0-9]{2}/';
  102. $gagLengthRegex = '/(?<=TIME: ).+\b/';
  103. $adminRegex = '/(?<=ADMIN: ).+(?= \| PLAYER| \| TARGET_NAME)/';
  104. $reasonRegex = '/(?<=REASON: ).+(?= \| TIME:)/';
  105.  
  106. preg_match($playerRegex, $line, $player);
  107. preg_match($ipRegex, $line, $ip);
  108. preg_match($timeRegex, $line, $time);
  109. preg_match($gagLengthRegex, $line, $gagLength);
  110. preg_match($adminRegex, $line, $adminName);
  111. preg_match($reasonRegex, $line, $reason);
  112.  
  113.  
  114.  
  115. if (strpos($line, ' [UNGAG] ') !== false) {
  116.     $type = 'UNGAG';
  117.     $gagLength[0] = '';
  118.     $reason[0] = '';
  119. }else {
  120.     $type = 'GAG';
  121. }
  122.  
  123. if (empty($gagLength)) {
  124.     $gagLength[0] = 'Permanent';
  125. }
  126.  
  127.  
  128.  
  129. echo "<tr>\n";
  130.  
  131. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  132. echo htmlspecialchars($player[0]);
  133. echo "</td>\n";
  134.  
  135. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  136. echo $ip[0];
  137. echo "</td>\n";
  138.  
  139. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  140. echo $time[0];
  141. echo "</td>\n";
  142.  
  143. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  144. echo $gagLength[0];
  145. echo "</td>\n";
  146.  
  147. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  148. echo $adminName[0];
  149. echo "</td>\n";
  150.  
  151. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  152. echo $reason[0];
  153. echo "</td>\n";
  154.  
  155. echo "<td style=\"background-color: #eee; color: #000000; font-size: small;\">";
  156. echo $type;
  157. echo "</td>\n";
  158.  
  159.  
  160.  
  161. echo "</tr>\n";
  162.  
  163. $line_num--;
  164. }
  165. echo "</table>\n";
  166. ?>
  167. </body>
  168. </html>
Add Comment
Please, Sign In to add comment