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/dirsignage/html/webadmin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hkosl.com/dirsignage/html/webadmin/company_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("function_cropimg.php");
	require_once("mime_type_lib.php");

	$sql = "select max(id) as maxid from company";
	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);
	$id = $row{"maxid"} + 1;

	$message = "";

	if((int)$_POST["floor"] != $_POST["floor"]){
		$message .= "樓層只可以是數字.\\n\\n";
	}else{
		$all_disable_floor = explode(",", $disable_floor);



			foreach($all_disable_floor as $this_disable_floor){

				if($_POST["floor"] == $this_disable_floor){
					$message .= "你所輸入的樓層不存在.\\n\\n";
					break;
				}
			}

	}



	if((int)$_POST["telephone"] != $_POST["telephone"]){
		$message .= "電話號碼應是數字組成.\\n\\n";
	}

	if(!empty($message)){
		echo '<script>alert("'.$message.'"); history.back();</script>';
		exit;
	}


	$floor = (int)$_POST["floor"];
	$telephone = (int)$_POST["telephone"];
	$room_no = $_POST["room_no"];
	$fax = $_POST["fax"];
	$email = $_POST["email"];
	$website = $_POST["website"];



	foreach ($arraylangcode as $langcode => $langname) {
		$companyname[$langcode] = $_POST["companyname_".$langcode];
		$companyaddress[$langcode] = $_POST["companyaddress_".$langcode];
	}

	// Upload File

	if ($_FILES["logo"]['name'] <> '') {


			//check if image type is valid or not
			$mime = get_file_mime_type($_FILES["logo"]['name']);

			if (($mime == "image/gif") || ($mime == "image/jpeg") || ($mime == "image/png")) {

				$filename = $_FILES["logo"]['name'];
				preg_match("/\.([^\.]+)$/", $filename, $file_ext);
				$newfilename = random_string()."_id_".$id.".".$file_ext[1]; // default length 8

				move_uploaded_file($_FILES["logo"]['tmp_name'], "../images/company_logo/".$newfilename) or die ("不能上載圖片");

				//$companyimg_path = "../images/business_image/".$newfilename;
				//createthumb($companyimg_path, $companyimg_path, 680, 350);

				$logo = $newfilename;


			} else {
				echo '<script language="javascript">
				alert("圖片格式必須是 JPEG, GIF, or PNG");
				history.back();
			</script>';

				exit;
			}

	} else {
		$logo = "";
	}

	

	/*$sql = "update company set sort = sort + 1";
	if (!($sth = $dbh->prepare($sql))) {
		throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		exit;
	}

	if (!$sth->execute()) {
		throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
		exit;
	}*/

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

	$sql = "insert into company (id, companyname_en, companyname_tc, floor, logo,room_no, telephone,fax, email, website, companyaddress_en,companyaddress_tc, createdate, createby, lastupdate, lastupby) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

	$parameters = array($id, $companyname["en"], $companyname["tc"], $floor, $logo,$room_no, $telephone, $fax, $email, $website, $companyaddress["en"],$companyaddress["tc"], $nowdate, $_SESSION['cmsloginid'], $nowdate, $_SESSION['cmsloginid'] );

	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()));
	}

	$dbh = null;

	header("Location: company_index.php?msg=新增成功");
?>

Youez - 2016 - github.com/yon3zu
LinuXploit