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/ergofito/webadmin/content/aboutus/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hkosl.com/ergofito/webadmin/content/aboutus/news_process.php
<?php
	include_once('../../check_login.php');
	
	ini_set('display_errors',0);
	$id =$_POST['id'];
	$type=$_POST['type'];
	unset($_POST['id']);
	
	// Upload File
	if ($_FILES["photo_tc"]['name'] <> '') {
		//check if image type is valid or not
		$filename = $_FILES["photo_tc"]['name'];
		preg_match("/\.([^\.]+)$/", $filename, $file_ext);
		$newfilename = random_string(10) . "_banner_refid_" . $id . "." . $file_ext[1]; // default length 8
		move_uploaded_file($_FILES["photo_tc"]['tmp_name'], "../../../file/news/" . $newfilename) or die ("Could not copy the file");
		$photo = $newfilename;
		$_POST['photo_tc'] = $photo;
	}
	
	if($id){
		//update db
		$data = $_POST;
		unset($data['x']);
		unset($data['y']);
		$data['lastupdate'] = $nowdate;
		$data['lastupby'] = $_SESSION['cmsloginid'];
		$sql = mysql_install($data,'news','edit','refid');
		$data['refid']=$id;
		$arraykey=array_keys($data);
		for($i=0;$i<count($arraykey);$i++){
			$parameters[$i]=$data[$arraykey[$i]];
		}
		if (!($sth = $dbh->prepare($sql))) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		if (!$sth->execute($parameters)) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		header("Location: news_index.php?msg=儲存成功&type=".$type);
	}else{
		//refid
		$sql = "select max(refid) as maxid from news";
		if (!($sth = $dbh->prepare($sql))) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		if (!$sth->execute()) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		$row = $sth->fetch(PDO::FETCH_ASSOC);
		$_POST['refid'] = $row{"maxid"} + 1;
		//sort
		$sql = "select max(sort) as maxid from news where type='".$type."'";
		if (!($sth = $dbh->prepare($sql))) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		if (!$sth->execute()) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		$row = $sth->fetch(PDO::FETCH_ASSOC);
		$_POST['sort'] = $row{"maxid"} + 1;
		
		//insert db
		$data = $_POST;
		unset($data['x']);
		unset($data['y']);
		$data['lastupdate'] = $nowdate;
		$data['lastupby'] = $_SESSION['cmsloginid'];
		$sql = mysql_install($data,'news','add');
		$arraykey=array_keys($data);
		for($i=0;$i<count($arraykey);$i++){
			$parameters[$i]=$data[$arraykey[$i]];
		}
		if (!($sth = $dbh->prepare($sql))) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		if (!$sth->execute($parameters)) {
			throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		}
		header("Location: news_index.php?msg=新增成功&type=".$type);	
	}
	exit();

?>

Youez - 2016 - github.com/yon3zu
LinuXploit