PageRenderTime 48ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/creategame.php

https://bitbucket.org/mikel3377/webgame
PHP | 45 lines | 36 code | 9 blank | 0 comment | 2 complexity | b44f1188f9ac7bd0933ac6350005f58d MD5 | raw file
  1. <?php
  2. include 'lib/applicationlib.php';
  3. PageHelper::$PageTitle = "Challenge Player";
  4. PageHelper::AddScript( "scripts/index.js");
  5. if(isset( $_POST['id']))
  6. {
  7. $id = mysql_real_escape_string($_POST['id']);
  8. $user = Application::GetCurrentUser();
  9. $gameid = MySql::CreateGame( $id, $user->ID );
  10. PageHelper::Redirect( "canvasgame.php?id=$gameid");
  11. return;
  12. }
  13. PageHelper::Render( function() {
  14. $user = Application::GetCurrentUser();
  15. ?>
  16. <div class="centered-content">
  17. <?
  18. $query = "SELECT * FROM userpass WHERE id != $user->ID";
  19. $result = mysql_query( $query );
  20. while( $row = mysql_fetch_array($result))
  21. {
  22. ?>
  23. <div>
  24. <form action="creategame.php" method="POST">
  25. <?=$row['user']?>
  26. <input type="hidden" name="id" value="<?=$row['id']?>"/>
  27. <input type="submit" value="Challenge"/>
  28. </form>
  29. </div>
  30. <?
  31. }
  32. ?>
  33. </div>
  34. <?
  35. });
  36. ?>