Нет описания

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!-- Events Page for TPMG -->
  2. <!-- http://https://ada.uprrp.edu/~pablo.puig1/TPMG/eventsTable.php -->
  3. <!--Page background color-->
  4. <body style="background-color:#6cd1f4">
  5. <!--Navigation Bar-->
  6. <!doctype html>
  7. <html lang="en">
  8. <head>
  9. <meta charset="utf-8">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <title>TPMG admin</title>
  12. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
  13. </head>
  14. <body>
  15. <nav class="navbar navbar-expand-lg bg-light">
  16. <div class="container-fluid">
  17. <!-- <a class="navbar-brand" href="/">TPMG</a> -->
  18. <img src="LogoSidename.png" alt="logo" width="200"/>
  19. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  20. <span class="navbar-toggler-icon"></span>
  21. </button>
  22. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  23. <ul class="navbar-nav me-auto mb-2 mb-lg-0">
  24. <li class="nav-item">
  25. <a href="TPMG.php" class="nav-link active" aria-current="page">Home</a>
  26. </li>
  27. <li class="nav-item">
  28. <a href="usersTable.php" class="nav-link">Users</a>
  29. </li>
  30. <li class="nav-item">
  31. <a href="eventsTable.php" class="nav-link">Events</a>
  32. </li>
  33. <li class="nav-item">
  34. <a href="about.php" class="nav-link">About</a>
  35. </li>
  36. </ul>
  37. </div>
  38. </div>
  39. </nav>
  40. <?PHP
  41. //---------------
  42. // Connection to server and database
  43. //---------------
  44. $host = "localhost";
  45. $basedatos = "techos";
  46. $user = "pablo.puig1";
  47. $passw = "9NA3kSExI2fGE6eV";
  48. try{
  49. $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
  50. }
  51. catch(Exception $ex){
  52. print("Error connecting to database: ". $ex->getMessage()) and die();
  53. }
  54. ?>
  55. <!-- Add User Panel -->
  56. <div class="container-fluid px-1 py-5 mx-auto">
  57. <div class="row d-flex justify-content-center">
  58. <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
  59. <div class="card">
  60. <h5 class="text-left mb-4">Enter Information to Add Event:</h5>
  61. <form class="form-card" method="post" action="./addEvent.php">
  62. <div class="row justify-content-between text-left">
  63. <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">Event name<span class="text-danger"> *</span></label> <input type="text" id="name" name="name" placeholder="" onblur="validate(1)" style="width: 275px"> </div>
  64. </div>
  65. <div class="row justify-content-between text-left">
  66. <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Start date<span class="text-danger"> *</span></label> <input type="text" id="Sdate" name="Sdate" placeholder="YYYY-MM-DD" onblur="validate(2)" > </div>
  67. <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">End date<span class="text-danger"> *</span></label> <input type="text" id="Edate" name="Edate" placeholder="YYYY-MM-DD" onblur="validate(3)" > </div>
  68. </div>
  69. <br>
  70. <div class="row justify-content-between text-left">
  71. <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Participant count<span class="text-danger"> *</span></label><input type="int" id="Pcount" name="Pcount" placeholder="" onblur="validate(4)"> </div>
  72. <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Participant limit<span class="text-danger"> *</span></label> <input type="int" id="Plimit" name="Plimit" placeholder="" onblur="validate(5)"> </div>
  73. </div>
  74. <br>
  75. <div class="row justify-content-between text-left">
  76. <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">Event description<span class="text-danger"> *</span></label> <input type="text" id="Desc" name="Desc" placeholder="" onblur="validate(1)" style="width: 900px"> </div>
  77. </div>
  78. <br>
  79. <div class="row justify-content-end">
  80. <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Add">Add</button> </div>
  81. </div>
  82. </form>
  83. </div>
  84. </div>
  85. </div>
  86. <br>
  87. <!-- Delete User Panel -->
  88. <div class="row d-flex justify-content-center">
  89. <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
  90. <div class="card">
  91. <h5 class="text-left mb-4">Enter Event-ID to delete:</h5>
  92. <form class="form-card" method="post" action="./deleteEvent.php">
  93. <div class="row justify-content-between text-left">
  94. <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">Event-ID<span class="text-danger"> *</span></label> <input type="int" id="EID" name="EID" placeholder="" onblur="validate(1)" style="width: 275px"> </div>
  95. </div>
  96. <br>
  97. <div class="row justify-content-end">
  98. <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Delete">Delete</button> </div>
  99. </div>
  100. </form>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- Table -->
  106. <style>
  107. table{
  108. border-collapse: collapse;
  109. width: 75%
  110. }
  111. th, td {
  112. padding: 8px;
  113. text-align: left;
  114. border-bottom: 1px solid black;
  115. }
  116. rt {
  117. background-color: #D6EEEE
  118. }
  119. </style>
  120. <table style="background-color: #ffffff;margin-left:auto;margin-right:auto">
  121. <?PHP
  122. //---------------
  123. // Table that displays Users in the server
  124. //---------------
  125. $queryUsers= "SELECT * from events";
  126. $stmt=mysqli_prepare($connection, $queryUsers);
  127. mysqli_stmt_execute($stmt);
  128. mysqli_stmt_bind_result($stmt, $eid, $name, $start_date, $end_date, $participant_count, $participant_limit, $description);
  129. //Making table headers
  130. print "<tr>";
  131. print "<td>";
  132. print "Event-ID"; //eid
  133. print "</td>";
  134. print "<td>";
  135. print "Name"; //name
  136. print "</td>";
  137. print "<td>";
  138. print "Start Date"; //start_date
  139. print "</td>";
  140. print "<td>";
  141. print "End Date"; //end_date
  142. print "</td>";
  143. print "<td>";
  144. print "Participant Count"; //participant_count
  145. print "</td>";
  146. print "<td>";
  147. print "Participant Limit"; //participant_limit
  148. print "</td>";
  149. print "<td>";
  150. print "Description"; //description
  151. print "</td>";
  152. print "</tr>";
  153. while(mysqli_stmt_fetch($stmt)){
  154. print "<tr>";
  155. print "<td>";
  156. print $eid; //printing EID
  157. print "</td>";
  158. print "<td>";
  159. print $name; //printing name
  160. print "</td>";
  161. print "<td>";
  162. print $start_date; //printing start_date
  163. print "</td>";
  164. print "<td>";
  165. print $end_date; //printing end_date
  166. print "</td>";
  167. print "<td>";
  168. print $participant_count; //printing participant_count
  169. print "</td>";
  170. print "<td>";
  171. print $participant_limit; //printing participant_limit
  172. print "</td>";
  173. print "<td>";
  174. print $description; //printing description
  175. print "</td>";
  176. print "</tr>";
  177. print "\n";
  178. }
  179. ?>
  180. </table>
  181. <br/>
  182. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
  183. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
  184. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
  185. </body>
  186. </html>