GIF89a php
Current File : /home/viralhoga/public_html/adminpanel/new-regis.php
<?php 
	error_reporting(0);
	include("include/admin-main.php"); 
    include("include/header.php");
	$obj=new admin();
	
//search by date
if(isset($_GET['from_date']) && isset($_GET['to_date']) && !empty($_GET['to_date'])){
   $fromDate= strtotime($_GET['from_date']. ' 00:00:00');
   $toDate= strtotime($_GET['to_date']. ' 23:59:59');
   $condition=" AND currentDate>='$fromDate' AND currentDate<='$toDate'";
}elseif(isset($_GET['from_date']) && empty($_GET['to_date'])){
  $fromDate= strtotime($_GET['from_date']); 
  $condition=" AND currentDate='$fromDate'";
}else{
  $condition = '';  
}
	
	
	
	$limit = 500;  
    if (isset($_GET["page"])){
    $page  = $_GET["page"]; 
     } else{ 
    $page=1;
    };
    
    $start_from = ($page-1) * $limit;
    $limitBy = " LIMIT $start_from, $limit";
    
    $_SESSION['cond'] = "WHERE reg_id NOT IN (SELECT reg_id FROM `cart` WHERE paysts!='Success') $condition order by uid DESC $limitBy ";
    
    //echo $_SESSION['cond'];
  
    $reg_details=$obj->select_objData("register","WHERE reg_id NOT IN (SELECT reg_id FROM `cart` WHERE paysts!='Success') $condition order by uid DESC $limitBy");
	
   /* this code is used for inactive */
 if($_REQUEST['action']=='Inactive'){
    if(mysqli_query($con,"update register set status='Inactive' where uid=".$_REQUEST['uid'])){
	?>
<script>
	alert("Registration deactive  successfully");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		 window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}
 /* this code is used for active */
if($_REQUEST['action']=='Active'){
    if(mysqli_query($con,"update register set status='Active' where uid=".$_REQUEST['uid'])){
	?>
<script>
	alert("Registration active successfully");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		 window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="shortcut icon" href="img/favicon.png">
	<title><?php include("include/title.php")?> | New Registration Details</title>
	<!-- Bootstrap core CSS -->
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/bootstrap-reset.css" rel="stylesheet">
	<!--external css-->
	<link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
	<!-- Custom styles for this template -->
	<link href="css/style.css" rel="stylesheet">
	<link href="css/style-responsive.css" rel="stylesheet" />
    <!-- DataTables CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap5.min.css">
    <!-- DataTables Buttons CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.1/css/buttons.bootstrap5.min.css">
	<style>
	div.dt-buttons {
    border: 1px solid black !important;
}
	</style>
</head>
<body>
	<?php include 'popup.php';?>
<!--header end-->
<!--sidebar start-->
<?php  include 'menu.php' ?>
<!--sidebar end-->
	<section id="main-content">
		<section class="wrapper">
		   <h2>New Registration Details</h2> 
		   <div class="dt-buttons btn-group flex-wrap">
		       <a href="export-new-registration.php" class="btn btn-secondary buttons-excel buttons-html5" tabindex="0" aria-controls="example" type="button"><span>Export to Excel</span></a>
		   </div>
		   
<div class="form-group">
 <form method="get" action="new-regis.php">
  <input type="date" name="from_date" style="width:30%;display: inline;" placeholder="From" class="form-control" autocomplete="off" onClick="scwShow(this,event)">
  <input type="date" name="to_date" style="width:30%;display: inline;" placeholder="To" class="form-control" autocomplete="off" onClick="scwShow(this,event)">
  <input type="submit" name="search_history" style="display: inline;" value="Search" class="btn btn-success" style="margin-top:20px">
 </form>
 </div>
		   
	<div class="row">
    <div class="col-lg-12">
        <table class="table table-striped">
            <thead>
                <tr>
                <th>Seq. No</th>
                <th>Name</th>
                <th>Email / Phone</th>
                <th>Password</th>
                <th style="display:none">Sponsor Code</th>
                <th style="display:none">Address</th>
                <th>Date</th>
                <th>Action</th>
              </tr>
            </thead>
            <tbody>
              <?php $a=1;
                while($row = mysqli_fetch_array($reg_details)){
                  @extract($row); 
              ?>
              <tr>
                <td><?php echo $a; ?></td>
                <td><?php echo $cfname;?><br>
                  ( <b><?php echo $reg_id;?></b> )</td>
                <td><?php echo $cemail."<br>".$ctel;?></td>
                <td><?php echo $cpassword;?></td>
                <td style="display:none"><?php echo $alternateno;?></td>
                <td style="display:none"><i><?php echo $cadd1;?> , <?php echo $cstate;?> , <?php echo $ccity;?> - <?php echo $cpincode;?></i></td>
                <td><?php echo date('d-m-Y  H:i:s',$currentDate)?></td>
                <td>
                  <a href="order-details.php?sid=<?php echo $reg_id?>" title="View order">
                    <button class="btn btn-danger btn-xs" style="padding: 1px 6px;"><i class="icon-user"></i></button>
                  </a>
                  <?php if($status=='Active'){?>
                  <a href="<?php echo $_SESSION['PHP_SELF'];?>?action=Inactive&uid=<?php echo $uid; ?>" title="Active">
                    <button class="btn btn-danger btn-xs" onclick='return changeSts()'><i class="icon-ok"></i></button>
                  </a>
                  <?php } else{?>
                  <a href="<?php echo $_SESSION['PHP_SELF'];?>?action=Active&uid=<?php echo $uid?>" title="Inactive">
                    <button class="btn btn-danger btn-xs" onclick='return changeSts()' style="padding: 1px 6px;"><i class="icon-remove"></i></button>
                  </a>
                  <?php }?>
                  <a href="editprofile.php?regId=<?php echo $reg_id;?>" title="Update Profile">
                    <button class="btn btn-danger btn-xs" style="padding: 1px 6px;"><i class="icon-edit"></i></button>
                  </a> 
                </td>
              </tr>
              <?php  $a++; } ?>
            </tbody>
        </table>
        
        <?php
		if(!empty($limitBy)){  
		$result_db = mysqli_query($con,"SELECT COUNT(uid) FROM `register`");
		$row_db = mysqli_fetch_row($result_db);
        $total_records = $row_db[0];
		if($total_records>9){
            $total_pages = ceil($total_records / $limit);
		    $pagLink = "<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
            <div class='pager_wrapper'>
            <ul class='pagination'>";
			if(!isset($_GET['page']) && empty($_GET['page']))$bgcolor="background: linear-gradient(to bottom, #F9D95E 50%, #B09754";
			for ($i=1; $i<=$total_pages; $i++){
				if(isset($_GET['page']) && !empty($_GET['page']) && $_GET['page']==$i)$bgcolor="background: linear-gradient(to bottom, #F9D95E 50%, #B09754";else if($i==1 && $_GET['page']==1)$bgcolor="background: linear-gradient(to bottom, #F9D95E 50%, #B09754";else $bgcolor='';
              $pagLink .= "<li class='btc_shop_pagi'><a style='$bgcolor' href='new-regis.php?page=".$i."'>".$i."</a></li>";	
            }
			$pagLink .="</ul></div>
              </div>";
	      echo $pagLink;
	   }
	  }
	  ?>
    </div>
	  </div>
		</section>
	 </section>

    <!-- jQuery -->
    <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <!-- DataTables JS -->
    <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.5/js/dataTables.bootstrap5.min.js"></script>
    <!-- DataTables Buttons JS -->
    <script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.bootstrap5.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>

    <script>
    $(document).ready(function() {
        $('#example').DataTable({
            dom: 'lBfrtip', // 'l' includes the length changing input control
            buttons: [
                {
                    text: 'Export to Excel',
                    extend: 'excelHtml5',
                    exportOptions: {
                        modifier: {
                            page: 'current' // Export only the visible data
                        }
                    }
                }
            ],
            lengthMenu: [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
            pageLength: 10 // Default number of rows to display
        });
    });
</script>
</body>
</html>