Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.12 KB | None | 0 0
  1. <?php
  2. require_once("includes/session.php");
  3. require_once("includes/replay.php");
  4.  
  5. $sUser = new SessionUser();
  6.  
  7. if ($sUser->IsLoggedIn())
  8. {
  9.   // Logged in
  10.   echo "You are signed in, " . $sUser->GetUserLogin();
  11.    
  12.   ?>  
  13.   <a href="signout.php">Sign out.</a>  
  14.   <br/><br/><br/>
  15.   <?php
  16.  
  17.     $groupID = $sUser->GetGroupID();
  18.  
  19.     echo sprintf("<b>Login</b>: %s <br/> <b>ID</b>: %s <br/> <b>Group</b>: %s <br/> <b>Email</b>: %s <br/>", $sUser->GetUserLogin(), $sUser->GetUserID(), $sUser->GetGroupName($groupID), $sUser->GetUserEmail());
  20. }
  21. else
  22. {
  23.   // Need to log in
  24. ?>
  25.  
  26. <b>Login:</b>
  27. <form name="login" action="signin.php" method="post">
  28. Login: <input type="text" name="login" />
  29. Password: <input type="password" name="password" />
  30. <input type="submit" value="Login" />
  31. </form>
  32. <br/>
  33.  
  34. <b>Not registered?</b>
  35. <form name="register" action="register.php" method="post">
  36. <table border="0">
  37. <tr>
  38.  <td>Login</td>
  39.  <td><input type="text" name="login" autocomplete="off" /></td>
  40.  </tr>
  41.   <td>Password</td>
  42.  <td><input type="password" name="password" autocomplete="off" /></td>
  43.  </tr>
  44.  <td>Email</td>
  45.  <td><input type="text" name="email" autocomplete="off" /></td>
  46.  </tr>
  47.  </table><br/>
  48.  <input type="submit" value="Register" />
  49.  </form>
  50. <?php
  51. }
  52.  
  53. ?>
  54.  
  55. <hr />
  56. <br/>
  57. <b>Users</b><br/><br/>
  58.  
  59. <?php
  60.  
  61. $userList = $sUser->GetUsers();
  62.  
  63. ?>
  64.  
  65. <table border="1" width="90%" align="center">
  66. <tr>
  67.     <th>ID</th><th>Username</th><th>Email</th><th>Group ID</th>
  68. </tr>
  69.  
  70. <?php
  71.     foreach ($userList as $val)
  72.     {
  73.         $id = $val->GetUserID();
  74.         $login = $val->GetUserLogin();
  75.         $email = $val->GetUserEmail();
  76.         if ($email == null) $email = "none";
  77.         $groupID = $val->GetGroupID();
  78.    
  79.         echo sprintf ("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", $id, $login, $email, $groupID);
  80.     }
  81. ?>
  82.  
  83. </table>
  84.  
  85. <br/>
  86. <hr />
  87.  
  88. <br/>
  89.  
  90.   <form enctype="multipart/form-data" action="upload.php" method="post">
  91.     <input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
  92.     Choose a file to upload: <input name="uploaded_file" type="file" />
  93.     <input type="submit" value="Upload" />
  94.   </form>
  95.  
  96. <br/>
  97.  
  98. <hr/>
  99.  
  100. <?php
  101.  
  102. /*$replay = new Replay();
  103. $replay->GetReplayFromFile ("Replays/09_sc2tv-ru_iiGames-ru-Open-01.SC2Replay");
  104. $players = $replay->GetPlayers();
  105.  
  106. echo "Map: " . $replay->GetMap() . "<br/>";
  107. echo "Game type: " . $replay->GetGameType() . "<br/>";
  108. echo "Length: " . $replay->GetLength() . "<br/>";
  109. echo "Speed: " . $replay->GetSpeed() . "<br/>";
  110. echo "Replay build: " . $replay->GetBuild() . "<br/>";
  111.  
  112. echo "<br/>";
  113.  
  114. foreach ($players as $player)
  115. {
  116.     echo sprintf("(%s) <font color=\"#%s\">%s</font> [Avg APM: %s] [Team: %s]<br/>", $player->GetRace(), $player->GetColor(), $player->GetName(), $player->GetAverageAPM(), $player->GetTeam());
  117. }
  118. */
  119.  
  120. $rep = new Replay();
  121. $replays = $rep->GetReplays(30, 0);
  122.  
  123.  
  124. foreach ($replays as $replay)
  125. {
  126. ?>
  127.  
  128. <table border="1" width="90%" align="center" cellpadding="0" cellspacing="0">
  129. <td width="500">
  130.     <table border="1" width="100%">
  131.     <tr><th>Map</th><td><?php echo $replay->GetMap(); ?></td></tr>
  132.     <tr><th>Filename</th><td><?php echo "<a href=\"Replays/{$replay->GetFilename()}\">Get Replay</a>"; ?></td></tr>
  133.     <tr><th>GameType</th><td><?php echo $replay->GetGameType(); ?></td></tr>
  134.     <tr><th>Length</th><td><?php echo $replay->GetLength(); ?></td></tr>
  135.     <tr><th>Speed</th><td><?php echo $replay->GetSpeed(); ?></td></tr>
  136.     <tr><th>Build</th><td><?php echo $replay->GetBuild(); ?></td></tr>
  137.     <tr><th>Date of addition</th><td><?php echo $replay->GetDate(); ?></td></tr>
  138.     <tr><th>MD5</th><td><?php echo $replay->GetHash(); ?></td></tr>
  139.     </table>
  140. </td>
  141. <td valign="top">
  142.     <table border="1" width="100%">
  143.     <tr>
  144.         <th colspan="4">Players</th>
  145.     </tr>
  146.     <tr>
  147.         <th>Name</th><th>Race</th><th width="140">Average APM</th><th>Team</th>
  148.     </tr>
  149.     <?php
  150.         foreach ($replay->GetPlayers() as $player)
  151.         {
  152.             $color = $player->GetColor();
  153.             echo "<tr><td><font color=\"#{$color}\">{$player->GetName()}</font></td><td>{$player->GetRace()}</td><td>{$player->GetAverageAPM()}</td><td>{$player->GetTeam()}</td></tr>";
  154.         }  
  155.     ?>
  156.     </table>
  157. </td>
  158. </table>
  159. <br/>
  160.  
  161. <?php
  162. }
  163.  
  164. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement