403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/hkosl.com/kelvin/webadmin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hkosl.com/kelvin/webadmin/product_detail_add.php
<?php
include 'config.php';

// Check if the user is logged in

if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1'))
{
header("Location: login.php");
exit;
}
require("configure.php"); 

$pdtitleen			= check_input($_POST["pdtitleen"]);
$pdtitletc			= check_input($_POST["pdtitletc"]);
$pddescen			= preg_replace("/'/","\'",$_POST["pddescen"]);
$pddesctc			= preg_replace("/'/","\'",$_POST["pddesctc"]);
$pdspecen			= preg_replace("/'/","\'",$_POST["pdspecen"]);
$pdspectc			= preg_replace("/'/","\'",$_POST["pdspectc"]);

$nowdate 			= date("Y-m-d H:i:s");


	$sql = "select max(pdid) as maxid ";
	$sql .= "from product_detail ";
	$result=mysql_query($sql);
	$row = mysql_fetch_array($result,MYSQL_ASSOC);
	$pdid = $row{maxid}+1;



	$pdcatidSelect = $_POST['pdcatidSelect'];
	//check the product category if empty or not
	if(empty($_POST['pdcatidSelect'])){
		echo "<script>alert('You must select at least one product category for this product!');
		history.back();
		</script>";
		exit;
	}

	//insert the record to the product_cat_item table

	$cntpdcatid	 = count($pdcatidSelect);
	$i=1;
	foreach($_POST['pdcatidSelect'] as $pdcatidbox){
		$pdcatid[$i++] =  $pdcatidbox;
	}

	// Delete Project Category db
	$sql3 = "DELETE FROM product_cat_item WHERE pdid='$pdid'";
	mysql_query($sql3);

	for($i=1;$i<=$cntpdcatid;$i++){
		if(strlen($pdcatid[$i])> 0){
			// Sort
			$sql = "select max(psort) as maxid ";
			$sql .= "from product_cat_item WHERE pdcatid = '".$pdcatid[$i]."' ";
			$result=mysql_query($sql);
			$row = mysql_fetch_array($result,MYSQL_ASSOC);
			$psort = $row{maxid}+1;

			$sql2 = "insert into product_cat_item (pdid, pdcatid, psort) values ('$pdid', '".$pdcatid[$i]."', '$psort')";
			mysql_query($sql2);
		}
	}


	//record the material logo for that product
	$material_logo_array = $_POST["material_logo"];

	$material_logo = sizeof($material_logo_array);
	// Delete Project Category db
	$sql5 = "DELETE FROM prod_mate_logo WHERE pdid='$pdid'";
	mysql_query($sql5);

	for($i=0;$i<$material_logo;$i++){

		$sql2 = "insert into product_material_logo (pdid, material_logoid) values ('$pdid', '".$material_logo_array[$i]."')";
		mysql_query($sql2);

	}



	// copy image
	$filelimit = 2 * 1048576; //Filelimit in 2MB
	$x=1;

	if ($_FILES['pdimgen']['name'] <> '')
	{
		if ($_FILES['pdimgen']['size'] < $filelimit ){

			if (($_FILES['pdimgen']["type"] == "image/gif") || ($_FILES['pdimgen']["type"] == "image/GIF") || ($_FILES['pdimgen']["type"] == "image/jpg") || ($_FILES['pdimgen']["type"] == "image/JPG") || ($_FILES['pdimgen']["type"] == "image/jpeg") || ($_FILES['pdimgen']["type"] == "image/JPEG") || ($_FILES['pdimgen']["type"] == "image/pjpeg") || ($_FILES['pdimgen']["type"] == "image/PJEG") || ($_FILES['pdimgen']["type"] == "image/png") || ($_FILES['pdimgen']["type"] == "image/x-png") || ($_FILES['pdimgen']["type"] == "image/PNG") || ($_FILES['pdimgen']["type"] == "image/X-PNG"))
			{


				$filename=$_FILES['pdimgen']['name'];
				preg_match("/\.([^\.]+)$/", $filename, $file_ext);

				copy ($_FILES['pdimgen']['tmp_name'], "../images/product/product_".$pdid.".".$file_ext[1])
				or die ("Could not copy the file: Project Photo");

				$imagelarge = "../images/product/product_".$pdid.".".$file_ext[1];
				//createthumb($imagelarge, $imagelarge, 600, 600);

				$pdimgen = "../images/product/product_".$pdid.".".$file_ext[1];
				$pdimgen = htmlspecialchars($pdimgen,ENT_QUOTES);

				$x++;
			}

		}
		else
		{
			// upload error
			?>
			<script language="javascript">
				alert("Files must be JPEG, GIF, or PNG and under 2MB in size");
				history.back();
			</script>
			<?php
			exit;
		}
	}
	else
	{
		$pdimgen = "";
	}

	// End copy image




	// copy image
	$filelimit = 2 * 1048576; //Filelimit in 2MB
	$x=1;

	if ($_FILES['pdimgtc']['name'] <> '')
	{
		if ($_FILES['pdimgtc']['size'] < $filelimit ){

			if (($_FILES['pdimgtc']["type"] == "image/gif") || ($_FILES['pdimgtc']["type"] == "image/GIF") || ($_FILES['pdimgtc']["type"] == "image/jpg") || ($_FILES['pdimgtc']["type"] == "image/JPG") || ($_FILES['pdimgtc']["type"] == "image/jpeg") || ($_FILES['pdimgtc']["type"] == "image/JPEG") || ($_FILES['pdimgtc']["type"] == "image/pjpeg") || ($_FILES['pdimgtc']["type"] == "image/PJEG") || ($_FILES['pdimgtc']["type"] == "image/png") || ($_FILES['pdimgtc']["type"] == "image/x-png") || ($_FILES['pdimgtc']["type"] == "image/PNG") || ($_FILES['pdimgtc']["type"] == "image/X-PNG"))
			{


				$filename=$_FILES['pdimgtc']['name'];
				preg_match("/\.([^\.]+)$/", $filename, $file_ext);

				copy ($_FILES['pdimgtc']['tmp_name'], "../images/product/product_".$pdid.".".$file_ext[1])
				or die ("Could not copy the file: Project Photo");

				$imagelarge = "../images/product/product_".$pdid.".".$file_ext[1];
				//createthumb($imagelarge, $imagelarge, 600, 600);

				$pdimgtc = "../images/product/product_".$pdid.".".$file_ext[1];
				$pdimgtc = htmlspecialchars($pdimgtc,ENT_QUOTES);

				$x++;
			}

		}
		else
		{
			// upload error
			?>
			<script language="javascript">
				alert("Files must be JPEG, GIF, or PNG and under 2MB in size");
				history.back();
			</script>
			<?php
			exit;
		}
	}
	else
	{
		$pdimgtc = "";
	}

	// End copy image


$sql = "insert into product_detail (pdimgen,pdimgtc,pdid, pdtitleen, pdtitletc, pddescen, pddesctc,pdspecen, pdspectc, pdstatus, createdate, lastupdate, createby, lastupby) values ('$pdimgen','$pdimgtc','$pdid', '$pdtitleen', '$pdtitletc', '$pddescen', '$pddesctc','$pdspecen', '$pdspectc', '1', '$nowdate', '$nowdate', '".$_SESSION['cmsloginid']."','".$_SESSION['cmsloginid']."')";
mysql_query($sql);
if( mysql_errno() > 0 ){
	echo 'Add Product Detail Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
	exit;
}

mysql_close($dbh);

header("Location: product_detail_index.php?msg=Add Successful");
?>

Youez - 2016 - github.com/yon3zu
LinuXploit