123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <!-- Events Page for TPMG -->
-
- <!-- http://https://ada.uprrp.edu/~pablo.puig1/TPMG/eventsTable.php -->
-
- <!--Page background color-->
-
- <body style="background-color:#6cd1f4">
-
- <!--Navigation Bar-->
-
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>TPMG admin</title>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
- </head>
- <body>
- <nav class="navbar navbar-expand-lg bg-light">
- <div class="container-fluid">
- <!-- <a class="navbar-brand" href="/">TPMG</a> -->
- <img src="LogoSidename.png" alt="logo" width="200"/>
- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- <ul class="navbar-nav me-auto mb-2 mb-lg-0">
- <li class="nav-item">
- <a href="TPMG.php" class="nav-link active" aria-current="page">Home</a>
- </li>
- <li class="nav-item">
- <a href="usersTable.php" class="nav-link">Users</a>
- </li>
- <li class="nav-item">
- <a href="eventsTable.php" class="nav-link">Events</a>
- </li>
- <li class="nav-item">
- <a href="about.php" class="nav-link">About</a>
- </li>
- </ul>
- </div>
- </div>
- </nav>
-
- <?PHP
-
- //---------------
- // Connection to server and database
- //---------------
-
- $host = "localhost";
- $basedatos = "techos";
- $user = "pablo.puig1";
- $passw = "9NA3kSExI2fGE6eV";
-
- try{
- $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
- }
- catch(Exception $ex){
- print("Error connecting to database: ". $ex->getMessage()) and die();
- }
-
- ?>
-
- <!-- Add User Panel -->
-
- <div class="container-fluid px-1 py-5 mx-auto">
- <div class="row d-flex justify-content-center">
- <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
- <div class="card">
- <h5 class="text-left mb-4">Enter Information to Add Event:</h5>
- <form class="form-card" method="post" action="./addEvent.php">
- <div class="row justify-content-between text-left">
- <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>
- </div>
- <div class="row justify-content-between text-left">
- <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>
- <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>
- </div>
- <br>
- <div class="row justify-content-between text-left">
- <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>
- <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>
- </div>
- <br>
- <div class="row justify-content-between text-left">
- <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>
- </div>
- <br>
- <div class="row justify-content-end">
- <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Add">Add</button> </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <br>
- <!-- Delete User Panel -->
- <div class="row d-flex justify-content-center">
- <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
- <div class="card">
- <h5 class="text-left mb-4">Enter Event-ID to delete:</h5>
- <form class="form-card" method="post" action="./deleteEvent.php">
- <div class="row justify-content-between text-left">
- <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>
- </div>
- <br>
- <div class="row justify-content-end">
- <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Delete">Delete</button> </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Table -->
-
- <style>
-
- table{
- border-collapse: collapse;
- width: 75%
- }
- th, td {
- padding: 8px;
- text-align: left;
- border-bottom: 1px solid black;
- }
- rt {
- background-color: #D6EEEE
- }
- </style>
- <table style="background-color: #ffffff;margin-left:auto;margin-right:auto">
- <?PHP
-
- //---------------
- // Table that displays Users in the server
- //---------------
-
- $queryUsers= "SELECT * from events";
- $stmt=mysqli_prepare($connection, $queryUsers);
- mysqli_stmt_execute($stmt);
-
- mysqli_stmt_bind_result($stmt, $eid, $name, $start_date, $end_date, $participant_count, $participant_limit, $description);
-
- //Making table headers
- print "<tr>";
- print "<td>";
- print "Event-ID"; //eid
- print "</td>";
- print "<td>";
- print "Name"; //name
- print "</td>";
- print "<td>";
- print "Start Date"; //start_date
- print "</td>";
- print "<td>";
- print "End Date"; //end_date
- print "</td>";
- print "<td>";
- print "Participant Count"; //participant_count
- print "</td>";
- print "<td>";
- print "Participant Limit"; //participant_limit
- print "</td>";
- print "<td>";
- print "Description"; //description
- print "</td>";
- print "</tr>";
-
- while(mysqli_stmt_fetch($stmt)){
-
- print "<tr>";
- print "<td>";
- print $eid; //printing EID
- print "</td>";
- print "<td>";
- print $name; //printing name
- print "</td>";
- print "<td>";
- print $start_date; //printing start_date
- print "</td>";
- print "<td>";
- print $end_date; //printing end_date
- print "</td>";
- print "<td>";
- print $participant_count; //printing participant_count
- print "</td>";
- print "<td>";
- print $participant_limit; //printing participant_limit
- print "</td>";
- print "<td>";
- print $description; //printing description
- print "</td>";
- print "</tr>";
-
- print "\n";
- }
- ?>
- </table>
-
-
-
- <br/>
- <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>
- <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>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
- </body>
- </html>
|