Server IP : 172.67.168.239 Linux sg2plcpnl0039.prod.sin2.secureserver.net 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64Disable Functions: NONE
W0rmC0deR
$$\ $$\ $$$$$$\ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$$\
$$ | $\ $$ |$$ __$$\ $$ __$$\ $$$\ $$$ | $$ | $$ |$$ __$$\ $$ __$$\ $$ | $$ |$$ _____|$$ __$$\
$$ |$$$\ $$ |$$ / $$ |$$ | $$ |$$$$\ $$$$ | $$ | $$ |$$ / $$ |$$ / \__|$$ |$$ / $$ | $$ | $$ |
$$ $$ $$\$$ |$$ | $$ |$$$$$$$ |$$\$$\$$ $$ | $$$$$$$$ |$$$$$$$$ |$$ | $$$$$ / $$$$$\ $$$$$$$ |
$$$$ _$$$$ |$$ | $$ |$$ __$$< $$ \$$$ $$ | $$ __$$ |$$ __$$ |$$ | $$ $$< $$ __| $$ __$$<
$$$ / \$$$ |$$ | $$ |$$ | $$ |$$ |\$ /$$ | $$ | $$ |$$ | $$ |$$ | $$\ $$ |\$$\ $$ | $$ | $$ |
$$ / \$$ | $$$$$$ |$$ | $$ |$$ | \_/ $$ | $$ | $$ |$$ | $$ |\$$$$$$ |$$ | \$$\ $$$$$$$$\ $$ | $$ |
\__/ \__| \______/ \__| \__|\__| \__| \__| \__|\__| \__| \______/ \__| \__|\________|\__| \__|
<?php
include('connection.php');
function php_slug($string)
{
$slug = preg_replace('/[^a-z0-9-]+/', '-', trim(strtolower($string)));
return $slug;
}
function imageResize($imageSrc,$imageWidth,$imageHeight) {
$newImageWidth =360;
$newImageHeight =250;
$newImageLayer=imagecreatetruecolor($newImageWidth,$newImageHeight);
imagecopyresampled($newImageLayer,$imageSrc,0,0,0,0,$newImageWidth,$newImageHeight,$imageWidth,$imageHeight);
return $newImageLayer;
}
if(isset($_POST['save']))
{
if(is_array($_FILES))
{
@$uploadedFile = $_FILES['img']['tmp_name'];
$sourceProperties = getimagesize(@$uploadedFile);
$newFileName = time();
$dirPath = "images/services_img/";
$ext = pathinfo($_FILES['img']['name'], PATHINFO_EXTENSION);
$imageType = $sourceProperties[2];
switch ($imageType) {
case IMAGETYPE_PNG:
$imageSrc = imagecreatefrompng($uploadedFile);
$tmp = imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
imagepng($tmp,$dirPath. $newFileName. "_thump.". $ext);
break;
case IMAGETYPE_JPEG:
$imageSrc = imagecreatefromjpeg($uploadedFile);
$tmp = imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
imagejpeg($tmp,$dirPath. $newFileName. "_thump.". $ext);
break;
case IMAGETYPE_GIF:
$imageSrc = imagecreatefromgif($uploadedFile);
$tmp = imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
$final_image_name = imagegif($tmp,$dirPath. $newFileName. "_thump.". $ext);
break;
default:
// echo "Invalid Image type.";
exit;
break;
}
move_uploaded_file($uploadedFile, $dirPath. $newFileName. ".". $ext);
// $type_of_services = mysqli_real_escape_string($conn, $_POST['type_of_services']);
$heading = mysqli_real_escape_string($conn,$_POST['heading']);
$set_heading = strtolower($heading);
$short_description = mysqli_real_escape_string($conn, $_POST['short_description']);
$description = mysqli_real_escape_string($conn, $_POST['description']);
$date_time = date('d/m/Y H:i:s ');
$meta_keywords = mysqli_real_escape_string($conn, $_POST['meta_keywords']);
$meta_description = mysqli_real_escape_string($conn, $_POST['meta_description']);
$set_heading = htmlentities($heading);
// $orignal_image = $newFileName.".".$ext;
$thump_image = $newFileName. "_thump.". $ext;
$date_time = date("d/m/Y H:i:s a");
if(@$_FILES["services_img"]["name"][0])
{
for($i=0; $i<count($_FILES["services_img"]["name"]); $i++)
{
$name1=$_FILES['services_img']['name'][$i];
$type1=$_FILES['services_img']['type'][$i];
$error1=$_FILES['services_img']['error'][$i];
$size1=$_FILES['services_img']['size'][$i];
$temp=$_FILES['services_img']['tmp_name'][$i];
$ImgName1=Null;
$fileArr1=explode('.',$name1);
$ImgName1 = $i."_".round(microtime(true) * 1000).".".$fileArr1["1"];
$images[$i]=$ImgName1;
move_uploaded_file($temp,"images/services_img/".$ImgName1);
}
$all_image=implode("*#*",$images);
}else
{
$all_image="";
}
$query = mysqli_query($conn,"INSERT INTO services(heading,short_description,description,image,date_time,path_url,thumbnail_image,meta_keyword,meta_description)VALUES('".$set_heading."','".$short_description."','".$description."','".$all_image."','".$date_time."','".php_slug($set_heading)."','".$thump_image."','".$meta_keywords."','".$meta_description."')");
if($query)
{
header('location:add-services.php?save=true');
}else
{
header('location:add-services.php?not_save=true');
}
}
}
// Update service code
if(isset($_POST['update']))
{
$id=$_POST['service_update'];
if(is_array($_FILES)) {
if(@$_FILES['img']['tmp_name'])
{
$uploadedFile = $_FILES['img']['tmp_name'];
@$sourceProperties = getimagesize($uploadedFile);
$newFileName = time();
$dirPath = "images/services_img/";
$ext = pathinfo($_FILES['img']['name'], PATHINFO_EXTENSION);
$imageType = $sourceProperties[2];
switch ($imageType) {
case IMAGETYPE_PNG:
$imageSrc = imagecreatefrompng($uploadedFile);
$tmp = imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
imagepng($tmp,$dirPath. $newFileName. "_thump.". $ext);
break;
case IMAGETYPE_JPEG:
$imageSrc = imagecreatefromjpeg($uploadedFile);
$tmp = imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
imagejpeg($tmp,$dirPath. $newFileName. "_thump.". $ext);
break;
case IMAGETYPE_GIF:
$imageSrc = imagecreatefromgif($uploadedFile);
$tmp = imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
$final_image_name = imagegif($tmp,$dirPath. $newFileName. "_thump.". $ext);
break;
default:
// echo "Invalid Image type.";
exit;
break;
}
// $old_image = $newFileName.".".$ext;
$thumnail_old_image = $newFileName. "_thump.". $ext;
move_uploaded_file($uploadedFile, $dirPath. $newFileName. ".". $ext);
$old_imag = mysqli_query($conn,"SELECT thumbnail_image FROM services WHERE id='".$id."'");
$old_row_img = mysqli_fetch_array($old_imag);
// unlink("images/services_img/".$old_row_img['image']);
unlink("images/services_img/".$old_row_img['thumbnail_image']);
}
else
{
// $old_image = $_POST['old_image'];
$thumnail_old_image = $_POST['single_old_img'];
}
if(@$_POST["multi_old_img"])
{
$multi_old_image=implode("*#*",$_POST["multi_old_img"]);
}
else
{
$multi_old_image="";
}
if($_FILES["services_img"]["name"]["0"]!="")
{
for($i=0; $i<count($_FILES["services_img"]["name"]); $i++)
{
$name1=$_FILES['services_img']['name'][$i];
$type1=$_FILES['services_img']['type'][$i];
$error1=$_FILES['services_img']['error'][$i];
$size1=$_FILES['services_img']['size'][$i];
$temp=$_FILES['services_img']['tmp_name'][$i];
$ImgName1=Null;
$fileArr1=explode('.',$name1);
// $ImgName1 = round(microtime(true) * 1000).".".$fileArr1["1"];
$ImgName1 = $i."_".round(microtime(true) * 1000).".".$fileArr1["1"];
// var_dump($ImgName1);
$images[$i]=$ImgName1;
move_uploaded_file($temp,"images/services_img/".$ImgName1);
}
}
else
{
$images=null;
}
//var_dump($old_image);
@$all_image=implode("*#*",$images);
//var_dump();
if($images==null)
{
$all_image=$multi_old_image;
}
else
{
if(@$multi_old_image)
{
$all_image=$all_image."*#*".@$multi_old_image;
}
}
// $id=$_POST['service_update'];
// $type_of_services = mysqli_real_escape_string($conn, $_POST['type_of_services']);
$heading = mysqli_real_escape_string($conn,$_POST['heading']);
$set_heading = strtolower($heading);
$short_description = mysqli_real_escape_string($conn, $_POST['short_description']);
$description = mysqli_real_escape_string($conn, $_POST['description']);
$date_time = date('d/m/Y H:i:s ');
$meta_keywords = mysqli_real_escape_string($conn, $_POST['meta_keywords']);
$meta_description = mysqli_real_escape_string($conn, $_POST['meta_description']);
$set_heading = htmlentities($heading);
$update_query = mysqli_query($conn,"UPDATE services SET heading='".$set_heading."',short_description='".$short_description."',description='".$description."',image='".$all_image."',date_time='".$date_time."',path_url='".php_slug($set_heading)."',thumbnail_image='".$thumnail_old_image."' ,meta_keyword='".$meta_keywords."',meta_description='".$meta_description."' WHERE id='".$id."'");
// var_dump("UPDATE services SET heading='".$set_heading."',short_description='".$short_description."',description='".$description."',image='".$all_image."',date_time='".$date_time."',path_url='".php_slug($set_heading)."',thumbnail_image='".$thumnail_old_image."' ,meta_keyword='".$meta_keywords."',meta_description='".$meta_description."' WHERE id='".$id."'");
if($update_query)
{
header('location:manage-services-list.php?update_services=true');
}else
{
header('location:manage-services-list.php?update-fail=true');
}
}
}
?> Coded By W0rmC0d3R