PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/draft/draft.php

https://github.com/beakid/md
PHP | 55 lines | 47 code | 5 blank | 3 comment | 23 complexity | 23bd44ad8ceab43f035d10aee3d1e126 MD5 | raw file
  1. <?
  2. include("../session_mysql.php");
  3. include("../functions.php");
  4. include("../include/kortparm_functions.php");
  5. //man utgår från draft-id som kontrolleras mot usern och sen visar man var man är i draften eller visas kortpoolen för lekbygge ->
  6. if($_SESSION[md_userid]) $my_current_draft_id = @mysql_result(mysql_query("SELECT fk_draft_id FROM md_draft2user
  7. INNER JOIN md_draft ON pk_draft_id = fk_draft_id
  8. WHERE fk_user_id = $_SESSION[md_userid] AND draft_status < 3"),0);
  9. if(!$_GET[id])
  10. {
  11. $draft_id = $my_current_draft_id;
  12. }
  13. else { $draft_id = $_GET[id]; }
  14. if(!$draft_id && !$_GET[id])
  15. {
  16. header("Location: index.php?"); die();
  17. }
  18. $draft_info = mysql_query("SELECT * FROM md_draft
  19. WHERE pk_draft_id = $draft_id");
  20. if(!mysql_num_rows($draft_info))
  21. {
  22. header("Location: index.php"); die();
  23. } else $draft_info = mysql_fetch_array($draft_info);
  24. include("draft_functions.php");
  25. if($_SESSION[md_userid]) @$mystatus = mysql_result(mysql_query("SELECT seat_status FROM md_draft2user WHERE fk_user_id = $_SESSION[md_userid] AND fk_draft_id = $draft_id"),0);
  26. #kolla om man har tillgång till draften
  27. $allowed_id = $draft_id;
  28. if($draft_info[draft_status] > 0 && $my_current_draft_id && $my_current_draft_id != $draft_id) { $allowed_id = false;}
  29. ?>
  30. <?=printHeader("MagicDraft","draft",$allowed_id)?>
  31. <div id="content"<? if($draft_info[draft_status] == 1) echo " class=\"blackback\"";?>>
  32. <?
  33. if($draft_info[draft_status] == 0) {
  34. include("draft_waiting.php");
  35. //visa vilka som är med, eventuell join-knapp för den user som inte är med, eventuell login combo join för den oinloggade
  36. } elseif($draft_info[draft_status] == 1 && $allowed_id) {
  37. include("draft_confirm.php");
  38. } elseif($draft_info[draft_status] == 2 && $allowed_id) {
  39. include("draft_active.php");
  40. } elseif($draft_info[draft_status] == 3 && $allowed_id) {
  41. include("draft_deckbuilding.php");
  42. }
  43. else echo "<div id=\"left\"></div><div id=\"middle\"><h1>You're not allowed in here.</h1>
  44. <br />
  45. <div class=\"text\"><img src=\"../images/arrow_left.png\" alt=\"\" class=\"avatar\" /> <a href=\"./\">Ok, thanks, bye.</a></div></div>";
  46. ?>
  47. <div class="breaker"></div>
  48. </div>
  49. </body>
  50. </html>