Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Scorebot</title>
- <meta charset="UTF-8">
- </head>
- <body>
- <div class="auto">
- <?php
- error_reporting(0);
- /**
- * Created by JetBrains PhpStorm.
- * User: marce
- * Date: 10-02-2016
- * Time: 14:17
- * To change this template use File | Settings | File Templates.
- */
- $gameid = $_GET['id'];
- $ebotid = $_GET['ebot'];
- $servername = "localhost";
- $username = "root";
- $password = "Marcelo9";
- $connectlocal = mysql_connect($servername, $username, $password) or die("Could not connect. " . mysql_error());
- mysql_select_db('matchticker', $connectlocal);
- $queryebot = "SELECT * FROM `ebot` WHERE `id`=".$ebotid;
- $r = mysql_query($queryebot);
- if ( $r !== false && mysql_num_rows($r) > 0 ) {
- while ( $a = mysql_fetch_assoc($r)) {
- $servername_ebot = $a['ip_sql'];
- $username_ebot = $a['username_sql'];
- $password_ebot = $a['password_sql'];
- $database_ebot = $a['database_sql'];
- $log_url = $a['logs_url'];
- }
- }
- mysql_close($connectlocal);
- $servername = $servername_ebot;
- $username = $username_ebot;
- $password = $password_ebot;
- $connectstats = mysql_connect($servername, $username, $password) or die("Could not connect. " . mysql_error());
- mysql_select_db($database_ebot, $connectstats);
- mysql_query("SET NAMES 'utf8'");
- mysql_query('SET character_set_connection=utf8');
- mysql_query('SET character_set_client=utf8');
- mysql_query('SET character_set_results=utf8');
- $qstats_a = mysql_query("SELECT
- case `players`.`team`
- when 'a' then `matchs`.`team_a_name`
- when 'b' then `matchs`.`team_b_name`
- END as `team`,
- `pseudo`, `nb_kill`, `assist`, `death`, `hs`, `firstkill`
- FROM `players` INNER JOIN `matchs` on `matchs`.`id` = `players`.`match_id`
- WHERE `match_id`= " . $gameid . "
- ORDER BY `players` . `team`, `players` . `nb_kill` DESC
- LIMIT 0, 5
- ");
- $qstats_b = mysql_query("SELECT
- case `players`.`team`
- when 'a' then `matchs`.`team_a_name`
- when 'b' then `matchs`.`team_b_name`
- END as `team`,
- `pseudo`, `nb_kill`, `assist`, `death`, `hs`, `firstkill`
- FROM `players` INNER JOIN `matchs` on `matchs`.`id` = `players`.`match_id`
- WHERE `match_id`= " . $gameid . "
- ORDER BY `players` . `team`, `players` . `nb_kill` DESC
- LIMIT 5, 5
- ");
- $matchinfo = "SELECT `team_a_name`, `team_b_name`, `status`, `is_paused`, `score_a`, `score_b` FROM `matchs` WHERE `id`='".$gameid."'";
- $qmatchinfo = mysql_query($matchinfo);
- if ( $qmatchinfo !== false && mysql_num_rows($qmatchinfo) > 0 ) {
- while ( $a = mysql_fetch_assoc($qmatchinfo)) {
- $team_a_name = $a['team_a_name'];
- $team_b_name = $a['team_b_name'];
- $score_a = $a['score_a'];
- $score_b = $a['score_b'];
- switch($score_a){
- case ($score_a > $score_b):
- $score_a = "<font color='green'>" . $score_a . "</font>";
- $score_b = "<font color='red'>" . $score_b . "</font>";
- break;
- case ($score_a < $score_b):
- $score_a = "<font color='red'>" . $score_a . "</font>";
- $score_b = "<font color='green'>" . $score_b . "</font>";
- break;
- case ($score_a == $score_b):
- $score_a = "<font color='orange'>" . $score_a . "</font>";
- $score_b = "<font color='orange'>" . $score_b . "</font>";
- break;
- }
- $status = $a['status'];
- $is_paused = $a['is_paused'];
- switch($status){
- case 0:
- $status = "A partida ainda não começou";
- break;
- case 1:
- $status = "A partida ainda não começou";
- break;
- case 2:
- $status = "A partida ainda não começou";
- break;
- case 3:
- $status = "Knife round";
- break;
- case 4:
- $status = "Escolha de sides";
- break;
- case 5:
- $status = "Aquecimento";
- break;
- case 6:
- $status = "Primeiro side";
- break;
- case 7:
- $status = "Troca de sides";
- break;
- case 8:
- $status = "Segundo side";
- break;
- case 9:
- $status = "Overtime a começar";
- break;
- case 10:
- $status = "Primeiro side do overtime";
- break;
- case 11:
- $status = "Segundo side do overtime a começar";
- break;
- case 12:
- $status = "Segundo side do overtime";
- break;
- case 13:
- $status = "Partida finalizada";
- break;
- default:
- $status = "Partida finalizada";
- break;
- }
- }
- }
- ?>
- <!-- SCOREBOT -->
- <div class="scorebot" style="display: block; width: 660px; margin-bottom: -10px;" align="center">
- <div>
- <p style="font-size: 20pt; margin-bottom: -5px; font-weight: bold;"><?php echo $score_a . " - " . $score_b ?></p>
- <table style="display:inline-table; margin-right: 5px;" width="455" cellspacing="1" cellpadding="1" border="0">
- <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>
- <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"> </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"> </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"> </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"> </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"> </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"> </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"> </th><th width="100" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">Entry K</th></tr></thead>
- <?php
- if ( $qstats_a !== false && mysql_num_rows($qstats_a) > 0 ) {
- while ( $a = mysql_fetch_array($qstats_a)) {
- if ( $a[2] > 0 || $a[3] > 0 || $a[4] > 0 || $a[5] > 0){ ?>
- <tr>
- <td><?php echo substr($a[1], 0, 15);?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[2];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[3];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[4];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo round(($a[2] / $a[4]), 2);?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[5];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo round(($a[5]/$a['2'])*100, 2);?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[6]; ?></td>
- </tr>
- <?php }
- }
- } ?>
- </table><br><br>
- <table style="display:inline-table;" width="455" cellspacing="1" cellpadding="1" border="0">
- <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>
- <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"> </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"> </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"> </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"> </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"> </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"> </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"> </th><th width="100" bgcolor="#ff6600" scope="col" bordercolor="#ff6600" style="text-align: center; color: #FFF;">Entry K</th></tr></thead>
- <?php
- if ( $qstats_b !== false && mysql_num_rows($qstats_b) > 0 ) {
- while ( $a = mysql_fetch_array($qstats_b)) {
- if ( $a[2] > 0 || $a[3] > 0 || $a[4] > 0 || $a[5] > 0){ ?>
- <tr>
- <td><?php echo substr($a[1], 0, 15);?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[2];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[3];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[4];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo round(($a[2] / $a[4]), 2);?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[5];?></td>
- <td></td>
- <td style="text-align: center;"><?php echo round(($a[5]/$a['2'])*100, 2);?></td>
- <td></td>
- <td style="text-align: center;"><?php echo $a[6]; ?></td>
- </tr>
- <?php }
- }
- } ?>
- </table>
- <p>
- <?php echo "Estado: " . $status;
- if($is_paused == 1){
- echo "<font color: orange;><b>[JOGO PAUSADO]</b></font>";
- }
- ?>
- </p>
- </div><br><br>
- <!-- LOG -->
- <?php if( $status !== 0 && $status !== 1 && $status !== 4 && $status !== 13 && $status !== 14 ) {?>
- <style> .log { display: none }</style>
- <?php } ?>
- <div class="log">
- <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>
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement