그누용 웹하드... > 그누4 스킨

그누4 스킨

스킨의 저작권은 해당 스킨 제작자님께 있으며, 그누보드의 저작권과 다를 수 있습니다.
스킨 다운로드시 좋아요와 감사의 코멘트를 남기시면 제작자에게 큰 힘이됩니다. ^^y
그누보드와 관련이 있지만 스킨과 빌더가 아니면 플러그인 게시판에 올려주세요.

그누용 웹하드... 정보

기타 그누용 웹하드...

첨부파일

hard.zip (100.9K) 320회 다운로드 2006-10-19 23:01:49

본문

시험기간중 굴러다니는 제로보드 웹하드를 개조해 만들었습니다.
상업용으로 사용가능하구요 재배포도 가능 하다더군요
마음놓고 사용하세요...

맞다 윈도우 xp 파트2 는 사용하시려면 이곳을 참조 하세요.
http://cycity.new21.net/cycityweb/

테스트 페이지는
http://cycity.new21.net/bbs/webhard
이구요 .가입하셔야할거에요..
생각은 안나지만 관리자용일수도 있어요 ㅋㅋ
추천
4
  • 복사

댓글 전체

이건 예전에 명인소프트 라는 곳에서 만든겁니다. CAB 파일을 설치 하는게 껄적지근 하지만
제가 예전에 테스트삼아 연동하여 사용해본적이 있는데 사용해보면 상당히 도움이 되는 자료입니다.

아래의 코드는 제가 이전에 연동한 웹하드/ index.php 코드를 올리므로 참고하여 사용하세요.ㅋ
주석으로 달아둔 설명을 자세히 참고하여 환경에 맞게 설정하시면 됩니다.


웹하드/index.php 의 그누보드4와 연동된 코드이며
현재 경로는 g4/웹하드/ 로 되어 있습니다.

<?
$g4_path = ".."; // common.php 의 상대 경로
include_once("$g4_path/common.php");
$g4[title] = "아바타스쿨 웹하드";
include_once("$g4[path]/_head.php"); // 헤더연결

if ($member[mb_level] <= 2)  // 웹하드를 사용할수 있는 회원레벨 (현재 레벨3부터 입장가능)
 {
    $msg = "죄송합니다. 접근할 권한이 없습니다.\\n\\n관리자에게 문의후 이용해 보십시오.";
    alert($msg, "$g4[path]");
  exit;
  }

// 웹하드에서 사용할 넘겨줄 회원 아이디를 변환하며 수정불가
$uid = $member[mb_id];

?>
<table width=600 height=500 cellspacing=0 cellpadding=0 border=0>
<tr>
<td>
</td>
</tr>
<tr>
<td bgcolor=#D6D3CE height=30>
<table width=100% height=100% cellspacing=0 cellpadding=1 border=1>
<tr>
<td width=48% height=30 align=center>
 <img src='img/mypc.bmp' border=0 align=absmiddle><font face=Tahoma>  <b><? echo $uid;?> 고객님 컴퓨터</b>
</td>
<td align=center>
 <img src='img/webd.bmp' border=0 align=absmiddle><font face=Tahoma>  <b><? echo $uid;?> 고객님 웹하드</b>
</td>

</tr>
</table>
</td>
</tr>
<tr>
<td height=1 bgcolor=#000000>
</td>
</tr>
<tr>
<td height=500 width=600 bgcolor=#EEEEEE>
<table width=100% height=100% cellspacing=1 cellpadding=0 border=1>
<tr>
<td bgcolor=#eeeeee>
 <OBJECT width=750 height=500 ID="CSFManager" CLASSID="CLSID:D4A249DE-A617-11D5-A113-0060082725C0" CODEBASE="fileman.cab#Version=1,1,1,1">
<!--
테스트할 서버의 IP를 기재 하며 대부분 그냥두면됩니다.
-->
<PARAM NAME='Host' Value='<?=$_SERVER[HTTP_HOST]?>'>

