HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/nclive/technc/seo_contentlist.php
<?php include 'header.php'; ?>

<script type="text/javascript" charset="utf8" src="assets/js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="assets/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="assets/css/jquery.dataTables.min.css">

<main id="main-container">
    <div class="content content-narrow">
 
        <?php
            if(isset($_REQUEST['submit'])){
                $id = $_REQUEST['id'];
                $exam_name = $_REQUEST['exam_name'];
                $category  = $_REQUEST['category'];
                $title     = $_REQUEST['title'];
                $keywords  = $_REQUEST['keywords'];
                $meta_key  = $_REQUEST['meta_key'];
                $meta_desc = $_REQUEST['meta_desc'];

                $update = "update sp_pages_seo set title='$title', keywords='$keywords', meta_keywords='$meta_key', meta_description='$meta_desc' where id='$id'";
                $sql= $db->prepare($update);
                if($sql->execute()){
                    echo "<h3>Data Update Successfully</h3>";
                    echo "<meta http-equiv='refresh' content='0'>";
                }
            }
        ?>

        <!-- Forms Row -->
        <div class="row">
            <div class="col-lg-12">
                <h2 class="content-heading">SEO List</h2>
                <div style="overflow-x:auto;">
                    <table class="table table-striped table-hover text-capitalize" id="seo_list">
                        <thead>
                            <tr class="danger">
                                <th class="text-center">S.No.</th>
                                <th class="text-center">Action</th>
                                <th class="text-center">Category Name</th>
                                <th class="text-center">Exam name</th>
                                <th class="text-center">Title</th>
                            </tr>
                       </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-------------------- STATUS MODEL --------------------->
    <div class=" modal fade" id="statusModel" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Edit</h4>
                </div>

                <div class="modal-body">
                    <form class="js-validation-bootstrap form-horizontal" action="seo_contentlist" method="post" id="form">
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="val-username">Exam Name<span class="text-danger">*</span></label>

                            <input type="hidden" name="id" id="id">

                            <div class="col-md-10">
                                <select class="js-select2 form-control" name="exam_name" style="width: 100%;">
                                        <?php 
                                            $sql = $db->prepare("SELECT exam_id,exam_name FROM sp_exam");
                                            $sql->execute();
                                        ?>
                                    <option selected="selected" id="examname" value=""></option>
                                        <?php
                                            while($row=$sql->fetch(PDO::FETCH_ASSOC)) {
                                        ?>
                                    <option value="<?php echo $row['exam_id']; ?>"><?php echo $row['exam_name']; ?></option>
                                        <?php } ?>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label" for="val-email">Exam Category<span class="text-danger">*</span></label>
                            <div class="col-md-10">
                               <select class="js-select2 form-control" name="category" style="width: 100%;">
                                        <?php 
                                            $sql = $db->prepare("SELECT cat_id,name FROM sp_exam_category");
                                            $sql->execute();
                                        ?>
                                    <option selected="selected" id="category" value=""></option>
                                        <?php while($row=$sql->fetch(PDO::FETCH_ASSOC)) { ?>
                                    <option value="<?php echo $row['cat_id']; ?>"><?php echo $row['name']; ?></option>
                                        <?php } ?>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label" for="val-email">Title<span class="text-danger">*</span></label>
                            <div class="col-md-10">
                                <input class="form-control" type="text" name="title" placeholder="Exam title" id="title">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label" for="val-email">Keywords<span class="text-danger">*</span></label>
                            <div class="col-md-10">
                                <input class="form-control" type="text" name="keywords" placeholder="exam keywords" id="keywords" value="">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label" for="val-email">Meta Keywords<span class="text-danger">*</span></label>
                            <div class="col-md-10">
                                <input class="form-control" type="text" name="meta_key" placeholder="exam meta keywords" id="meta_keyword">
                            </div>
                        </div>

                       <div class="form-group">
                            <label class="col-md-2 control-label" for="val-confirm-password">Meta Description<span class="text-danger">*</span></label>
                            <div class="col-md-10">
                               <textarea  name="meta_desc" id="editor3"></textarea>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <div class="col-md-8 col-md-offset-2">
                                <button class="btn btn-sm btn-primary" type="submit" name="submit">Submit</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>        
    </div>
</main>

<script type="text/javascript">
    jQuery(document).ready(function (){
        jQuery('#seo_list').dataTable({
            "dom" : "Bfrtip",
            "pagingType": "full_numbers",
            "processing": true,
            "serverSide": true,
            "responsive": true,
            "ajax":  "seo_contentlist_data.php",
            "columns": [
                {"data": "id",
                    render: function(data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { "data": "action",
                    "render": function ( data, type, row ) {
                        return '<button name="edit" class="btn btn-info" onclick="selectData('+row.id+')" data-toggle="tooltip" title="Edit this exam"><i class="fa fa-pencil-square-o " aria-hidden="true"></i></button><button class="btn btn-danger" title="Delete Seo Content" onclick="deleteSeo('+row.id+')"><i class="fa fa-trash-o"></i></button>';
                    }
                },
                { "data": "name" },
                { "data": "exam_name"},
                { "data": "title"}
            ],
            "bPaginate": true,
            "iDisplayLength": 50,
            "bProcessing" : true,
            "bServerSide" : true,
            "lengthMenu": [[10, 50, 100, 500, 1000], [10, 50, 100, 500, 1000]]
        });                  
    });

    function selectData(id) {
        $.ajax('seo_contentedit.php', {
            type: 'POST', 
            data: { id:id }, 
            success: function (data) {
                document.getElementById("id").value = id;
                document.getElementById("examname").value = data.exam_id;
                document.getElementById("examname").innerHTML = data.exam_name;
                document.getElementById("category").value = data.category_id;
                document.getElementById("category").innerHTML = data.name;
                document.getElementById("title").value = data.title;
                document.getElementById("keywords").value = data.keywords;
                document.getElementById("meta_keyword").value = data.meta_keywords;
                document.getElementById("editor3").innerHTML = data.meta_description;
            },
            error: function (jqXhr, textStatus, errorMessage) { }
        });
        jQuery("#statusModel").modal(); 
    }

    function deleteSeo(id){
        var txt;
        var r = confirm("Do you want to Delete ?");
        if (r == true) {
            $.ajax('delete_seo_content.php', {
                type: 'POST',  // http method
                data: { id:id },  // data to submit
                success: function (response) {
                    var obj = jQuery.parseJSON(response);
                    if(obj.status == '1'){
                        alert(obj.msg);
                        location.reload();
                    } else {
                        alert(obj.msg);
                    }
                },
                error: function (jqXhr, textStatus, errorMessage) {
                }
            });
        }
    }
</script>

<?php include 'footer.php'; ?>