JezK
Edit File: user_status_btn.php
<?php include_once '../databaseConn.php'; include_once './lib/requestHandler.php'; $DatabaseCo = new DatabaseConn(); include_once '../class/Config.class.php'; $configObj = new Config(); if(isset($_REQUEST['page_name']) && $_REQUEST['page_name']=='manage-staff') { $page_name=$_REQUEST['page_name']; $_SESSION['page_name']=$page_name; } if(isset($_POST['status'])) { $member_status=$_POST['status']; $_SESSION['memstatus']=$member_status; } elseif(!isset($_SESSION['memstatus'])){ $member_status=''; } else { $member_status=$_SESSION['memstatus']; } if($member_status!='' && $member_status!='Featured') { $a = "where status='".$member_status."'"; } else if($member_status!='' && $member_status=='Featured') { $a = "where fstatus='".$member_status."'"; } else { $a=''; } if(isset($_SESSION['search_gender'])) { if($_SESSION['search_gender']!='' && $_SESSION['search_gender']!='no-gender') { $b="and gender='".$_SESSION['search_gender']."'"; } else if($_SESSION['search_gender']!='' && $_SESSION['search_gender']=='no-gender') { $b="and gender is NULL "; } else { $b=""; } } else { $b=""; } if(isset($_SESSION['search_keyword'])) { if($_SESSION['search_keyword']!='') { $c="and ((email like '%".$_SESSION['search_keyword']."%') OR (matri_id = '".$_SESSION['search_keyword']."') OR (firstname like '%".$_SESSION['search_keyword']."%') OR (lastname like '%".$_SESSION['search_keyword']."%'))"; } } else { $c=""; } if(isset($_SESSION['search_country'])) { if($_SESSION['search_country']!='') { $d="and country_id='".$_SESSION['search_country']."'"; } } else { $d=""; } if(isset($_SESSION['search_state'])) { if($_SESSION['search_state']!='') { $e="and state_id='".$_SESSION['search_state']."'"; } } else { $e=""; } if(isset($_SESSION['search_city'])) { if($_SESSION['search_city']!='') { $f="and city='".$_SESSION['search_city']."'"; } } else { $f=""; } if(isset($_SESSION['search_religion'])) { if($_SESSION['search_religion']!='' && $_SESSION['search_religion']!=36) { $g="and religion='".$_SESSION['search_religion']."'"; } else if($_SESSION['search_religion']!='' && $_SESSION['search_religion']==36) { $g="and (religion!='' or religion='' or religion='Null')"; } } else { $g=""; } if(isset($_SESSION['search_caste'])) { if($_SESSION['search_caste']!='') { $h="and caste='".$_SESSION['search_caste']."'"; } } else { $h=""; } if(isset($_POST['type']) && $_POST['type'] == 'franchise') { $franchise = "and `franchised_by` IS NOT NULL"; } else { $franchise=""; } if(isset($_POST['type']) && $_POST['type'] == 'online') { $franchise = "and `franchised_by` IS NULL"; } else { $franchise=""; } if(isset($_POST['type']) && $_POST['type'] == 'latestreg') { $latestreg = "and reg_date > DATE_SUB(CURDATE(), INTERVAL 1 WEEK)"; } else { $latestreg=""; } if($b!='' || $c!='' || $d!='' || $e!='' || $f!='' || $g!='' || $h!=''){ $get_active=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where status='Active' $b $c $d $e $f $g $h $franchise $latestreg")); $get_inactive=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where status='Inactive' $b $c $d $e $f $g $h $franchise $latestreg")); $get_paid=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where payment_status='1' $b $c $d $e $f $g $h $franchise $latestreg")); $get_featured=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where fstatus='Featured' $b $c $d $e $f $g $h $franchise $latestreg")); $get_suspended=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where status='Suspended' $b $c $d $e $f $g $h $franchise $latestreg")); //echo "select index_id from register_view where 1=1 $b $c $d $e $f $g $h $franchise $latestreg";exit; $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where 1=1 $b $c $d $e $f $g $h $franchise $latestreg")); } /*if($b!='' || $c!='' || $d!='' || $e!='' || $f!='' || $g!='' || $h!='' && isset($_SESSION['page_name']) && $_SESSION['page_name']!='manage-staff'){ $today1 = strtotime ('now'); $today=date("Y-m-d",$today1); $days = 30; //number of days in the coming $past_stamp = time() + $days*24*60*60; $monthdate = date('Y-m-d h:i:s', $past_stamp); $get_active=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Active' $b $c $d $e $f $g $h or r.matri_id=p.pmatri_id and status='Active' $b $c $d $e $f $g $h")); $get_inactive=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Inactive' $b $c $d $e $f $g $h or r.matri_id=p.pmatri_id and status='Inactive' $b $c $d $e $f $g $h")); $get_paid=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Paid' $b $c $d $e $f $g $h or r.matri_id=p.pmatri_id and and status='Paid' $b $c $d $e $f $g $h")); $get_featured=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and fstatus='Featured' $b $c $d $e $f $g $h or r.matri_id=p.pmatri_id and fstatus='Featured' $b $c $d $e $f $g $h ")); $get_suspended=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Suspended' $b $c $d $e $f $g $h or r.matri_id=p.pmatri_id and status='Suspended' $b $c $d $e $f $g $h ")); $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and 1=1 $b $c $d $e $f $g $h or r.matri_id=p.pmatri_id and 1=1 $b $c $d $e $f $g $h")); }*/ else if(isset($_SESSION['page_name']) && $_SESSION['page_name']=='manage-staff') { $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select role_id from franchise_role ")); $get_active=mysqli_num_rows($DatabaseCo->dbLink->query("select role_id from franchise_role where status='APPROVED' ")); $get_inactive=mysqli_num_rows($DatabaseCo->dbLink->query("select role_id from franchise_role where status='UNAPPROVED' ")); } /*else if(isset($_SESSION['page_name']) && $_SESSION['page_name']!='manage-staff') { $today1 = strtotime ('now'); $today=date("Y-m-d",$today1); $days = 30; //number of days in the coming $past_stamp = time() + $days*24*60*60; $monthdate = date('Y-m-d h:i:s', $past_stamp); $get_active=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Active' or r.matri_id=p.pmatri_id and status='Active'")); $get_inactive=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Inactive' or r.matri_id=p.pmatri_id and status='Inactive'")); $get_paid=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Paid' or r.matri_id=p.pmatri_id and status='Paid'")); $get_featured=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and fstatus='Featured' or r.matri_id=p.pmatri_id and fstatus='Featured'")); $get_suspended=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' and status='Suspended' or r.matri_id=p.pmatri_id and status='Suspended'")); $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view r,payments p where r.matri_id=p.pmatri_id and p.exp_date<'$today' or r.matri_id=p.pmatri_id ")); } */else { $get_active=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where status='Active' $franchise $latestreg")); $get_inactive=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where status='Inactive' $franchise $latestreg")); $get_paid=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where payment_status='1' $franchise $latestreg")); $get_featured=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where fstatus='Featured' $franchise $latestreg")); $get_suspended=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where status='Suspended' $franchise $latestreg")); if(isset($_POST['type']) && $_POST['type'] == 'franchise') { $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where `franchised_by` IS NOT NULL $latestreg")); } else if(isset($_POST['type']) && $_POST['type'] == 'online') { $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where `franchised_by` IS NULL $latestreg")); } else if(isset($_POST['type']) && $_POST['type'] == 'latestreg') { $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view where `franchised_by` IS NULL $latestreg")); } else { $get_all=mysqli_num_rows($DatabaseCo->dbLink->query("select index_id from register_view")); } // exit; } ?> <ul class="nav nav-tabs neAdminMemTab clearfix"> <?php if(isset($_SESSION['page_name']) && $_SESSION['page_name']=='manage-staff') { ?> <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-success btn-flat col-xs-12" onClick="memstatus('All');" id="All"> All <span class="text-white">(<?php echo $get_all; ?>)</span> </a> </li> <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-info btn-flat col-xs-12" onClick="memstatus('APPROVED');" id="active"> Approved <span class="text-black">(<?php echo $get_active; ?>)</span> </a> </li> <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-info btn-flat col-xs-12" onClick="memstatus('UNAPPROVED');" id="Inactive"> Unapproved <span class="text-black">(<?php echo $get_inactive; ?>)</span> </a> </li> <?php } else { ?> <!-- <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-success btn-flat col-xs-12" onClick="memstatus('Active');" id="Active"> Active <span class="text-white">(<?php // echo $get_active; ?>)</span> </a> </li> --> <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-info btn-flat col-xs-12" onClick="memstatus('Paid');" id="Paid"> Paid <span class="text-black">(<?php echo $get_paid; ?>)</span> </a> </li> <!-- <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-info btn-flat col-xs-12" onClick="memstatus('Featured');" id="Featured"> Featured <span class="text-black">(<?php echo $get_featured; ?>)</span> </a> </li> --> <!-- <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-info btn-flat col-xs-12" onClick="memstatus('Inactive');" id="Inactive"> Inactive <span class="text-black">(<?php echo $get_inactive; ?>)</span> </a> </li>--> <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-danger btn-flat col-xs-12" onClick="memstatus('Suspended');" id="Suspended"> Blocked <span class="text-black">(<?php echo $get_suspended; ?>)</span> </a> </li> <li class="col-lg-2 col-xs-12 col-md-4"> <a class="btn btn-success btn-flat col-xs-12" onClick="memstatus('All');" id="All"> All <span class="text-white">(<?php echo $get_all; ?>)</span> </a> </li> <?php } ?> </ul>