<?php 
$sql="SELECT * FROM j_slides WHERE 
j_deleted < 1 AND j_status > 0 AND j_category='Basic Ad'
|| j_deleted < 1 AND j_status > 0 AND j_category='All Pages Right Side Ad'
order by rand() limit 1";
$result = runSQL($sql);
$sum = mysqli_num_rows($result);
if($sum>0){ 
while($row =mysqli_fetch_array($result)){
if(!empty($row['j_img'])){
    //$image = "background-image: url('".$dir."j_files/j_img/categories/".$row['j_img']."');";
    $image = "".$dir."j_files/j_img/ads/".$row['j_img']."";
    $text = $row['j_title'];
    $link = $row['j_link'];
}else{
    $image = '';
}
?>
<div class="card" style="border:0px; padding:0px;">
        <?php 
        /*
        //text ads
        <div class="container">
            <div class="row">
                 <div class="col-md-12" style="text-align:center;">
                    <!--
                    <div class="avatar avatar-image avatar-lg avatar-green">
                        <i class="fas fa-music"></i>
                     </div>
                    -->
                     <div class="avatar avatar-image  m-h-10 m-r-15">
                        <img src="<?php echo $dir; ?>j_files/j_img/logo/logo.png" alt="Logo">
                    </div>
                     <h4 class="text-center"><?php echo strtoupper($company); ?></h4>
                     <p class="text-center"><?php echo $company_motto; ?></p>
                     <p class="text-center"><?php echo $company_desc; ?></p>
                      <p class="text-center">
                         <a class="btn btn-primary btn-md" href="<?php echo $dir; ?>send-money/"> Send Money</a>
                     </p>

                 </div>
            </div>
        </div>
        */
        ?>
        
        <div class="dc-widget dc-onlineoptions">
            <?php $rand = rand(1,8); ?>
            <figure class="dc-onlinuserimg">
                <?php if(!empty($row['j_img'])){ ?> <img src="<?php echo $image; ?>"> <?php } ?>
                <figcaption><span>Ad</span></figcaption>
            </figure>
            <div class="dc-onlineoption-content">
                <div class="dc-title">
                    <?php if(!empty($row['j_title'])){ ?><span><?php echo $text; ?></span> <?php } ?>
                    <br/> <br/>
                    <?php if(!empty($row['j_link'])){ ?><a target="_blank" class="btn btn-primary btn-md" style="" href="<?php echo $link; ?>">Learn More</a>  <?php } ?>
                </div>
            </div>
        </div>

</div>
<?php } ?>
<?php } ?>







<div class="card" style="border:0px; padding:0px;">
        <?php 
        /*
        //text ads
        <div class="container">
            <div class="row">
                 <div class="col-md-12" style="text-align:center;">
                    <!--
                    <div class="avatar avatar-image avatar-lg avatar-green">
                        <i class="fas fa-music"></i>
                     </div>
                    -->
                     <div class="avatar avatar-image  m-h-10 m-r-15">
                        <img src="<?php echo $dir; ?>j_files/j_img/logo/logo.png" alt="Logo">
                    </div>
                     <h4 class="text-center"><?php echo strtoupper($company); ?></h4>
                     <p class="text-center"><?php echo $company_motto; ?></p>
                     <p class="text-center"><?php echo $company_desc; ?></p>
                      <p class="text-center">
                         <a class="btn btn-primary btn-md" href="<?php echo $dir; ?>send-money/"> Send Money</a>
                     </p>

                 </div>
            </div>
        </div>
        */
        ?>
        <?php $num2 = rand(1,2); ?>
        <div class="dc-widget dc-onlineoptions">
            <?php $rand = rand(1,8); ?>
            <figure class="dc-onlinuserimg">
                 <img src="<?php echo $dir; ?>j_files/j_img/slides/3.png"> 
                <figcaption><span><?php //Ad  ?> </span></figcaption>
            </figure>
			
            <div class="dc-onlineoption-content" style="padding: 10px 20px;">
                <div class="dc-title">
                    <span>Users are signing up everyday.</span>
                    <div style="margin-top:10px;"></div>
                    <a class="btn btn-primary w-100 btn-md" style="" href="<?php echo $dir; ?>users/">MANAGE USERS</a>
                </div>
            </div>
			
			
        </div>

</div>



<div class="card">
    <div class="card-body">
        <div class="d-flex justify-content-between align-items-center">
            <h5 class="mb-0">Recently Joined</h5>
            <?php 
            /*
            <div>
                <a href="" class="btn btn-default btn-sm">View All</a> 
            </div>
            */
            ?>
        </div>
        <div class="m-t-30">
            <div class="avatar-string m-l-5">
                <?php 
                //if(isset($_SESSION['j_admin'])){
                $sql4="SELECT * from j_users WHERE j_firstname !='' AND j_status !=1 AND j_deleted < 1 order by j_id desc limit 14"; //check 
                //}else{
                //$sql4="SELECT * from j_musics WHERE j_deleted < 1 order by j_id desc limit 5"; //check 
                //}
                $result4 = runSQL($sql4);
                while($row = mysqli_fetch_array($result4)){
                ?>
                <a href="javascript:void()" data-toggle="tooltip" title="<?php echo $row['j_firstname']; ?>">
                    <div class="avatar avatar-text" style="background-color: #AF1C2A;">
                        <span style="color: #fff;"><?php echo substr($row['j_firstname'],0,1); ?></span>
                    </div>
                    <?php 
                    /*
                    <div class="avatar avatar-image team-member">
                        <?php if(!empty($row['j_passport'])){ ?>
                        <img src="<?php echo $dir; ?>j_files/j_img/users/passport/<?php echo $row['j_passport']; ?>" alt="">
                        <?php }else{ ?>
                        <img src="<?php echo $dir; ?>j_files/j_img/logo/logo.png" alt="">
                        <?php } ?>
                    </div>
                    */
                    ?>
                </a>
                <?php } ?>

                <?php 
                /*
                <a href="javascript:void(0);" data-toggle="tooltip" title="Invite Others">
                    <div class="avatar avatar-icon avatar-blue team-member">
                        <i class="anticon anticon-plus font-size-22"></i>
                    </div>
                </a>
                */
                ?>

            </div>
        </div>
    </div>
</div>




<?php 
/*
<div class="card">
    <div class="card-body">
        <div class="d-flex justify-content-between align-items-center">
            <h5 class="mb-0"> Happenings </h5>
            <?php 
            /*
            <div>
                <a href="" class="btn btn-default btn-sm">View All</a> 
            </div>
            */
            ?>

<?php
/*
        </div>
        <marquee behavior="scroll" direction="up" scrolldelay="300">

        <?php 
         $sql4="SELECT * from j_notifications WHERE j_deleted < 1 order by j_id desc limit 40"; //check 
        $result4 = runSQL($sql4);
        while($row = mysqli_fetch_array($result4)){
        ?>

        <div class="m-t-30">
            <div class="d-flex m-b-20">
                <div class="text-center">
                    <div class="avatar avatar-text avatar-blue avatar-lg rounded">
                        <span class="font-size-22"><i class="anticon anticon-bell"></i></span>
                    </div>
                </div>
                <div class="m-l-20">
                    <h5 class="m-b-0">
                        <a class="text-dark"><?php echo $row['j_subject']; ?></a>
                    </h5>
                    <p class="m-b-0"><?php echo time_ago($row['j_date']); ?></p>
                </div>
            </div>

        </div> 
        <?php } ?>
        </marquee>
    </div>
</div>
*/
?>
                                