Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux nl-srv-web1396.main-hosting.eu 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User : u107206879 ( 107206879)
PHP Version : 7.2.34
Disable Function : NONE
Directory :  /home/u107206879/domains/annoncelights.dk/public_html/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/u107206879/domains/annoncelights.dk/public_html/admin/page_ads_links_add.php
<?php
$error = "";
$message = "";
include "db_connection.php";
include "sessioncheck.php";

if (!empty($_GET["ad_id"])) {
    if (!empty($_POST["Process"]) && trim($_POST["Process"]) == "AddNow") {
        if (!empty($_POST["message_outgoing_link"]) && count($_POST["message_outgoing_link"]) > 0) {
            $query = "delete from `page_ads_links` where ad_id='" . $_GET["ad_id"] . "'";
            $result = mysqli_query($connection, $query);

            foreach ($_POST["message_outgoing_link"] as $post_row_key => $post_row) {
                if (!empty($post_row)) {
                    $ad_id = test_input($_POST['ad_id']);
                    $ad_device = test_input($_POST['ad_device'][$post_row_key]);
                    $base = test_input($_POST['base'][$post_row_key]);
                    $message_outgoing_link = test_input($_POST['message_outgoing_link'][$post_row_key]);
                    $message_link_active = test_input($_POST['message_link_active'][$post_row_key]);
                    $type = test_input($_POST['type'][$post_row_key]);
                    #insert
                    $query = "INSERT INTO `page_ads_links` (`id`, `ad_id`, `message_outgoing_link`, `message_link_active`, `base`, `ad_device`, `type`) VALUES (NULL, '" . addslashes($ad_id) . "', '" . addslashes($message_outgoing_link) . "', '" . addslashes($message_link_active) . "', '" . addslashes($base) . "', '" . addslashes($ad_device) . "', '" . addslashes($type) . "')";
                    $result = mysqli_query($connection, $query);
                    $message = "Data addded successfully";
                } //if(!empty($post_row))		
            } //foreach($_POST["row_add"] as $post_row)	
            unset($_POST);
        }
    }
}

$base_array = array("Link", "Popup", "Popup-Message");
$ad_device_array = array("all", "desktop", "mobile", "tablet");
$type_array = array("Profile", "Message");

?>
<!-- Header Start-->
<?php include("header.php"); ?>
<nav class=" navbar navbar-expand navbar-white navbar-light">
    <ul class="navbar-nav">
        <li class="nav-item">
            <a class="nav-link" data-widget="pushmenu" href="#">
                <i class="fa fa-bars" style="color:white;"></i>
            </a>
        </li>
    </ul>
    <div>
        <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item ">Page Ads Links</li>
            <li class="breadcrumb-item">Manage</li>
        </ol>
    </div>
</nav>
<!-- Header Ends-->
<style>
    .tablet,
    .mobile,
    .desktop {
        display: none;
    }

    .all {
        display: block;
    }
</style>
<!-- Content Start-->

