Advertisement
Guest User

Untitled

a guest
May 16th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.17 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  4.     <title>.: Anthology's Team | Webadmin - Shuffle Time :.</title>
  5.     <link rel="stylesheet" media="screen" type="text/css" title="style" href="../style/matchmaker.css" />
  6.     <!--
  7.     <script language="JavaScript">
  8.         window.resizeTo(500,500)
  9.     </script>
  10.     -->
  11. </head>
  12. <body>
  13.    <p>
  14. <?php
  15.  
  16. ############################################
  17. #        Anthology's Webadmin              #
  18. #             Matchmaker                   #
  19. ############################################
  20.  
  21. ## Page generant le formulaire qui listera tout les utilisateurs disponible du Mumble ##
  22.  
  23. // Different include necessaire
  24. include('../inc/config.inc.php');
  25.  
  26. // Connexion à la BDD
  27. mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
  28. mysql_select_db($db_bd) or die(mysql_error());
  29.  
  30. // Include necessaire APRES la connexion à la BDD
  31. include('../inc/functions.php');
  32.  
  33. if(!empty($_COOKIE["username_ant"]) OR !empty($_COOKIE["password_ant"])){
  34.     $_SESSION['user'] = $_COOKIE['username_ant'];
  35.     $_SESSION['password'] = $_COOKIE['password_ant'];
  36.     // On recupere toutes les infos possibles sur l'utilisateur
  37.     $query = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['user']."' AND password = '".$_SESSION['password']."'"));
  38.     if($query){ // Si on a bien un utilisateur pour ce pseudo et ce mot de passe
  39.         // Liste des variables dont on pourrait avoir besoin dans cette page
  40.         $_SESSION['level'] = $query['level'];
  41.         $_SESSION['vip'] = $query['vip'];
  42.     }
  43. }
  44.  
  45. // On verifie que la Webadmin ne soit pas OFF
  46. $webadmin_status = WebadminStatus();
  47. if($webadmin_status == "1"){
  48. ////////////////////////////////////////////////////////////////////////////////////
  49.  
  50. if($_SESSION['level'] <= '2' && !$_SESSION['vip']){
  51.      echo'<table class="bordercolor" border="0">';
  52.  
  53.     foreach($_POST as $key => $value){
  54.         $players[] = htmlspecialchars($key);
  55.     }
  56.  
  57.     shuffle($players);
  58.    
  59.     $global = count($players);
  60.     $count_team1 = (($global - ($global % '2')) / 2);
  61.     $count_team2 = ($global - $count_team1);
  62.     $team1 = '';
  63.     $team2 = '';
  64.    
  65.     $i = 1;
  66.    
  67.     foreach($players as $key => $value) {
  68.         if ($i <= $count_team1) {
  69.             $team1[] = $value;
  70.         } else {
  71.             $team2[] = $value;
  72.         }
  73.         $i++;
  74.     }
  75.    
  76.     $i = '0';
  77.     echo '<tr>
  78.         <td class="Cell_Couleur1" nowrap><b>Team 1</b></td>
  79.         <td class="Cell_Couleur1" nowrap><b>Team 2</b></td>
  80.     </tr>';
  81.     while($i != $count_team2){
  82.         echo '
  83.         <tr>';
  84.         if(isset($team1[$i])){
  85.             echo '<td class="Cell_Couleur2" nowrap>'.htmlspecialchars($team1[$i]).'</td>';
  86.         }else{
  87.             echo '<td class="Cell_Couleur2" nowrap></td>';
  88.         }
  89.         if(isset($team2[$i])){
  90.             echo '<td class="Cell_Couleur2" nowrap>'.htmlspecialchars($team2[$i]).'</td>';
  91.         }else{
  92.             echo '<td class="Cell_Couleur2" nowrap></td>';
  93.         }
  94.         echo '</tr>';
  95.         $i++;
  96.     }
  97.  
  98. }else{
  99.     echo '<br /><br /><span class="red">Sorry, mais visiblement tu na pas le droit d\'être ici!</span>';
  100. }
  101. ////////////////////////////////////////////////////////////////////////////////////
  102.  
  103. // Parsage + Affichage du contenu
  104. }else{
  105.     echo $webadmin_status;
  106. }
  107.  
  108. ?>
  109.    </p>
  110. </form>
  111. </body>
  112. </html>
  113.  
  114.    </p>
  115. </form>
  116. </body>
  117. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement