123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <!-- Users table Page for TPMG -->
-
- <!-- http://https://ada.uprrp.edu/~pablo.puig1/TPMG/userTable.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>
- <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 User:</h5>
- <form class="form-card" method="post" action="./addUser.php">
- <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">First and Last name<span class="text-danger"> *</span></label> <input type="text" id="username" name="username" placeholder="" onblur="validate(1)" > </div>
- <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Account type<span class="text-danger"> *</span></label> <input type="text" id="ACC" name="ACC" placeholder="" onblur="validate(2)" > </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">Email<span class="text-danger"> *</span></label><input type="text" id="email" name="email" placeholder="" onblur="validate(3)"> </div>
- <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Phone number<span class="text-danger"> *</span></label> <input type="text" id="phone" name="phone" placeholder="" onblur="validate(4)"> </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 User-ID to delete:</h5>
- <form class="form-card" method="post" action="./deleteUser.php">
- <div class="row justify-content-between text-left">
- <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">User-ID<span class="text-danger"> *</span></label> <input type="int" id="UID" name="UID" 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
- //---------------
-
- $querySeeUsers= "SELECT * from users";
- $stmtSee=mysqli_prepare($connection, $querySeeUsers);
- mysqli_stmt_execute($stmtSee);
-
- mysqli_stmt_bind_result($stmtSee, $uid, $acc_type, $name, $email, $phone);
-
- //Making table headers
- print "<tr>";
- print "<td>";
- print "User-ID"; //User-ID
- print "</td>";
- print "<td>";
- print "Account Type"; //Account type
- print "</td>";
- print "<td>";
- print "Name"; //Name
- print "</td>";
- print "<td>";
- print "Email"; //Email
- print "</td>";
- print "<td>";
- print "Phone"; //Phone
- print "</td>";
- print "</tr>";
-
- //iterating line by line
- while(mysqli_stmt_fetch($stmtSee)){
-
- print "<tr>";
- print "<td>";
- print $uid; //printing UID
- print "</td>";
- print "<td>";
- print $acc_type; //printing account type
- print "</td>";
- print "<td>";
- print $name; //printing name
- print "</td>";
- print "<td>";
- print $email; //printing email
- print "</td>";
- print "<td>";
- print $phone; //printing phone
- print "</td>";
-
- 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>
|