%PDF- %PDF-
Direktori : /home/eirtvhdf/www/admin/ |
Current File : /home/eirtvhdf/www/admin/users.php |
<?php include('includes/header.php'); include('includes/navbar.php'); require('database.php'); $sql = "SELECT * FROM user INNER JOIN joint_venture ON user.id = joint_venture.user_id;"; $result = mysqli_query($dbh, $sql); // mysqli_free_result($result); ?> <?php if(isset($_POST['activate'])){ $user_id = $_POST['user_id']; $sql = "UPDATE user SET status='1' WHERE id='$user_id'"; mysqli_query($dbh, $sql); ?> <script> window.location.href = 'users.php'; </script> <?php } if(isset($_POST['deactivate'])){ $user_id = $_POST['user_id']; $sql = "UPDATE user SET status='0' WHERE id='$user_id'"; mysqli_query($dbh, $sql); ?> <script> window.location.href = 'users.php'; </script> <?php } ?> <div class="modal fade" id="addadminprofile" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Add Admin Data</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form action="code.php" method="POST"> <div class="modal-body"> <div class="form-group"> <label> Username </label> <input type="text" name="username" class="form-control" placeholder="Enter Username"> </div> <div class="form-group"> <label>Email</label> <input type="email" name="email" class="form-control" placeholder="Enter Email"> </div> <div class="form-group"> <label>Password</label> <input type="password" name="password" class="form-control" placeholder="Enter Password"> </div> <div class="form-group"> <label>Confirm Password</label> <input type="password" name="confirmpassword" class="form-control" placeholder="Confirm Password"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="submit" name="registerbtn" class="btn btn-primary">Save</button> </div> </form> </div> </div> </div> <div class="container-fluid"> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">User Login Credential <!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addadminprofile">--> <!-- Add Admin Profile --> <!--</button>--> </h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th> S.No </th> <th> Name </th> <th>Email </th> <th>Username</th> <th>Password</th> <th> </th> </tr> </thead> <tbody> <?php $num = 1; while ($row = mysqli_fetch_assoc($result)) { ?> <tr> <td><?php echo $num ?></td> <td> <?php echo $row['name']; ?> </td> <td> <?php echo $row['email']; ?></td> <td> <?php echo $row['username']; ?> </td> <td> <?php echo $row['password']; ?> </td> <?php $uID = $row['user_id']; $mysqli_query = mysqli_query($dbh,"select status from user where id ='$uID'"); $rows = mysqli_fetch_array($mysqli_query); $stat = $rows['status']; if($stat == 1){ ?> <td> <form method="post"> <input type="hidden" name="user_id" value="<?php echo $uID; ?>"> <button type="submit" name="deactivate" onclick="return confirm('Are you sure you want to deactivate the user?')" class="btn btn-danger"> Deactivate</button> </form> </td> <?php }else if($stat == 0){ ?> <td> <form method="post"> <input type="hidden" name="user_id" value="<?php echo $uID; ?>"> <input type="submit" name="activate" onclick="return confirm('Are you sure you want to activate the user?')" class="btn btn-success" value="Activate" /> </form> </td> <?php } ?> </tr> <?php $num++; } ?> </tbody> </table> </div> </div> </div> </div> <!-- /.container-fluid --> <?php // include('includes/scripts.php'); include('includes/footer.php'); ?>