<?php
include("./include/config.php");

if (!isset($_SESSION['a_user'])) {
    header("Location: index.php");
} else {
    include("./include/sidebar.php");
    if(isset($_GET['id']) && !empty($_GET['id'])){
    ?>
    <div class="col-xs-12">
        <a href="cut-lead-view.php?id=<?php echo $_GET['id']; ?>&l=<?php echo $_GET['l']; ?>" class="btn waves-effect waves-light btn-primary btn-xs margin-bottom-10">Back</a>
        <div class="box-content">
            <h4 class="box-title"><?php echo $_SESSION['name']; ?></h4>
            <div class="table-responsive">
                <table class="table ">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>time</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $i = 0;
                        $sql = "SELECT * FROM `log` where `cus_id` = {$_GET['id']}";
                        $sql_res = mysqli_query($conn, $sql);


                        while ($row = mysqli_fetch_assoc($sql_res)) {
                            ?>
                            <tr>
                                <th scope="row">
                                    <?php echo $i = $i + 1 ?>
                                </th>
                                <td>
                                    <?php echo $row['log'] ?>
                                </td>
                            </tr>
                            <?php
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

<?php
    }else{
        echo "<script>alert('Not Found id');
        window.location.href = 'dashboard.php';</script>";
    }



}
include("./include/footer.php");
?>