PageRenderTime 53ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/admin_players_youth.php

https://bitbucket.org/DarkMantis/pfb
PHP | 120 lines | 73 code | 23 blank | 24 comment | 5 complexity | a76f41b7c7b8bc5ea86f194b2f58c292 MD5 | raw file
  1. <?php
  2. //*******************************************************
  3. //
  4. // File: admin_players.php
  5. // Author: Gavin Uttley
  6. // Date: 02-AUG-2004
  7. // Purpose: provide admin function adding players
  8. //
  9. // Revisions: 02-AUG-2004 - Initial
  10. //
  11. //
  12. //
  13. //*******************************************************
  14. if(defined("__DEBUG__")) {
  15. print_r($_POST);
  16. }
  17. //
  18. // make sure it dosnt exit prematurly coz of processing limit
  19. //
  20. set_time_limit(0);
  21. echo "<form name=\"players_add\" method=\"post\" >";
  22. table_open("35%");
  23. table_row_open();
  24. table_data("Players to add:", "left");
  25. table_data("<input type=\"textbox\" name=\"count\">", "center");
  26. table_data("Position:", "left");
  27. table_data(position_select($position), "center");
  28. table_row_close();
  29. table_row_open();
  30. table_data("<input type=\"submit\" value=\"Submit\">","right", 4);
  31. table_row_close();
  32. table_close();
  33. echo "</form>";
  34. if(isset($_POST['position']) & is_numeric($_POST['count'])) {
  35. table_open("75%");
  36. table_row_open();
  37. table_header("Name" ,"center");
  38. table_header("Age" ,"center");
  39. table_header("Side" ,"center");
  40. table_header("Position" ,"center");
  41. table_header("Speed" ,"center");
  42. table_header("Agility" ,"center");
  43. table_header("Awareness" ,"center");
  44. table_header("Heading" ,"center");
  45. table_header("Tackling" ,"center");
  46. table_header("Passing" ,"center");
  47. table_header("Shooting" ,"center");
  48. table_header("Aggression" ,"center");
  49. table_header("Flair" ,"center");
  50. table_row_close();
  51. for( $i=0; $i<$_POST['count']; $i++) {
  52. table_row_open();
  53. //
  54. // Generate the data
  55. //
  56. $name = random_name();
  57. $age = mt_rand(16,19);
  58. $side = mt_rand(1,3);
  59. if($_POST['position']==0) {
  60. $position = mt_rand(1,4);
  61. } else {
  62. $position = $_POST['position'];
  63. }
  64. $speed = mt_rand(1,4);
  65. $agility = mt_rand(1,3);
  66. $awareness = mt_rand(1,4);
  67. $heading = mt_rand(1,3);
  68. $tackling = mt_rand(1,3);
  69. $passing = mt_rand(1,3);
  70. $shooting = mt_rand(1,3);
  71. $aggression = mt_rand(1,6);
  72. $flair = mt_rand(1,6);
  73. //
  74. // Add the player to the db
  75. //
  76. player_add($name, $age, $side, $position, $speed, $agility, $awareness, $heading, $tackling, $passing, $shooting, $aggression, $flair, 1, 0);
  77. //
  78. // Print the data
  79. //
  80. table_data($name, "center");
  81. table_data($age, "center");
  82. table_data(foot_name($side), "center");
  83. table_data(position_name($position), "center");
  84. table_data($speed, "center");
  85. table_data($agility, "center");
  86. table_data($awareness, "center");
  87. table_data($heading, "center");
  88. table_data($tackling, "center");
  89. table_data($passing, "center");
  90. table_data($shooting, "center");
  91. table_data($aggression, "center");
  92. table_data($flair, "center");
  93. table_row_close();
  94. }
  95. table_close();
  96. }
  97. ?>