<!--
테스트할 서버의 Port를 기재
80 Port일 경우 주석처리...
-->
<PARAM NAME='Port' Value='<?=$SERVER_PORT?>'>

<?
// uid로 회원의 id가 전달되어져 오면 루트디렉토리에 대한 접근은 안되고
// 루트디렉토리 + 회원ID명으로 생성된 디렉토리에 대한 접근만 가능....
if($uid!=""){
// 전체 하드의 폴더를 사용할수 있는 회원레벨을 지정합니다.
// 9라고 넣어면 레벨9와 10은 타회원의 디렉터리를 마음대로 들어갑니다.
if ($member[mb_level] >= 9)  {
$smembergrb ="";
} else {
// 일반 회원은 본인의 아이디로 자동 생성된 디렉토리만 접근이 가능합니다.
$smembergrb =$member[mb_id];
}
?>
<PARAM NAME='UID' Value='<? echo $smembergrb;?>'>
<?
}
?>

<!--
파일메니져 컨트롤의 제어를 전담하는 스크립트 파일의 경로를 적는 부분입니다.
아래와 같다면...
<?=str_replace("./","",dirname($_SERVER[PHP_SELF]))?>/fmanager.php 로 접근한다는 내용입니다.
-->
<PARAM NAME='PostAcceptor' Value='<?=str_replace("./","",dirname($_SERVER[PHP_SELF]))?>/fmanager.php'>
</OBJECT>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
include_once("$g4[path]/_tail.php");
?>
위소스중 아래의 코드를 유심히 살펴 보십시요. 이부분이 상당히 맘에드는 부분입니다.ㅋ^^;

