| Server IP : 134.236.49.22 / Your IP : 216.73.216.114 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/upload/bk/ |
Upload File : |
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<?php
#---------------------------------------------#
# file upload manager 1.3
# 13.10.2003
#
# written by thepeak (adam johnson)
# copyright (c) 2003 thepeak of mtnpeak.net
#
# www: http://webdev.mtnpeak.net
# www: http://www.xd3v.com
# email: thepeak@gmx.net
#
# A simple, powerful tool to upload and manage
# files using your web browser.
#
# This program is free software; you can redistribute
# it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or
# (at your option) any later version, as long as the
# copyright info and links stay intact. You may not sell
# this program under any circumstance without written
# permission from the author. Full license is in the
# included ZIP/GZ package this script was downloaded in.
#
# *please send me feedback - and enjoy!
#---------------------------------------------#
################## configurations ####################
# header & title of this file
$title = "ระบบส่งรายงาน to CUP SATTAHIP";
# individual file size limit - in bytes (102400 bytes = 100KB)
$file_size_ind = "10240000";
# the upload store directory (chmod 777)
$dir_store= "store";
# the images directory
$dir_img= "img";
# the style-sheet file to use (located in the "img" directory, excluding .css)
$style = "style-def";
# the file type extensions allowed to be uploaded
$file_ext_allow = array("gif","jpg","jpeg","bmp","txt","dat","mdb","zip","exe","xls","doc");
# option to display the file list
# to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
$file_list_allow = 1;
# option to allow file deletion
# to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
$file_del_allow = 1;
# option to password-protect this script [-part1]
# to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
$auth_ReqPass = 0;
# option to password-protect this script [-part2]
# if "$auth_ReqPass" is enabled you must set the username and password
$auth_usern = "username";
$auth_passw = "password";
################ end of configurations ###############
# DO NOT ALTER OR EDIT BELOW THIS LINE UNLESS YOU ARE AN ADVANCED PHP PROGRAMMER
?>
<?
if (@phpversion() < '4.1.0') {
$_FILE = $HTTP_POST_FILES;
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
}
clearstatcache();
error_reporting(E_ALL & ~E_NOTICE);
$fum_vers = "1.3"; # do not edit this line, the script will not work!!!
$fum_info_full = "ระบบส่งรายงาน online v$fum_vers";
function authDo($auth_userToCheck, $auth_passToCheck)
{
global $auth_usern, $auth_passw;
$auth_encodedPass = md5($auth_passw);
if ($auth_userToCheck == $auth_usern && $auth_passToCheck == $auth_encodedPass) {
$auth_check = TRUE;
} else {
$auth_check = FALSE;
}
return $auth_check;
}
if (isset($logout)) {
setcookie ('fum_user', "",time()-3600);
setcookie ('fum_pass', "",time()-3600);
}
if (isset($login)) {
$auth_password_en = md5($auth_formPass);
$auth_username_en = $auth_formUser;
if (authDo($auth_username_en, $auth_password_en)) {
setcookie ('fum_user', $auth_username_en,time()+3600);
setcookie ('fum_pass', $auth_password_en,time()+3600);
$auth_msg = "<b>ตรวจสอบสิทธิ ถูกต้อง!</b> เปิดใช้งาน Cookies.<br><br>".
$auth_msg . "password ของท่าน (MD5 encrypted) คือ : $auth_password_en";
} else {
$auth_msg = "<b>ท่านไม่มีสิทธิ หรือ รหัสผิด!</b>";
}
}
if (($_GET[act]=="dl")&&$_GET[file])
{
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) {
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
$value_de=base64_decode($_GET[file]);
$dl_full=$dir_store."/".$value_de;
$dl_name=$value_de;
if (!file_exists($dl_full))
{
echo"ข้อผิดพลาด: ไม่สามารถ download ครับ, หาไฟล์ไม่พบ.<br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
exit();
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$dl_name");
header("Content-Length: ".filesize($dl_full));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");
@readfile($dl_full);
exit();
}
}
}
function getlast($toget)
{
$pos=strrpos($toget,".");
$lastext=substr($toget,$pos+1);
return $lastext;
}
function replace($o)
{
$o=str_replace("/","",$o);
$o=str_replace("\\","",$o);
$o=str_replace(":","",$o);
$o=str_replace("*","",$o);
$o=str_replace("?","",$o);
$o=str_replace("<","",$o);
$o=str_replace(">","",$o);
$o=str_replace("\"","",$o);
$o=str_replace("|","",$o);
return $o;
}
?>
<!-- <?=$fum_info_full?> -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><? echo ($title) ? ($title) : ("File Upload Manager"); ?></title>
<link rel="stylesheet" href="<?=$dir_img?>/<?=$style?>.css" type="text/css">
<?
if ($auth_ReqPass == 1)
{
if (isset($login) || isset($logout)) {
echo("<meta http-equiv='refresh' content='2;url=$_SERVER[PHP_SELF]'>");
}
}
?>
</head>
<body bgcolor="#F7F7F7"><br><br>
<center>
<?
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) {
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
?>
<table width="560" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><font size="3"><b><i><? echo ($title) ? ($title) : ("File Upload Manager"); ?></i></b></font> <font style="text-decoration: bold; font-size: 9px;">v<?=$fum_vers?></font>
<?
#--Please do not remove my link/copyright as it is unfair and a breach of the license--#
echo"<a href=\"http://www.cast2004.com/mail.com\" style=\"text-decoration: none; color: #C0C0C0; font-size: 9px; cursor: default\";>& k.surat </a>";
?>
</td>
</tr>
</table>
<?
if (!eregi("777",decoct(fileperms($dir_store))))
{
echo"<br><br><b><h4><font color=\"FF0000\">ข้อผิดพลาด : ไม่สามารถเข้าถึง directory. โปรดเปลี่ยน Permission chmod the \"$dir_store\" directory with value 0777 (xrw-xrw-xrw)!</h4></font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">refresh</a>";
}
else
{
if (!$_FILES[fileupload])
{
?>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-top:5px;padding-left=5px;padding-bottom:5px;padding-right:5px">
<form method="post" enctype="multipart/form-data">
<tr>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ไฟล์
:</font></td>
<td><input type="file" name="fileupload" class="textfield" size="30"></td>
</tr>
<tr>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">เปลี่ยนชื่อไฟล์:</font></td>
<td><input type="text" name="rename" class="textfield" size="46"></td>
</tr>
<tr>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ชนิดไฟล์ที่อนุญาต:</font></td>
<td>
<?
for($i=0;$i<count($file_ext_allow);$i++)
{
if (($i<>count($file_ext_allow)-1))$commas=", ";else $commas="";
list($key,$value)=each($file_ext_allow);
echo $value.$commas;
}
?>
</td>
</tr>
<tr>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ขนาดไฟล์ต้องไม่เกิน:</font></td>
<td> <b>
<?
if ($file_size_ind >= 1048576)
{
$file_size_ind_rnd = round(($file_size_ind/1024000),3) . " MB";
}
elseif ($file_size_ind >= 1024)
{
$file_size_ind_rnd = round(($file_size_ind/1024),2) . " KB";
}
elseif ($file_size_ind >= 0)
{
$file_size_ind_rnd = $file_size_ind . " bytes";
}
else
{
$file_size_ind_rnd = "0 bytes";
}
echo "$file_size_ind_rnd";
?>
</b> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" value="upload" class="button">
<input type="reset" value="clear" class="button">
</div></td>
</tr>
</form>
</table>
<?
if ((!$_GET[act]||!$_GET[file])&&$_GET[act]!="delall")
{
$opendir = @opendir($dir_store);
while ($readdir = @readdir($opendir))
{
if ($readdir<>"." && $readdir<>".." && $readdir != "index.html")
{
$filearr[] = $readdir;
}
$sort=array();
for($i=1;$i<=count($filearr);$i++)
{
$key = sizeof($filearr)-$i;
$file = $filearr[$key];
$sort[$i]=$file;
}
asort($sort);
}
?>
<p> </p>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-left:5px">
<tr>
<td><b><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ระบบจัดการข้อมูล:
</font></b><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><font color="#FF0000">ถ้าส่งผิด
คลิ๊กปุ่มนี้จะลบทั้งหมด</font></font>
<?
if ($file_del_allow != 1 && $auth_ReqPass != 1)
{
echo"<i>none</i>";
}
if ($file_del_allow == 1 && $file_list_allow == 1 && (count($filearr) >= 1))
{
echo"<a href=\"javascript:;\" onClick=\"cf=confirm('คุณกำลังจะลบ FILES ทั้งหมด นะครับ ?');if (cf)window.location='?act=delall'; return false;\" style=\"font-size: 9px;\"><delete all files></a>";
}
if ($auth_ReqPass == 1)
{
echo" <a href=\"$_SERVER[PHP_SELF]?logout=1\" style=\"font-size: 9px;\"><log-out><a>";
}
?>
</td>
</tr>
</table>
<br>
<?
if ($file_list_allow == 1 && (count($filearr) >= 1))
{
?>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-left:6px">
<tr bgcolor="#DBDBDB">
<td align="left" width="35%"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ชื่อไฟล์</font></td>
<td align="center" width="11%"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ชนิดไฟล์</font></td>
<td align="center" width="12%"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ขนาดไฟล์</font></td>
<td align="center" width="42%"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">การจัดการ</font></td>
</tr>
<?
for($i=1;$i<=count($sort);$i++)
{
list($key,$value)=each($sort);
if ($value)
{
$value_en = base64_encode($value);
$value_view=$value;
if (strlen($value) >= 48)
{
$value_view = substr($value_view, 0, 45) . '...';
}
?>
<tr>
<td width="35%"> <font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<?="<a href=\"?act=view&file=$value_en\">$value_view</a>"?>
</font></td>
<td align="center" width="11%"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><? echo strtoupper(getlast($value)); ?></font></td>
<td align="center" width="12%"> <font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<?
$value_full = $dir_store."/".$value;
$file_size = filesize($value_full);
if ($file_size >= 1048576)
{
$show_filesize = number_format(($file_size / 1048576),2) . " MB";
}
elseif ($file_size >= 1024)
{
$show_filesize = number_format(($file_size / 1024),2) . " KB";
}
elseif ($file_size >= 0)
{
$show_filesize = $file_size . " bytes";
}
else
{
$show_filesize = "0 bytes";
}
echo "$show_filesize";
?>
</font></td>
<td align="center" width="42%"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
ดู
<?="<a title=\"View File\" href=\"?act=view&file=$value_en\"><view></a>"?>
| ดาวน์โหลด
<?
if ($file_del_allow == 1)
{
echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\"><dl></a>";
}
else
{
echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\"><download></a>";
}
if ($file_del_allow == 1)
{
echo" | ลบ <a title=\"Delete file\" href=\"javascript:;\" onClick=\"cf=confirm('คุณแน่ใจนะครับ ว่าจะลบ file นี้?');if (cf)window.location='?act=del&file=$value_en'; return false;\"><delete></a>";
}
else
{
echo" ";
}
?>
</font></td>
</tr>
<?
}
else
{
echo"<br>";
}
}
?>
</table>
</center>
<?
}
}
elseif (($_GET[act]=="view")&&$_GET[file])
{
$value_de = base64_decode($_GET[file]);
echo"<script language=\"javascript\">\nViewPopup = window.open(\"$dir_store/$value_de\", \"fum_viewfile\", \"toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,location=no,width=640,height=480\")\nViewPopup.document.bgColor=\"#F7F7F7\"\nViewPopup.document.close()\n</script>";
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">file opened!</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a><br><br><br>If the file did not display, you must <b>disable</b> your popup manager, or enable javascript in your browser.";
}
elseif (($_GET[act]=="del")&&$_GET[file])
{
$value_de = base64_decode($_GET[file]);
@unlink($dir_store."/$value_de");
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">file has been deleted!</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
if ($_GET[act]=="delall")
{
$handle = opendir($dir_store);
while($file=readdir($handle))
if (($file != ".")&&($file != ".."))
@unlink($dir_store."/".$file);
closedir($handle);
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">all files have been deleted!</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
}
else
{
echo"<br><br>";
$uploadpath=$dir_store."/";
$source=$_FILES[fileupload][tmp_name];
$fileupload_name=$_FILES[fileupload][name];
$weight=$_FILES[fileupload][size];
for($i=0;$i<count($file_ext_allow);$i++)
{
if (getlast($fileupload_name)!=$file_ext_allow[$i])
$test.="~~";
}
$exp=explode("~~",$test);
if (count($exp)==(count($file_ext_allow)+1))
{
echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">ERROR: your file type is not allowed (".getlast($fileupload_name).")</font>, or you didn't specify a file to upload.</b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
else
{
if ($weight>$file_size_ind)
{
echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">ERROR: please get the file size less than ".$file_size_ind." BYTES (".round(($file_size_ind/1024),2)." KB)</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
else
{
foreach($_FILES[fileupload] as $key=>$value)
{
echo"<font color=\"#3399FF\">$key</font> : $value <br>";
}
echo "<br>";
$dest = '';
if (($source != 'none') && ($source != '' ))
{
$dest=$uploadpath.$fileupload_name;
if ($dest != '')
{
if (file_exists($uploadpath.$fileupload_name))
{
echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">ERROR: that file has already been uploaded before, please choose another file</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
else
{
if (copy($source,$dest))
{
if ($_POST[rename])
{
$_POST[rename]=replace($_POST[rename]);
$exfile=explode(".",$fileupload_name);
if (@rename("$dir_store/$fileupload_name","$dir_store/$_POST[rename].".getlast($fileupload_name)))
{
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">file has been renamed to $_POST[rename].".getlast($fileupload_name)."!</font></b></font><br>";
}
}
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">file has been uploaded!</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
else
{
echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\"> <b><font size=\"2\">ERROR: cannot upload, please chmod the dir to 777</font></b><br>ป<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
}
}
}
}
}
}
}
#/# end of main script, start authentication code IF user not logged in IF $auth_ReqPass is enabled
}
else
{
echo("<p><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\"> Authentication error</p>" .
"<p><a href='$_SERVER[PHP_SELF]?logout=1'>Delete cookies and login again<a></p>");
}
}
else
{
if (!isset($login) || isset($relogin)) {
?>
<font size="3"><b><i><? echo ($title) ? ($title) : ("File Upload Manager"); ?></i>
</b></font><br>
<br>
<table class="table_auth">
<tr>
<td><center>
<font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
กรุณากรอก username และ password <br>
ระบบ จะเปิด cookies enabled ใน IE ให้ท่านอัตโนมัติ </font></center></td>
</tr>
</table>
<form action="<?=$_SERVER[PHP_SELF]?>?login=1" method="POST">
<p><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"> Username:
<input type="text" name="auth_formUser" size="20">
<br>
Password:
<input type="password" name="auth_formPass" size="20">
</font>
<p><input type="submit" name="submit" class="button" value="Log-In"></p>
</form></center>
<?
}
elseif (isset($login))
{
echo("<p>$auth_msg</p>" . "<p>กำลังจะเปลี่ยนหน้าเว็ปไซต์ ภายใน 2 วินาที!</p>");
}
}
?>
</body>
</html>
<!-- Copyright (c) 2003 thepeak. Get your own copy of this free PHP script from www.mtnpeak.net -->