-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /var/www/html/inc/file/
File Upload :
Current File : /var/www/html/inc/file/down.php

<?php

	include $_SERVER['DOCUMENT_ROOT'] . '/inc/config.php' ;

	$num = ( empty($_POST['num']))?$_GET['num']:$_POST['num'] ;
	$numid = ( empty($_POST['numid']))?$_GET['numid']:$_POST['numid'] ;
	$fn = ( empty($_POST['fn']))?$_GET['fn']:$_POST['fn'] ;
	$code = ( empty($_POST['code']))?$_GET['code']:$_POST['code'] ;

	if ( empty($num) && empty($numid))
	{
		echo "
				<script>
				alert('´Ù¿î·ÎµåÇÒ ÆÄÀÏÀÌ ¼±ÅõÇÁö ¾Ê¾Ò½À´Ï´Ù.');
				history.go(-1);
				</script>
		" ;
		exit ;
	}
	else if ( empty($num) && !empty($numid))
	{
		if ( empty($code) || empty($fn))
		{
			echo "
					<script>
					alert('´Ù¿î·ÎµåÇÒ ÆÄÀÏÀÌ ¼±ÅõÇÁö ¾Ê¾Ò½À´Ï´Ù. ');
					history.go(-1);
					</script>
			" ;
			exit ;
		}
		$f_rs = $exe->qry_fetch( " from tbl_{$config[$code][1]} where keycode='{$code}' and numid='{$numid}' " , " numid , keycode , {$fn} " ) ;
		if ( empty($f_rs['numid']))
		{
			echo "
					<script>
					alert('»èÁ¦µÇ¾ú°Å³ª ¾ø´Â ÆÄÀÏÀÔ´Ï´Ù.');
					history.go(-1);
					</script>
			" ;
			exit ;
		}
		elseif ( empty($info_admin['loginno']) && $info_user['loginlevel'] < $config[$f_rs['keycode']][4]['down_level'] ) {
			echo "
					<script>
					alert(' ±ÇÇÑÀÌ ¾ø½À´Ï´Ù. ');
					history.go(-1);
					</script>
			" ;
			exit ;
		}
		else
		{
			$file_path = $_SERVER['DOCUMENT_ROOT'] . '/files/' . $config[$f_rs['keycode']][1] . '/' . $f_rs[$fn] ;
			if ( is_file ( $file_path ) )
			{
				$file_size = @filesize($file_path) ;
				header("Content-Type: file/unknown") ;
				header("Content-Length: " . $file_size . "");
				//header("Content-Type: {$f_rs[file_size]}") ;
				header("Content-Disposition: attachment; filename=" . $f_rs[$fn] ) ;
				header("Content-Transfer-Encoding: binary");
				header("Cache-Control: private");
				header("Pragma: no-cache");
				header("Expires: 0");

				$f_open = fopen( $file_path , "rb" ) ;
				fpassthru( $f_open ) ;
				exit ;
			}
			else
			{
				echo "
						<script>
						alert('»èÁ¦µÇ¾ú°Å³ª ¾ø´Â ÆÄÀÏÀÔ´Ï´Ù.');
						history.go(-1);
						</script>
				" ;
				exit ;
			}
		}
	}
	else
	{
		$f_rs = $exe->qry_fetch( " from tbl_{$info_file[table]} where fileno='{$num}' " , " fileno , keycode , real_file_name , orig_file_name" ) ;
		if ( empty($f_rs['fileno']))
		{
			echo "
					<script>
					alert('»èÁ¦µÇ¾ú°Å³ª ¾ø´Â ÆÄÀÏÀÔ´Ï´Ù.');
					history.go(-1);
					</script>
			" ;
			exit ;
		}
		elseif ( empty($info_admin['loginno']) && $info_user['loginlevel'] < $config[$f_rs['keycode']][4]['down_level'] ) {
			echo "
					<script>
					alert(' ±ÇÇÑÀÌ ¾ø½À´Ï´Ù. ');
					history.go(-1);
					</script>
			" ;
			exit ;
		}
		else
		{
			$file_path = $_SERVER['DOCUMENT_ROOT'] . '/files/' . $config[$f_rs['keycode']][1] . '/' . $f_rs['real_file_name'] ;
			if ( is_file ( $file_path ) )
			{
				$file_size = @filesize($file_path) ;
				header("Content-Type: file/unknown") ;
				header("Content-Length: " . $file_size . "");
				//header("Content-Type: {$f_rs[file_size]}") ;
				header("Content-Disposition: attachment; filename=" . $f_rs['orig_file_name'] ) ;
				header("Content-Transfer-Encoding: binary");
				header("Cache-Control: private");
				header("Pragma: no-cache");
				header("Expires: 0");

				$f_open = fopen( $file_path , "rb" ) ;
				fpassthru( $f_open ) ;
				exit ;
			}
			else
			{
				echo "
						<script>
						alert('»èÁ¦µÇ¾ú°Å³ª ¾ø´Â ÆÄÀÏÀÔ´Ï´Ù.');
						history.go(-1);
						</script>
				" ;
				exit ;
			}
		}
	}

?>

Copyright © 2017 || Recoded By Mr.Bumblebee