<?
// uid로 회원의 id가 전달되어져 오면 루트디렉토리에 대한 접근은 안되고
// 루트디렉토리 + 회원ID명으로 생성된 디렉토리에 대한 접근만 가능....
if($uid!=""){
// 전체 하드의 폴더를 사용할수 있는 회원레벨을 지정합니다.
// 9라고 넣어면 레벨9와 10은 타회원의 디렉터리를 마음대로 들어갑니다.
if ($member[mb_level] >= 9)  {
$smembergrb ="";
} else {
// 일반 회원은 본인의 아이디로 자동 생성된 디렉토리만 접근이 가능합니다.
$smembergrb =$member[mb_id];
}
?>
회원의 아이디로 폴더가 자동 생성이 되므로 폴더 보안이 취약한 서버환경이라면
폴더가 생성이 될때에 index 파일을 생성하도록 해주면 되겠네요.
순좋아님
원래는 업로드 제한이 없습니다.
하지만 호스팅회사에서 10M이상 업로드 하지못하게 하고 있어서 10M가 이상올라가지않는것입니다.
회원의 아이디로 폴더가 자동 생성이 되므로 폴더 보안이 취약한 서버환경이라면
폴더가 생성이 될때에 index 파일을 생성하도록 해주면 되겠네요. 회원의 아이디로 폴더가 자동 생성이 되므로 폴더 보안이 취약한 서버환경이라면
폴더가 생성이 될때에 index 파일을 생성하도록 해주면 되겠네요.

위와 같이 index 파일을 생성하도록 하려면 어떻게 하면 되나요..
새색시님
웹하드/fmanager.php 의 파일을 백업해둔후
아래의 코드로 교체해 보세요.
디렉터리 생성할때마다 index.php 를 자동생성 하도록 수정해 두었습니다.^^

수정된 웹하드/fmanager.php 의 소스전체
<?
function GetFileSize($size){
if($size<1024) return (intval($size) . " Bytes");
else if($size >1024 && $size< 1024 *1024)  {
return sprintf("%0.1f KB",$size / 1024);
}else return sprintf("%0.2f MB",$size / (1024*1024));

}

function isHangulString($name){

for($i = 0; $i < strlen($name); $i++) {
  if(ord($name[$i]) >= 0x80) {
return 1;
exit;
  }
}

return 0;
}

function GetFileExt($sFileName){

if(strpos($sFileName,".")==false) return "";


$aTemp=explode(".",strtolower($sFileName));

    $iTemp1=count($aTemp)-1;

    return trim($aTemp[$iTemp1]);

}


function DeleteDir($sPath){


$sTempDir=$sPath;

if(is_dir($sTempDir)){

$hDir=opendir($sTempDir);

while($sFileName=readdir($hDir)){

if($sFileName!="." and $sFileName!=".."){

if(is_dir($sTempDir."/".$sFileName)){

DeleteDir($sTempDir."/".$sFileName);

}else{

unlink($sTempDir."/".$sFileName);

}

clearstatcache();
}

}//end of while

closedir($hDir);

rmdir($sPath);


}else{
unlink($sTempDir);
}


}

$SEP_CHAR="*";


$WEBDISK_ROOT_DIR=realpath("./")."/hard/";

$ROOT_DIR=$WEBDISK_ROOT_DIR;


if(trim($uid)!="")$ROOT_DIR.=$uid."/";


if(!(is_dir($ROOT_DIR) )){

mkdir($ROOT_DIR, 0777 );
chmod($ROOT_DIR, 0777 );
  // 디렉토리에 있는 파일의 목록을 보이지 않게 한다.
    $file = $ROOT_DIR . "/index.php";
    $f = @fopen($file, "w");
    @fwrite($f, "");
    @fclose($f);
    @chmod($file, 0606);

}//end of if


if($mode=="")$mode="list";

$mode=strtoupper($mode);


switch($mode){

case "LIST":

$sList="";

if($source=="/")$source="";

$AcessDir=$ROOT_DIR.$source;


$hDir=opendir($AcessDir);

while($sFileName=readdir($hDir)){

$sTempDir=$AcessDir.$sFileName;


if(is_dir($sTempDir)){

$iFileDate=filemtime($sTempDir);

$sFileDate=date("Y-m-d h:i:s",$iFileDate);

if(trim($sFileName)!="." and trim($sFileName)!=".."){
$sList.= $sFileName."/".$SEP_CHAR.$SEP_CHAR.$sFileDate.$SEP_CHAR;
}

}else{

$sFileSize=GetFileSize(filesize($sTempDir));

$iFileDate=filemtime($sTempDir);

$sFileDate=date("Y-m-d h:i:s",$iFileDate);


$sList.= $sFileName.$SEP_CHAR.$sFileSize.$SEP_CHAR.$sFileDate.$SEP_CHAR;

}

clearstatcache();

}//end of while

echo $sList;

clearstatcache();

closedir($hDir);


break;//end of LIST

case "UPLOAD":


if($base=="/")$base="";
if($dir=="/")$dir="";

$AcessDir=$ROOT_DIR.$base;


if($dir!=""){

$sTempDir=$AcessDir;

$aTemp=explode("/",strtolower($dir));

for($i=0;$i<=count($aTemp)-1;$i++){

if(trim($aTemp[$i])!=""){

$sTempDir.=$aTemp[$i];

if(!(is_dir($sTempDir) )){

mkdir($sTempDir, 0777 );
chmod($sTempDir, 0777 );
    // 디렉토리에 있는 파일의 목록을 보이지 않게 한다.
    $file = $sTempDir . "/index.php";
    $f = @fopen($file, "w");
    @fwrite($f, "");
    @fclose($f);
    @chmod($file, 0606);

}//end of if

$sTempDir.="/";

}//end of if

}//end of for

}//end of if


$varname = "UPLOADFILE";
$varname_name = "UPLOADFILE_name";
$varname_type = "UPLOADFILE_type";
$varname_size = "UPLOADFILE_size";


if($$varname == "" || $$varname == "none"){
break;
}

$$varname=str_replace("\\\\","\\", $$varname);


$sFileName1=basename($$varname_name);
/*
//리눅스 코드 (서버가 한글 파일명과 파일명 사이에 공백을 지원하지 않는 운영체제 일 경우...

//Linux에서는 파일명에 공백문자를 지원하지 않으므로 _(언더바)로 대체한다.
$sFileName1=str_replace(" ","_",basename($$varname_name));

//Linux에서는 한글도 안된다.
if(isHangulString($sFileName1)){

$uid = md5(uniqid(rand()));

$sFileName1=$uid.".".GetFileExt(basename($sFileName1));

}
*/



$sTempDir=$AcessDir.$dir.$sFileName1;

copy($$varname,$sTempDir);


break;//end of UPLOAD

case "DOWNLOAD":

if($source=="/")$source="";

$AcessDir=$ROOT_DIR.$source;

$sTempDir=$AcessDir.$filename;

if(is_file($sTempDir)){

header("Content-Type: application/octet-stream;");
Header("Content-Transfer-Encoding: binary");
header("Content-disposition: inline; filename=\"$filename\"");
header("Content-Length: ".filesize($sTempDir));
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Pragma: no-cache");

echo readfile($sTempDir);
}

break;//end of DOWNLOAD



case "DELETE":

//mode, source, filename : Query

if($source=="/")$source="";

$AcessDir=$ROOT_DIR.$source;

$sTempDir=$AcessDir.$filename;

DeleteDir($sTempDir);


break;//end of DELETE

case "FILESIZE":
 
if($source=="/")$source="";

$AcessDir=$ROOT_DIR.$source;

$sTempDir=$AcessDir.$filename;

$i=filesize($sTempDir);

if($i<1)$i=0;

echo $i;



break;//


case "MKDIR":

//mode, base, dir : Query

if($base=="/")$base="";
if($dir=="/")$dir="";

$AcessDir=$ROOT_DIR.$base;

if($dir!=""){

$sTempDir=$AcessDir;

$aTemp=explode("/",strtolower($dir));

for($i=0;$i<=count($aTemp)-1;$i++){

if(trim($aTemp[$i])!=""){

$sTempDir.=$aTemp[$i];


if(!(is_dir($sTempDir) )){

mkdir($sTempDir, 0777 );
chmod($sTempDir, 0777 );
    // 디렉토리에 있는 파일의 목록을 보이지 않게 한다.
    $file = $sTempDir . "/index.php";
    $f = @fopen($file, "w");
    @fwrite($f, "");
    @fclose($f);
    @chmod($file, 0606);

}//end of if

$sTempDir.="/";

}//end of if

}//end of for

}//end of if

break;//end of MKDIR

}//end of switch

?>
헐랭이님 죄송합니다// 제가 실수를 했습니다..

위 내용을 복사해서 붙여더니 왠걸 똑같은 것이 두번 붙여넣기 되네요..

한번 지우니 잘되네요....

감사합니다
네에^^ 잘되긴 하지만 회원들이 인덱스 파일을 지워버리면 ㅎㅎ^^헛일이죠.
시간이나면 파일이 있는지 검사후 없다면 자동생성하도록 해보게습니다.
그런데 이자료가 제코멘트 때문에 너무 지저분해 졌네요.ㅠㅠ

제 코멘트를 전부 종합해서 새로 등록을 해야만 다른분들이 햇갈리지 않겠습니다.
너무너무 좋은자료 감사합니다.
저는 700M정도를 올리고 내려보았는데 잘 됩니다
php.ini를 수정하니 가능하네요.(Windows는 c:\windows\php.ini)
upload_max_filesize, post_max_size를 수정하니 큰사이즈도 가동이 돼구요.

그런데 큰사이즈를 옮기다 보면 UPload 약30%에 도달하면 처음으로 다시 가고, Download를 하면 5%에서 멈춰 있네요.
그렇지만 파일은 정상적으로 카피는 됍니다.
이런 문제도 해결이 돼면 더 훌륭한 프로그램이 돼겠네요
© SIRSOFT
현재 페이지 제일 처음으로