##-------------------------------------------------------------------##
## ÇÁ·Î±×·¥¸í : gmEditor v1.0
##-------------------------------------------------------------------##
## ÃÖÃÊ °³¹ß ¿Ï·áÀÏ : 2006-01-05
## °³¹ß»ç ¹× ÀúÀÛ±ÇÀÚ : PHP¸ó½ºÅÍ
## À¥»çÀÌÆ® : http://www.phpmonster.co.kr
## °³ ¹ß ÀÚ : ¹Ú¿äÇÑ (misnam@gmail.com)
##-------------------------------------------------------------------##
## Ä«ÇǶóÀÌÆ®
##-------------------------------------------------------------------##
## º» ÇÁ·Î±×·¥Àº ¹«·á ÇÁ·Î±×·¥À¸·Î ¹èÆ÷µË´Ï´Ù.
## gmEditor´Â GNU General Public License(GPL) ¸¦ µû¸¨´Ï´Ù.
## º¸´Ù ÀÚ¼¼ÇÑ ³»¿ëÀº LICENSE¸¦ ÂüÁ¶ÇϽʽÿä.
## Âü°í: http://korea.gnu.org/people/chsong/copyleft/gpl.ko.html
##-------------------------------------------------------------------##
## °³¹ßȯ°æ
##-------------------------------------------------------------------##
## Áö¿ø OS : IE 5 ÀÌ»ó
## °³¹ßȯ°æ : Win XP
## IE ¿ÜÀÇ È¯°æ¿¡¼´Â ¿Ã¹Ù·Î ÀÛµ¿ÇÏÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù.
##-------------------------------------------------------------------##
// À̹ÌÁö°¡ ÀúÀåµÇ´Â °æ·Î
$dir = "./uploaded";
// ¹Ìµð¾îÆÄÀÏ Ã¼Å©È®ÀåÀÚ
$old = array(
"mid",
"rmi",
"midi",
"asx",
"wax",
"wax",
"m3u",
"mvx",
"mov",
"qt",
"asf",
"wm",
"wma",
"wmv",
"mpeg",
"mpg",
"m1v",
"mp2",
"mp3",
"avi",
"wmv",
"wav",
"snd",
"au",
"aif",
"aifc",
"aiff",
"rm",
"ra",
"ram",
"swf"
);
/*
************************* ¸Þ¼¼Áö¸¦ º¸³»°í µÚ·Î À̵¿ *************************
*/
function goBack($message){
echo"
";
exit;
} // end func
/*
************************* °°Àº È£½ºÆ®¿¡¼ ³Ñ¾î¿Ô´ÂÁö üũ *************************
*/
function referer(){
$referer = explode('/',preg_replace("/http:\/\//",'',$_SERVER[HTTP_REFERER]));
if ($referer[0] <> $_SERVER[HTTP_HOST]) {
echo"
";
exit;
}
} // end func
referer();
if($_SERVER['REQUEST_METHOD'] <> 'POST') {
goBack('Á¤»óÀûÀÎ ¹æ¹ýÀ¸·Î Á¢±ÙÇϽʽÿä.')
;
}
// ¾÷·Îµå µð·ºÅ丮°¡ ÀÖ´ÂÁö üũ
if (!@is_dir($dir)) {
goBack('¾÷·Îµå Æú´õ°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.');
}
// ¾÷·Îµå Æú´õÀÇ ÆÛ¹Ì¼Ç 707ÀÎÁö üũ
if(substr(decoct(fileperms($dir)),2) <> 707){
goBack("¾÷·Îµå Æú´õÀÇ ÆÛ¹Ì¼Ç 707·Î º¯°æÇØ ÁÖ¼¼¿ä.");
}
/***************************************************************************************
************************* ÆÄÀÏ Àü¼Û
****************************************************************************************/
if(is_uploaded_file($_FILES['upfile']['tmp_name']) && ($_FILES['upfile']['size'] > 0)) {
$upfile = time();
// À̹ÌÁöÀ̸é..
if($_POST['type']==1){
$tmp_file = @getimagesize($_FILES['upfile']['tmp_name'],&$type);
$upfile .= '.img.gm';
// (1) = gif, (2) = jpg, (3) = png, (4) = swf, (5) = psd, (6) = bmp
if(($tmp_file[2] != 1) && ($tmp_file[2] != 2) && ($tmp_file[2] != 6)) {
goBack('GIF,JPG,BMP È®ÀåÀÚ°¡ ¾÷·Îµå °¡´ÉÇÕ´Ï´Ù.');
}
}
// ¹Ìµð¾îÀ̸é..
else{
$ext = substr($_FILES['upfile']['name'],strrpos(stripslashes($_FILES['upfile']['name']),'.')+1);
$media_chk = '';
foreach($old as $key => $value){
if($value == $ext){
$media_chk = 1;
break;
}
}
$upfile .= '.midi.'.$ext;
if($media_chk <> 1) goBack('¹Ìµð¾îÆÄÀϸ¸ ¾÷·ÎµåÇØ ÁÖ¼¼¿ä.');
} // end if
if(!@move_uploaded_file($_FILES['upfile']['tmp_name'],$dir.'/'.$upfile)) {
@unlink($dir.'/'.$upfile);
goBack('ÆÄÀÏÀ» º¹»çÇϴµ¥ ½ÇÆÐÇÏ¿´½À´Ï´Ù.');
}
@chmod($dir.'/'.$upfile,0606);
} // end if
/***************************************************************************************
************************* ³»¿ëÀ» ¿¡µðÅÍ¿¡ »ðÀÔ
****************************************************************************************/
if(is_file($dir.'/'.$upfile)){
$imgsize = (int)$_POST['imgsize'];
$title = addslashes($_POST['title']);
$alignment = $_POST['alignment'];
$upfile_ok = $dir.'/'.addslashes($upfile);
$file_path = $_POST['url'].'/'.$upfile_ok;
ECHO "\n";
}
else{
ECHO "\n";
}
?>