Revonzy Mini Shell
<?php
include('../../config.php');
require_once(PATH_LIBRARIES.'/classes/DBConn.php');
require_once(PATH_LIBRARIES.'/classes/resize.php');
$db = new DBConn();
$path = ROOT."/image_upload/aboutus/";
$path1 = ROOT."/image_upload/aboutus/thumb/";
///*******************************************************
/// To Insert New category /////////////////////////////////
///*******************************************************
if($_POST['type']=="add")
{
/////////////////////////////////
// Code for team member photo
/////////////////////////////////
$name = $_FILES['file']['name'];
$tmp = $_FILES['file']['tmp_name'];
$image=explode('.',$name);
$actual_image_name = time().'.'.$image[1]; // rename the file name
if(move_uploaded_file($tmp, $path.$actual_image_name))
{
///////////////////////////////////////////////////////////
// move the image in the images/team folder
///////////////////////////////////////////////////////////
$resizeObj1 = new resize($path.$actual_image_name);
$resizeObj1 -> resizeImage(200, 200, 'auto');
$resizeObj1 -> saveImage($path1.$actual_image_name, 100);
$tblfield=array('Image', 'URL');
$tblvalues=array($actual_image_name,$_POST['url']);
$res=$db->valInsert("aboutus",$tblfield,$tblvalues);
if(empty($res))
{
echo 0;
}
else
{
echo 1;
}
}
}
///*******************************************************
/// Edit Our works Image
///*******************************************************
if($_POST['type']=="edit")
{
if($_REQUEST['imageupload']=='')
{
//Image Name
$gallary = $_FILES['fileupload']['name'];
//Temp Image Image
$tmp2 = $_FILES['fileupload']['tmp_name'];
$image=explode('.',$gallary);
$gallary_image = time().'.'.$image[1]; // rename the file name
if(move_uploaded_file($tmp2, $path.$gallary_image))
{
// move the image in the thumb folder
$resizeObj1 = new resize($path.$gallary_image);
$resizeObj1 ->resizeImage(200,200,'auto');
$resizeObj1 -> saveImage($path1.$gallary_image, 100);
}
//Unlink Old Image from folders
$select=$db->ExecuteQuery("SELECT Image FROM our_works WHERE Id=".$_REQUEST['id']);
if(count($select)>0)
{
unlink($path.$select[1]['Image']);
unlink($path1.$select[1]['Image']);
}
}
else
{
$gallary_image=$_POST['imageupload'];
}
$tblfield=array('Image','URL');
$tblvalues=array($gallary_image, $_POST['url']);
$condition="Id=".$_POST['id'];
$res=$db->updateValue('aboutus',$tblfield,$tblvalues,$condition);
if (empty($res))
{
echo 0;
}
else
{
echo 1;
}
}
///*******************************************************
/// Delete row from Plant table
///*******************************************************
if($_POST['type']=="delete")
{
//GEt HEre All Image Which Uploaded based on sub category
$sql="SELECT Image FROM aboutus WHERE Id ='".$_POST['id']."'";
$imagename=$db->ExecuteQuery($sql);
if(count($imagename)>0)
{
$tblname="aboutus";
$condition="Id =".$_POST['id'];
$res=$db->deleteRecords($tblname,$condition);
foreach($imagename as $image)
{
if($image['Image']!="")
{
unlink($path.$image['Image']);
unlink($path1.$image['Image']);
}
}
}
}
?>
EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com