Your IP : 18.118.1.63


Current Path : /home/lentoinv/covisclubinternational.com/profile/
Upload File :
Current File : //home/lentoinv/covisclubinternational.com/profile/generateUserPin.php

<?php
session_start(); ob_start();
include("lib/connect.inc.php");
include("lib/index.php");

if(isset($_POST['ViewUserPin'])){
    $_SESSION['pinuser'] = $_POST['username'];
    header("location: userpins.php");
}
//if(isset($report)){
//    unset($_SESSION['rs']);
//}
$sql = $db->query("SELECT * FROM pin WHERE rep != '$uid' AND tm = '1'");
$all = mysqli_num_rows($sql);

if(array_key_exists('reset', $_POST)){unset($_SESSION['end']); }

$end = isset($_SESSION['end'])?$_SESSION['end']:50 ;

if(array_key_exists('prev', $_POST)){$_SESSION['end'] = $end-50; }
elseif(array_key_exists('next', $_POST)){if(!empty($_POST['page'])){if(((int)($all/50))<($_POST['page']-1)){$report='Specified page does not exist'; $count=1;}else{$_SESSION['end'] = $_POST['page']*50;}}else{$_SESSION['end'] = $end+50;} }

$end = isset($_SESSION['end'])?$_SESSION['end']:50 ;

$start = $end-49;
//$all = 0;
if($all<=$end){$end = $all;}

$showing = 'Showing '.$start.' to '.$end.' of '.$all.' Records';

if($start>1){$prev = TRUE;}else{$prev = FALSE;}
if($end<$all){$next = TRUE;}else{$next = FALSE;}



