WebShell: t.me/oghbnz
<?php require("header.php"); ?>
<?php require("sub_header.php");
$a=$_GET['id'];
$query=$conn->query("SELECT * FROM media_gallery WHERE id='$a' ");
$title=$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="media_gallery_settings.php" style="float: left;margin-top: 5px;margin-left:5px" class="btn btn-success"><< Back</a>
<h3>Add/Alter Media Gallery</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 col-md-4" for="heading">Media Name :</label>
<div class="controls">
<input type="text" id="heading" name="heading" value="<?php echo $title['heading']; ?>" class="span4" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="media1">Media Image :</label>
<?php if($title['image']){
$h=$title['image'];
echo "<img height='500' width='350' src='../images/media/".$h."'>";
} ?>
<div class="controls">
<input type="FILE" id="media1" name="media1" class="login username-field" />
</div>
<div style="padding-left: 182px;" > <b>Note :</b><p><i>Please uplode ( 1280 X 850 ) Pixel medias to maintain design</i> </p></div>
</div>
<div class=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 media_gallery WHERE id='$a' ");
$noid=$query->fetch(PDO::FETCH_ASSOC);
extract($_POST);
$with_h=[" ","&"];
$replace_h=["_","and"];
$i_link=str_replace($with_h,$replace_h, $heading);
if(isset($_FILES['media1']) && $_FILES['media1']['size']>0){
$tmp = $_FILES['media1']['tmp_name'];
if(is_uploaded_file($tmp)){
$oname=$_FILES['media1']['name'];
$name=getRand().'-'.$oname; //use this if you want to randamise the name write a function to it.
$desc="../images/media/".$name;
move_uploaded_file($tmp,$desc);
}
}else{
$name= $noid['image'];
}
if(isset($_POST['update']) && $_GET['id'] != ''){
$sql1 = $conn->prepare("UPDATE media_gallery SET heading=:heading, image=:name, i_link=:i_link WHERE id='$a' ");
$sql1->bindValue(':heading',$heading, PDO::PARAM_STR);
$sql1->bindValue(':name',$name, PDO::PARAM_STR);
$sql1->bindValue(':i_link',$i_link, PDO::PARAM_STR);
if($sql1->execute()){
echo "<script>document.location.href='media_gallery_settings.php?msg=update'</script>";
}else{
echo "<script>document.location.href='media_gallery_settings.php?heading=$id?msg=error'</script>";
}
}
if(isset($_POST['update']) && $_GET['id'] == '') {
$sql1 = $conn->prepare("INSERT INTO media_gallery (heading, image, i_link) VALUES (:heading, :name, :i_link) ");
$sql1->bindValue(':heading',$heading, PDO::PARAM_STR);
$sql1->bindValue(':name',$name, PDO::PARAM_STR);
$sql1->bindValue(':i_link',$i_link, PDO::PARAM_STR);
if($sql1->execute()){
echo "<script>document.location.href='media_gallery_settings.php?msg=update'</script>";
}else{
echo "<script>document.location.href='media_gallery_settings.php?heading=$id?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:
{
heading:
{
required: true
},
discription1:{
required: function()
{
CKEDITOR.instances.cktext.updateElement();
}
}
},
// Messages for form validation
messages:
{
heading:
{
required: "Heading is required"
},
title1:
{
required: "Title is required"
},
discription1:
{
required:"Please enter Text"
}
},
// Do not change code below
errorPlacement: function(error, element)
{
error.appendTo(element.parent());
}
});
});
</script>