WebShell: t.me/oghbnz


Current Path : /home/sreemitragroup/public_html/admin/
Upload File :
Current File : /home/sreemitragroup/public_html/admin/city.php

<?php require("header.php"); ?>

<?php
require("sub_header.php");



$id = $_GET['id'];

$query = $conn->query("SELECT * FROM city WHERE id='$id' ");

$title2 = $query->fetch(PDO::FETCH_ASSOC);
?>



<div class="main">



    <div class="container">



        <div class="row">



            <div class="span12"> <!-- there are 1 to 12 spans we can use for size according to size -->



                <div class="widget stacked ">



                    <div class="widget-header" align="center">

                        <a href="city_settings.php" style="float: left;margin-top: 5px;margin-left:5px" class="btn btn-success"><< Back</a>



                        <h3>Add/Alter City's</h3>



                    </div> <!-- /widget-header -->



                    <div class="widget-content">



                        <div class="tabbable">



                            <div class="tab-content">



                                <div class="tab-pane active" id="profile">



                                    <form name="form" id="form" action="" method="POST" class="form-horizontal" enctype='multipart/form-data'>



                                        <div class="login-fields">



                                            <?php if ($_GET['msg'] == 'error') { ?>

                                                <h3 style="color: green" style="padding-left: 182px;">Unable to update please try again</h3>

                                            <?php } ?>







                                            <div class="control-group">

                                                <label class="control-label" for="title">City Name :</label>

                                                <div class="controls">

                                                    <input type="text" id="title" name="title" value="<?php echo $title2['title']; ?>" class="span5" />

                                                </div>

                                            </div>


                                            <div class="control-group">
                                                <label class="control-label" for="meta_title">Meta Title</label>
                                                <div class="controls">
                                                    <input type="text" class="input-large span5" rows="2" name="meta_title" id="meta_title"  value="<?php echo $title2['meta_title']; ?>" >
                                                </div>
                                            </div>


                                            <div class="control-group">
                                                <label class="control-label" for="meta_keywords">Meta Keywords</label>
                                                <div class="controls">
                                                    <textarea  name="meta_keywords" class="span5" rows="6" ><?php echo $title2['meta_keywords']; ?></textarea>
                                                </div>
                                            </div>

                                            <div class="control-group">
                                                <label class="control-label" for="meta_description">Meta Description</label>
                                                <div class="controls">
                                                    <textarea  name="meta_description" class="span5" rows="6" ><?php echo $title2['meta_description']; ?></textarea>
                                                </div>
                                            </div>






                                            <div class="controls" style="padding-left: 182px; ">

                                                <button class="btn btn-primary" name='update'>Update</button>			

                                            </div>



                                        </div> <!-- /login-fields -->



                                    </form>	



                                </div><!-- /tab-pane active -->	



                            </div><!-- /tab-content -->	



                        </div><!-- /tabbable -->



                    </div> <!-- /widget-content -->



                </div> <!-- /widget -->



            </div> <!-- /span8 -->



        </div> <!-- /row -->



    </div> <!-- /container -->



</div> <!-- /main -->





<?php include_once("foter.php"); ?>



<?php
$query = $conn->query("SELECT * FROM  city WHERE id='$id' ");

$noid = $query->fetch(PDO::FETCH_ASSOC);

$link = $noid['id'];





extract($_POST);

$with_h = [" ", "&"];

$replace_h = ["_", "and"];

$city_link = str_replace($with_h, $replace_h, $title);





if (isset($_POST['update']) && $_GET['id'] != '') {


    $sql1 = $conn->prepare("UPDATE city SET title=:title, city_link=:city_link, meta_title=:meta_title, meta_keywords=:meta_keywords, meta_description=:meta_description WHERE id='$id' ");


    $sql1->bindValue(':title', $title, PDO::PARAM_STR);
    $sql1->bindValue(':city_link', $city_link, PDO::PARAM_STR);
    $sql1->bindValue(':meta_title', $meta_title, PDO::PARAM_STR);
    $sql1->bindValue(':meta_keywords', $meta_keywords, PDO::PARAM_STR);
    $sql1->bindValue(':meta_description', $meta_description, PDO::PARAM_STR);




    if ($sql1->execute()) {

        echo "<script>document.location.href='city_settings.php?msg=update'</script>";
    } else {

        echo "<script>document.location.href='city_settings.php?msg=error'</script>";
    }
}



if (isset($_POST['update']) && $_GET['id'] == '') {



    $sql1 = $conn->prepare("INSERT INTO city ( title, city_link, meta_title, meta_keywords, meta_description) VALUES (:title, :city_link, :meta_title, :meta_keywords, :meta_description)");


    $sql1->bindValue(':title', $title, PDO::PARAM_STR);
    $sql1->bindValue(':city_link', $city_link, PDO::PARAM_STR);
    $sql1->bindValue(':meta_title', $meta_title, PDO::PARAM_STR);
    $sql1->bindValue(':meta_keywords', $meta_keywords, PDO::PARAM_STR);
    $sql1->bindValue(':meta_description', $meta_description, PDO::PARAM_STR);






    if ($sql1->execute()) {

        echo "<script>document.location.href='city_settings.php?msg=update'</script>";
    } else {

        echo "<script>document.location.href='city_settings.php?msg=error'</script>";
    }
}

function getRand() {

    $str = str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890$%@^");

    return sha1(str_shuffle(crypt($str)));
}
?>







<?php include_once("foter.php"); ?>





<script type="text/javascript">

    $(function ()

    {



        $("#form").validate(
                {

                    // Rules for form validation

                    rules:
                            {

                                phone:
                                        {
                                            required: true,
                                            minlength: 10,
                                            maxlength: 50
                                        },
                                city:
                                        {
                                            required: true
                                        },
                                specifications:
                                        {
                                            required: true
                                        },
                                email:
                                        {
                                            required: true,
                                            email: true
                                        }
                            },

                    // Messages for form validation

                    messages:
                            {

                                phone:
                                        {
                                            required: 'Please enter phone number',
                                            minlength: 'Enter a valid phone number',
                                            maxlength: 'Enter a valid phone number'
                                        },
                                city:
                                        {
                                            required: 'Please enter city'
                                        },
                                specifications:
                                        {
                                            required: 'Please enter Specifications'
                                        },
                                email:
                                        {
                                            required: 'Please enter email',
                                            email: 'Please enter a valid email'
                                        }

                            },

                    // Do not change code below

                    errorPlacement: function (error, element)

                    {

                        error.appendTo(element.parent());

                    }

                });

    });



</script>