<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <!-- /.card-header -->
                    <div class="card-body">
                        <?php include_once 'notification.php'; ?>
                        <form action="" method="post" id="add-page_ads-link-form" enctype="multipart/form-data">
                            <div class="form-group">
                                <label for="file_name">Select Ad</label>
                                <?php $adQuery = mysqli_query($connection, "SELECT *  FROM advertise ORDER BY id DESC"); ?>
                                <select class="form-control input_border_radius input-sm" name="ad_id" id="ad_id" required onchange="change_url(this.value);">
                                    <option value="" <?= ($_GET['ad_id'] == "") ? 'selected' : '' ?>>Select</option>
                                    <option value="all" <?= ($_GET['ad_id'] == "all") ? 'selected' : '' ?>>All</option>
                                    <?php while ($adData = mysqli_fetch_assoc($adQuery)) {     ?>
                                        <option value="<?= $adData['id'] ?>" <?= ($_GET['ad_id'] == $adData['id']) ? 'selected' : '' ?>><?= $adData['id'] ?> - <?= $adData['profile_tile'] ?></option>
                                    <?php    }     ?>
                                </select>
                            </div>

                            <?php if (!empty($_GET["ad_id"])) {
                                #Check total entry for this ad_id
                                $shailTotal = mysqli_query($connection, "SELECT * FROM page_ads_links where ad_id='" . $_GET["ad_id"] . "' ORDER BY id DESC");
                                $rowcount = 0;
                                $rowcount = mysqli_num_rows($shailTotal);
                                $k = 1;
                                foreach ($ad_device_array as $key_ad_device => $val_ad_device) {
                                    $shailQuery = "";
                                    $shailQuery = mysqli_query($connection, "SELECT *  FROM page_ads_links where ad_id='" . $_GET["ad_id"] . "' and ad_device='" . $val_ad_device . "' ORDER BY id DESC limit 1");
                                    $shailData = mysqli_fetch_assoc($shailQuery);
                                    //echo "<pre>";print_r($shailData);
                            ?>

                                    <?php
                                    $display  = "block";
                                    if (!empty($shailData["id"])) {
                                        $display  = "block";
                                    } else {
                                        $display  = "none";
                                    }

                                    if ($rowcount == 0 && $val_ad_device == "all") {
                                        $display  = "block";
                                    }
                                    ?>



                                    <div class="row <?php echo $val_ad_device; ?>" <?php if (!empty($_GET["ad_id"])) { ?> style="display:<?= $display ?>" <?php } ?>>
                                        <div class="form-group form-check-inline">
                                            <input type="text" class="form-control" id="ad_device_<?= $k ?>" name="ad_device[]" value="<?php echo $val_ad_device; ?>" readonly="true" style="width:80px;">
                                        </div>
                                        <div class="form-group form-check-inline">
                                            <select class="form-control" title="Select Type" id="type_<?= $k ?>" name="type[]">
                                                <option value="Message" <?php if (!empty($shailData["type"]) && trim($shailData["type"]) == "Message") { ?> selected="selected" <?php } ?>> Message </option>
                                                <option value="Profile" <?php if (!empty($shailData["type"]) && trim($shailData["type"]) == "Profile") { ?> selected="selected" <?php } ?>> Profile </option>
                                            </select>
                                        </div>

                                        <div class="form-group form-check-inline">
                                            <select class="form-control" title="Base" id="base_<?= $k ?>" name="base[]">
                                                <option value="Link" <?php if (!empty($shailData["base"]) && trim($shailData["base"]) == "Link") { ?> selected="selected" <?php } ?>>Link</option>
                                                <option value="Popup" <?php if (!empty($shailData["base"]) && trim($shailData["base"]) == "Popup") { ?> selected="selected" <?php } ?>>Popup</option>
                                                <option value="Popup-Message" <?php if (!empty($shailData["base"]) && trim($shailData["base"]) == "Popup-Message") { ?> selected="selected" <?php } ?>>Popup-Message</option>
                                            </select>
                                        </div>
                                        <div class="form-group form-check-inline">
                                            <input type="text" class="form-control message_outgoing_link_<?php echo $val_ad_device; ?>" id="message_outgoing_link_<?= $k ?>" name="message_outgoing_link[]" placeholder="Link" value="<?php if (!empty($shailData["message_outgoing_link"])) {
                                                                                                                                                                                                                                            echo $shailData["message_outgoing_link"];
                                                                                                                                                                                                                                        } ?>">
                                        </div>
                                        <div class="form-group form-check-inline">
                                            <select class="form-control" title="Select Link Active" id="message_link_active_<?= $k ?>" name="message_link_active[]">
                                                <option value="1" <?php if (isset($shailData["message_link_active"]) && trim($shailData["message_link_active"]) == "1") { ?> selected="selected" <?php } ?>>Active </option>
                                                <option value="0" <?php if (isset($shailData["message_link_active"]) && trim($shailData["message_link_active"]) == "0") { ?> selected="selected" <?php } ?>>Inactive </option>
                                            </select>
                                        </div>



                                    </div>






                                <?php $k++;
                                } ?>
                                <div class="row">
                                    <div class="form-group form-check-inline">
                                        <button type="submit" class="btn btn-primary">Add Link</button>
                                        <input type="hidden" name="Process" id="Process" value="AddNow" />
                                    </div>

                                    <div class="form-group form-check-inline">
                                        <button type="button" class="btn btn-primary show_device" title="Click to show all device">Multi</button>
                                    </div>
                                </div>
                            <?php } ?>
                        </form>
                        <hr />


                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
        </div>
        <!-- /.row (main row) -->
    </div><!-- /.container-fluid -->
</section>
<!-- Content Ends-->
<script type="text/javascript">
    function change_url(val) {
        window.location = "<?php echo MAIN_URL ?>/admin/page_ads_links_add?ad_id=" + val;
    }

    $(document.body).on('click', '.delete_page_ads_links', function(e) {
        if (confirm("Are you sure!") == true) {} else {
            return false;
        }
        var crud = 'delete';
        var val = $(this).data("id");
        //alert(val);return false;
        $.ajax({
            url: 'service/delete_page_ads_links',
            type: 'post',
            data: {
                crud: crud,
                value: val
            },
            success: function(data) {
                if (data == '1') {
                    $(".modal-backdrop").remove();
                    $('#delete_page_ads_links_' + val).closest("tr").remove();
                    //window.location.href = window.location.href;	
                }
            }
        });
        $('.btn-confirm-delete').unbind();
    });
    /*$(document.body).on('click', '.delete_user', function(e){
    	$(".btn-confirm-delete").attr("data-id",$(this).data('id'));
    	$('.delete_user').unbind();
    });*/

    //.tablet, .mobile, .desktop	
    $(document.body).on('click', '.show_device', function(e) {
        $('.all').toggle();
        $('.tablet').toggle();
        $('.mobile').toggle();
        $('.desktop').toggle();
    });

    $('#add-page_ads-link-form').submit(function() {
        if ($('.all').css('display') == 'none') {
            $(".message_outgoing_link_all").val("");
        }
        if ($('.tablet').css('display') == 'none') {
            $(".message_outgoing_link_tablet").val("");
        }
        if ($('.mobile').css('display') == 'none') {
            $(".message_outgoing_link_mobile").val("");
        }
        if ($('.desktop').css('display') == 'none') {
            $(".message_outgoing_link_desktop").val("");
        }
        return true;
    });
</script>
<!-- Footer Start-->
<?php include("footer.php"); ?>
<!-- Footer Ends-->

Al-HUWAITI Shell