?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="treant/examples/tree/basic-example2.css">
    <!-- Neptune CSS -->
    <link rel="stylesheet" href="css/core.css">
    <title>Generate User Pin</title>
    <link rel="shortcut icon" href="img/fav.png" />
    <link rel="shortcut icon" href="img/fav.png" />
    <link rel="stylesheet" href="treant/Treant.css">
    <link rel="stylesheet" href="treant/examples/tree/basic-example2.css">
    <!-- Neptune CSS -->
    <link rel="stylesheet" href="css/core.css">

    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Vendor CSS -->
    <link rel="stylesheet" href="../vendor/bootstrap4/css/bootstrap.min.css">
    <link rel="stylesheet" href="../vendor/themify-icons/themify-icons.css">
    <link rel="stylesheet" href="../vendor/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../vendor/animate.css/animate.min.css">
    <link rel="stylesheet" href="../vendor/jscrollpane/jquery.jscrollpane.css">
    <link rel="stylesheet" href="../vendor/waves/waves.min.css">
    <link rel="stylesheet" href="../vendor/switchery/dist/switchery.min.css">
    <link rel="stylesheet" href="../vendor/morris/morris.css">
    <link rel="stylesheet" href="../vendor/jvectormap/jquery-jvectormap-2.0.3.css">
    <!-- Font Awesome -->
    <?php include('head.php'); ?>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">

    <?php include('nav.php'); ?>
    <!-- Content Header (Page header) -->

            <!-- Content Wrapper. Contains page content -->
            <div class="content-wrapper">

    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>Registration Pins Generated For Users</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="index.php">Home</a></li>
              <li class="breadcrumb-item active">Registration pin</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
                <!-- Content Header (Page header) -->
                <div class="content">
            <div class="container-fluid">

                 <div class="row">
                <div class="col-md-8">
                <div class="card">
                     <div class="card-header text-white bg-dark">
                                    <h5 style="float: left">Electronic Pin</h5></div>
                    <div class="card-body">
                        <form method="post" class="form-group">
                            <input type="number" name="pin" placeholder="Search Pin...." class="form-control">
                            <button type="submit" name="searchPin" class="btn bg-white b-a-0"> <i class="ti-search"></i>
                            </button>
                        </form>

                        <div class="table-responsive">
                                           <table class="table table-striped table-bordered dataTable" id="example1">

                                                <thead>
                                                <tr>

                                                    <th>SN</th>
                                                    <th>E-PIN</th>
                                                    <th>PIN Date</th>
                                                    <th>Status</th>
                                                    <th>Users</th>
                                                    <th>Used By</th>
                                                </tr>
                                                </thead>




                                                <tbody>
                                                <?php
                                                if(isset($_POST['searchPin'])){
                                                    $pin1 = $_POST['pin'];
                                                    echo "<div class='float-xs-right '><a href='?qw12re6fsvdf' class='btn btn-xs btn-primary'>Back</a></div>";
                                                    if($sql1 = $db->query("SELECT * FROM pin WHERE pin='$pin1' AND rep != '$uid' AND tm = '1' ORDER BY status ASC, created DESC")){
                                                        while($row1 = $sql1->fetch_assoc()) {
                                                            $rep1 = userName($row1['rep'],'user');
                                                            if($row1['status']==1){$sta='used'; }else{$sta='active';} $user1 = $row1['id'];
                                                            $uname1 = ($row1['status']==1)?$user1:'';
                                                            echo '<tr>
                                      <td ></td>
                                      <th  >'.$row1['pin'].'</th>
                                      <td >'.$row1['created'].'</td>
                                      <td >'.$sta.'</td>
                                      <td >'.$rep1.'</td>
                                      <td >'.$uname1.'</td>
                                    </tr>';
                                                        }} }else {
                                                    $i=$start; $start1=$start-1; $end1=$end-$start+1;  $sql = $db->query("SELECT * FROM pin WHERE rep != '$uid' AND tm = '1' ORDER BY status ASC, created DESC LIMIT $start1, $end1 ");
                                                    while($row = mysqli_fetch_assoc($sql)){  $e = $i++;
                                                        $rep = userName($row['rep'],'user');
                                                        $user = $row['id'];
                                                        if($row['status']==1){$st='used'; }else{$st='active';}
                                                        $uname = ($row['status']==1)? $user:'';
                                                        echo '<tr>
                                      <td >'.$e.'</td>
                                      <th  >'.$row['pin'].'</th>
                                      <td >'.$row['created'].'</td>
                                      <td >'.$st.'</td>
                                       <td >'.$rep.'</td>
                                      <td >'.$uname.'</td>
                                    </tr>';
                                                    }} ?>

                                                </tbody>
                                            </table>
                                        </div>
                                        <form method="post">
                                            <input type="button" name="next" class="btn btn-info" value="<?php echo $showing; ?>" >

                                            <input type="<?php if($prev == TRUE){ echo 'submit'; }else{echo 'button';} ?>" name="prev" class="btn btn-primary" value="Previous">
                                            <input type="text" name="page" placeholder="Page" class="btn">
                                            <input type="<?php if($next == TRUE){ echo 'submit'; }else{echo 'button';} ?>" name="next" class="btn btn-success" value="next">

                                            <input type="submit" name="reset" class="btn btn-warning" value="Reset">
                                        </form>
                                    
                                    
                                    

                    </div>

                            </div>


                    </div>
                        <div class="col-md-4">
                            <div class="card ">
                                
                                   <div class="card-header text-white bg-dark">
                                             <h5 style="float: left;">Generate Pin for User</h5>
                                        </div>
                                   
                                    <br/>
                                    <div class="card-body">
                                         <form method="post" class="form-group">
                                            <input type="number" name="pin" class="form-control" placeholder="No of Pin"> <br>
                                            <input type="text" id="username" name="username" class="form-control" placeholder="Enter a Valid Username"> <br>
                                            <h5 id="output"></h5>
                                            <button class="btn btn-primary float-xs-left" name="ViewUserPin">View User PINs</button>
                                            <button class="btn btn-success float-xs-right" name="GenerateUserPin">Generate</button>
                                        </form>
                                        
                                    
                                   
                                </div>
                            </div>
                            </div>
                        
                    </div>



    <!-- /.card-body -->
</div>
<!-- /.card -->

<!-- right col -->
</div>
<!-- /.row (main row) -->
</div><!-- /.container-fluid -->

<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php include('foot.php'); ?>

<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="../plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
    $.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ChartJS -->
<script src="../plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="../plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="../plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="../plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="../plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="../plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="../plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="../dist/js/pages/dashboard.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>


<!-- page script -->
<script>
    $(function () {
        $("#example1").DataTable({
            "responsive": true,
            "autoWidth": false,
        });
        $('#example2').DataTable({
            "paging": true,
            "lengthChange": false,
            "searching": false,
            "ordering": true,
            "info": true,
            "autoWidth": false,
            "responsive": true,
        });
    });
</script>
       <script type="text/javascript">
            $(function(){
                $("#username").keyup(function(){
            var v = $(this).val();
            
            $.ajax({
                type: 'get',
                url : 'js/username.php?val='+v
            }).done(function(data){
                
                if(data == 0){
                    $("#output").html('');
                }
                else if(data == 1){
                    $("#output").html('Username Does Not Exist');
                }
                else {
                    $("#output").html(data);
                }
            })
        })
            })
    </script>
</body>
</html>

?>