<?php
session_start();
include "admin/php/functions.php";
if(!isset($_SESSION['member'])){
    header("location:membership-authentication.php");
    exit();
}
$code = $_SESSION['member'];
?>
<!doctype html>
<html class="no-js" lang="en">
<head>
    <title>نتایج جستجوی اعضا</title>
    <?php include "head.php"; ?>
</head>
<body>

<!-- Wrapper -->
<div class="wrap push">

    <!-- Header -->
    <header class="header style-3">
        <?php include "menu.php"; ?>
    </header>
    <!-- Header -->

    <!-- Page Heading & Breadcrumbs  -->
    <div class="page-heading-breadcrumbs">
        <div class="container">
            <h2>نتایج جستجوی اعضا</h2>
            <ul class="breadcrumbs hidden-sm hidden-xs">
                <li><a href="index.php">خانه</a></li>
                <li>نتایج جستجوی اعضا</li>
            </ul>
        </div>
    </div>
    <!-- Page Heading & Breadcrumbs  -->

    <!-- Main Content -->
    <main class="main-content">

        <!-- Gallery Views -->
        <div class="theme-padding white-bg" style="padding: 50px 0">
            <div class="container">
                <?php
                $select = $connect -> prepare("select * from `tbl_user` where `delete_flag` = 0 and `national_code` = ".$code);
                $select -> execute();
                if($select -> rowCount() > 0){
                ?>
                <div class="table-responsive text-right" dir="rtl" style="border: 1px solid #ccc; border-radius: 10px; padding: 10px;">
                    <table class="table table-striped m-0">
                        <thead>
                        <tr>
                            <th>ردیف</th>
                            <th>نام و نام خانوادگی</th>
                            <th>کد ملی</th>
                            <th>نام پدر</th>
                            <th>تاریخ تولد</th>
                            <th>شماره تماس</th>
                            <th>استان</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
                        $count=0;
                        while ($rows = $select -> fetch(PDO::FETCH_ASSOC)){
                            $count++;

                            $province = $connect -> prepare("select * from `tbl_province_cities` where `id` = ".$rows['stay_province']);
                            $province -> execute();
                            $provinceRow = $province -> fetch(PDO::FETCH_ASSOC);
                        ?>
                        <tr>
                            <td><?php echo $count; ?></td>
                            <td><?php echo $rows['fname_fa']." ".$rows['lname_fa']; ?></td>
                            <td><?php echo $rows['national_code']; ?></td>
                            <td><?php echo $rows['father_name']; ?></td>
                            <td><?php echo $rows['birth_date']; ?></td>
                            <td><?php echo $rows['phone']; ?></td>
                            <td><?php echo $provinceRow['title']; ?></td>
                        </tr>
                        <?php
                        }
                        ?>
                        </tbody>
                    </table>
                </div>
                <?php
                }
                ?>
            </div>
        </div>
        <!-- Gallery Views -->

    </main>
    <!-- Main Content -->

    <!-- Footer -->
    <footer class="main-footer style-2">
        <?php include "footer.php"; ?>
    </footer>
    <!-- Footer -->

</div>
<!-- Wrapper -->

<!-- Java Script -->
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="js/gmap3.min.js"></script>
<script src="js/bigslide.js"></script>
<script src="js/slick.js"></script>
<script src="js/waterwheelCarousel.js"></script>
<script src="js/contact-form.js"></script>
<script src="js/countTo.js"></script>
<script src="js/datepicker.js"></script>
<script src="js/rating-star.js"></script>
<script src="js/range-slider.js"></script>
<script src="js/spinner.js"></script>
<script src="js/parallax.js"></script>
<script src="js/countdown.js"></script>
<script src="js/appear.js"></script>
<script src="js/prettyPhoto.js"></script>
<script src="js/wow-min.js"></script>
<script src="js/main.js"></script>
<script src="js/custom.js"></script>

</body>
</html>
<?php
unset($_SESSION['member']);
?>