Advertisement
Tugamars_PT

Untitled

Apr 21st, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.85 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <title>Scorebot</title>
  5. <meta charset="UTF-8">
  6. </head>
  7.  
  8. <body>
  9. <div class="auto">
  10. <?php
  11. error_reporting(0);
  12. /**
  13. * Created by JetBrains PhpStorm.
  14. * User: marce
  15. * Date: 10-02-2016
  16. * Time: 14:17
  17. * To change this template use File | Settings | File Templates.
  18. */
  19.  
  20. $gameid = $_GET['id'];
  21. $ebotid = $_GET['ebot'];
  22.  
  23. $servername = "localhost";
  24. $username = "root";
  25. $password = "Marcelo9";
  26.  
  27. $connectlocal = mysql_connect($servername, $username, $password) or die("Could not connect. " . mysql_error());
  28. mysql_select_db('matchticker', $connectlocal);
  29.  
  30. $queryebot = "SELECT * FROM `ebot` WHERE `id`=".$ebotid;
  31.  
  32. $r = mysql_query($queryebot);
  33.  
  34. if ( $r !== false && mysql_num_rows($r) > 0 ) {
  35. while ( $a = mysql_fetch_assoc($r)) {
  36. $servername_ebot = $a['ip_sql'];
  37. $username_ebot = $a['username_sql'];
  38. $password_ebot = $a['password_sql'];
  39. $database_ebot = $a['database_sql'];
  40. $log_url = $a['logs_url'];
  41. }
  42. }
  43.  
  44. mysql_close($connectlocal);
  45.  
  46. $servername = $servername_ebot;
  47. $username = $username_ebot;
  48. $password = $password_ebot;
  49.  
  50. $connectstats = mysql_connect($servername, $username, $password) or die("Could not connect. " . mysql_error());
  51. mysql_select_db($database_ebot, $connectstats);
  52.  
  53. mysql_query("SET NAMES 'utf8'");
  54. mysql_query('SET character_set_connection=utf8');
  55. mysql_query('SET character_set_client=utf8');
  56. mysql_query('SET character_set_results=utf8');
  57.  
  58. $qstats_a = mysql_query("SELECT
  59. case `players`.`team`
  60. when 'a' then `matchs`.`team_a_name`
  61. when 'b' then `matchs`.`team_b_name`
  62. END as `team`,
  63.  
  64.  
  65.  
  66. `pseudo`, `nb_kill`, `assist`, `death`, `hs`, `firstkill`
  67.  
  68.  
  69. FROM `players` INNER JOIN `matchs` on `matchs`.`id` = `players`.`match_id`
  70.  
  71. WHERE `match_id`= " . $gameid . "
  72.  
  73. ORDER BY `players` . `team`, `players` . `nb_kill` DESC
  74.  
  75. LIMIT 0, 5
  76.  
  77. ");
  78.  
  79. $qstats_b = mysql_query("SELECT
  80. case `players`.`team`
  81. when 'a' then `matchs`.`team_a_name`
  82. when 'b' then `matchs`.`team_b_name`
  83. END as `team`,
  84.  
  85.  
  86.  
  87. `pseudo`, `nb_kill`, `assist`, `death`, `hs`, `firstkill`
  88.  
  89.  
  90. FROM `players` INNER JOIN `matchs` on `matchs`.`id` = `players`.`match_id`
  91.  
  92. WHERE `match_id`= " . $gameid . "
  93.  
  94. ORDER BY `players` . `team`, `players` . `nb_kill` DESC
  95.  
  96. LIMIT 5, 5
  97.  
  98. ");
  99.  
  100. $matchinfo = "SELECT `team_a_name`, `team_b_name`, `status`, `is_paused`, `score_a`, `score_b` FROM `matchs` WHERE `id`='".$gameid."'";
  101.  
  102. $qmatchinfo = mysql_query($matchinfo);
  103.  
  104. if ( $qmatchinfo !== false && mysql_num_rows($qmatchinfo) > 0 ) {
  105. while ( $a = mysql_fetch_assoc($qmatchinfo)) {
  106.  
  107. $team_a_name = $a['team_a_name'];
  108. $team_b_name = $a['team_b_name'];
  109.  
  110. $score_a = $a['score_a'];
  111. $score_b = $a['score_b'];
  112.  
  113. switch($score_a){
  114. case ($score_a > $score_b):
  115. $score_a = "<font color='green'>" . $score_a . "</font>";
  116. $score_b = "<font color='red'>" . $score_b . "</font>";
  117. break;
  118. case ($score_a < $score_b):
  119. $score_a = "<font color='red'>" . $score_a . "</font>";
  120. $score_b = "<font color='green'>" . $score_b . "</font>";
  121. break;
  122. case ($score_a == $score_b):
  123. $score_a = "<font color='orange'>" . $score_a . "</font>";
  124. $score_b = "<font color='orange'>" . $score_b . "</font>";
  125. break;
  126. }
  127.  
  128. $status = $a['status'];
  129. $is_paused = $a['is_paused'];
  130.  
  131. switch($status){
  132. case 0:
  133. $status = "A partida ainda não começou";
  134. break;
  135. case 1:
  136. $status = "A partida ainda não começou";
  137. break;
  138. case 2:
  139. $status = "A partida ainda não começou";
  140. break;
  141. case 3:
  142. $status = "Knife round";
  143. break;
  144. case 4:
  145. $status = "Escolha de sides";
  146. break;
  147. case 5:
  148. $status = "Aquecimento";
  149. break;
  150. case 6:
  151. $status = "Primeiro side";
  152. break;
  153. case 7:
  154. $status = "Troca de sides";
  155. break;
  156. case 8:
  157. $status = "Segundo side";
  158. break;
  159. case 9:
  160. $status = "Overtime a começar";
  161. break;
  162. case 10:
  163. $status = "Primeiro side do overtime";
  164. break;
  165. case 11:
  166. $status = "Segundo side do overtime a começar";
  167. break;
  168. case 12:
  169. $status = "Segundo side do overtime";
  170. break;
  171. case 13:
  172. $status = "Partida finalizada";
  173. break;
  174. default:
  175. $status = "Partida finalizada";
  176. break;
  177. }
  178. }
  179. }
  180. ?>
  181.  
  182. <!-- SCOREBOT -->
  183. <div class="scorebot" style="display: block; width: 660px; margin-bottom: -10px;" align="center">
  184. <div>
  185. <p style="font-size: 20pt; margin-bottom: -5px; font-weight: bold;"><?php echo $score_a . " - " . $score_b ?></p>
  186.  
  187. <table style="display:inline-table; margin-right: 5px;" width="455" cellspacing="1" cellpadding="1" border="0">
  188. <tr><th bgcolor="#ff6600" scope="col" colspan="15" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);"><?php echo $team_a_name; ?></span></th></tr>
  189.  
  190. <tr><th width="150" nowrap="nowrap" bgcolor="#ff6600" scope="col" bordercolor="#ff6600"><span style="color: rgb(255, 255, 255);">Nome</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">K</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">A</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">D<br></span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">K/D</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">HS</th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="50" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">HS %</th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="100" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">Entry K</th></tr></thead>
  191. <?php
  192. if ( $qstats_a !== false && mysql_num_rows($qstats_a) > 0 ) {
  193. while ( $a = mysql_fetch_array($qstats_a)) {
  194. if ( $a[2] > 0 || $a[3] > 0 || $a[4] > 0 || $a[5] > 0){ ?>
  195. <tr>
  196. <td><?php echo substr($a[1], 0, 15);?></td>
  197. <td></td>
  198. <td style="text-align: center;"><?php echo $a[2];?></td>
  199. <td></td>
  200. <td style="text-align: center;"><?php echo $a[3];?></td>
  201. <td></td>
  202. <td style="text-align: center;"><?php echo $a[4];?></td>
  203. <td></td>
  204. <td style="text-align: center;"><?php echo round(($a[2] / $a[4]), 2);?></td>
  205. <td></td>
  206. <td style="text-align: center;"><?php echo $a[5];?></td>
  207. <td></td>
  208. <td style="text-align: center;"><?php echo round(($a[5]/$a['2'])*100, 2);?></td>
  209. <td></td>
  210. <td style="text-align: center;"><?php echo $a[6]; ?></td>
  211. </tr>
  212. <?php }
  213. }
  214. } ?>
  215. </table><br><br>
  216. <table style="display:inline-table;" width="455" cellspacing="1" cellpadding="1" border="0">
  217. <tr><th bgcolor="#ff6600" scope="col" colspan="15" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);"><?php echo $team_b_name; ?></span></th></tr>
  218.  
  219. <tr><th width="150" nowrap="nowrap" bgcolor="#ff6600" scope="col" bordercolor="#ff6600"><span style="color: rgb(255, 255, 255);">Nome</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">K</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">A</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">D<br></span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center;"><span style="color: rgb(255, 255, 255);">K/D</span></th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="30" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">HS</th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="50" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">HS %</th><th width="5" bgcolor="#333333" scope="col" bordercolor="#333333">&nbsp;</th><th width="100" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">Entry K</th></tr></thead>
  220. <?php
  221. if ( $qstats_b !== false && mysql_num_rows($qstats_b) > 0 ) {
  222. while ( $a = mysql_fetch_array($qstats_b)) {
  223. if ( $a[2] > 0 || $a[3] > 0 || $a[4] > 0 || $a[5] > 0){ ?>
  224. <tr>
  225. <td><?php echo substr($a[1], 0, 15);?></td>
  226. <td></td>
  227. <td style="text-align: center;"><?php echo $a[2];?></td>
  228. <td></td>
  229. <td style="text-align: center;"><?php echo $a[3];?></td>
  230. <td></td>
  231. <td style="text-align: center;"><?php echo $a[4];?></td>
  232. <td></td>
  233. <td style="text-align: center;"><?php echo round(($a[2] / $a[4]), 2);?></td>
  234. <td></td>
  235. <td style="text-align: center;"><?php echo $a[5];?></td>
  236. <td></td>
  237. <td style="text-align: center;"><?php echo round(($a[5]/$a['2'])*100, 2);?></td>
  238. <td></td>
  239. <td style="text-align: center;"><?php echo $a[6]; ?></td>
  240. </tr>
  241. <?php }
  242. }
  243. } ?>
  244. </table>
  245. <p>
  246. <?php echo "Estado: " . $status;
  247. if($is_paused == 1){
  248. echo "<font color: orange;><b>[JOGO PAUSADO]</b></font>";
  249. }
  250. ?>
  251. </p>
  252. </div><br><br>
  253.  
  254. <!-- LOG -->
  255. <?php if( $status !== 0 && $status !== 1 && $status !== 4 && $status !== 13 && $status !== 14 ) {?>
  256. <style> .log { display: none }</style>
  257. <?php } ?>
  258. <div class="log">
  259. <iframe marginwidth="0px" marginheight="0xp" scrolling="yes" name="myiFrame" allowtransparency="true" style="background: #FFFFFF;" src="http://<?php echo $log_url; ?>match-<?php echo $gameid; ?>.html" frameborder="0" height="200px" width="660px"></iframe>
  260. </div>
  261.  
  262. </div>
  263. </div>
  264.  
  265. </body>
  266.  
  267. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement