Mini Shell

Direktori : /home/haworld/public_html/admin/
Upload File :
Current File : //home/haworld/public_html/admin/query.php

<!DOCTYPE html>
<html lang="en">


<head>
    <?php include('include/head_admin.php');
    $page_id = '21';

    if (isset($_GET['type']) && $_GET['type'] != '') {
        $type = get_safe_value($con, $_GET['type']);
        if ($type == 'status') {
            $operation = get_safe_value($con, $_GET['operation']);
            $id = get_safe_value($con, $_GET['id']);
            if ($operation == 'active') {
                $status = '1';
            } else {
                $status = '0';
            }
            $update_status_sql = "update contact set status='$status' where id='$id'";
            mysqli_query($con, $update_status_sql);
        }

        if ($type == 'delete') {
            $id = get_safe_value($con, $_GET['id']);

            // Step 2: Delete record from the database
            $delete_sql = "DELETE FROM contact WHERE id='$id'";
            mysqli_query($con, $delete_sql);
        }
    }

    $sql = "select * from contact order by id desc";
    $res = mysqli_query($con, $sql);
    ?>
</head>

<body>
    <!--== MAIN CONTRAINER ==-->
    <?php include('include/header_admin.php'); ?>

    <!--== BODY CONTNAINER ==-->
    <div class="container-fluid sb2">
        <div class="row">

            <?php include('include/sidebar_admin.php'); ?>

            <div class="sb2-2">
                <div class="sb2-2-2">
                    <ul>
                        <li><a href="index.php"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
                        </li>
                        <li class="active-bre"><a href="contact-all.php"> Contact</a>
                        </li>
                    </ul>
                </div>
                <div class="sb2-2-1">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Date</th>
                                <th>Name</th>
                                <th>Phone</th>
                                <th>Email</th>
                                <th>Subject</th>
                                <th>Message</th>
                                <!-- <th>Edit</th> -->
                                <th>Delete</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $i = 1;
                            while ($row = mysqli_fetch_assoc($res)) { ?>
                                <tr>
                                    <td><?php echo $i++ ?></td>
                                    <td><?php echo $row['createdAt']; ?></td>
                                    <td><?php echo $row['name']; ?></td>
                                    <td><?php echo $row['phone']; ?></td>
                                    <td><?php echo $row['email']; ?></td>
                                    <td><?php echo $row['subject']; ?></td>
                                    <td><?php echo $row['message']; ?></td>

                                    <!-- <td><a href="contact-edit.php?id=<?php echo $row['id']; ?>" class="sb2-2-1-edit"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
                                    </td> -->
                                    <td><a href="?type=delete&id=<?php echo $row['id'] ?>" class="sb2-2-1-edit"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
                                    </td>
                                </tr>
                            <?php } ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <?php include('include/footer_admin.php'); ?>

    <?php include('include/foot_admin.php'); ?>

</body>


</html>