<?php  session_start(); error_reporting(0); 
//if session
if(isset($_SESSION['j_admin'])){ }else{ 
    die(
    "
    <div class='alert alert-danger'> Error 100. Try again.</div>
    "
    );
}
require_once("../j_conn/url.php");
require_once("../j_conn/dbc.php");
require_once("../j_incs/functions.php");
if(isset($_POST['search'])){ }else{ 
die(
"
<div class='alert alert-danger'> Error 101. Try again.</div>
"
);
}
//exec('sox /mypath/my_audio.amr /mypath/my_audio.mp3');
$name_old = $name;
$phone_old = $phone;
$email_old = $email;
$username_old = $username;
//
$search = RMC($_POST["search"]);  
if(!empty($search) 
 ){ //check if required field is not empty
}else{ die("<div class='alert alert-danger'> Enter Search.</div>");}  
//search now
if(isset($_SESSION['j_admin'])){
$sql4="SELECT * from j_users WHERE 
j_referrer_id='".$id."' AND j_deleted < 1  AND j_referrer_id LIKE'%".$search."%'
|| j_referrer_id='".$id."' AND j_deleted < 1   AND j_username LIKE'%".$search."%'
|| j_referrer_id='".$id."' AND j_deleted < 1   AND j_firstname LIKE'%".$search."%'
|| j_referrer_id='".$id."' AND j_deleted < 1   AND j_lastname LIKE'%".$search."%'
|| j_referrer_id='".$id."' AND j_deleted < 1   AND j_date LIKE'%".$search."%'
order by j_id desc limit 50"; //check 
}
$result4 = runSQL($sql4);
$count = mysqli_num_rows($result4);
if($count<1){
    die("<div class='alert alert-danger'> No record found. Try another search.</div>
    <script> $('[name=search]').css({'border-color': 'brown', 'border-width':'1px', 'border-style':'solid'});</script>
    ");
}
echo ("<script> $('[name=search]').css({'border-color': '#efefef', 'border-width':'1px', 'border-style':'solid'});</script>");
?>

<div>
<?php
while ($row = mysqli_fetch_array($result4)){
?>
<div class="t_box" title="<?php echo $row['j_firstname']; ?> <?php echo $row['j_lastname']; ?>">
   <div class="date">
       <?php echo $row['j_username']; ?>
    </div>
    <div class="amount">
        <i class="anticon anticon-clock-circle"></i> <?php echo time_ago($row['j_date']); ?> 
    </div>
    <div class="desc">
        <?php echo $row['j_firstname']; ?> <?php echo $row['j_lastname']; ?>
    </div>
</div>
<?php } ?>
</div>
