2009. 2. 26. 14:57
오랜만에 업그레이드 버전을 내놓습니다.
이 웹하드 이름은 mywebhard 입니다. 
이젠 어느정도 쓸만해 진거 같습니다. 그러나 역시 디자인은 패스~~~ ^^;;


사용방법
1. 원하는 디렉토리안에 해당 소스를 복사한다.
2. fileroot를 쓰기읽기 권한을 준다.
3. config디렉토리 안에 createdb.sql 파일을 실행한다.
4. config디렉토리의 config.php에 자신의 mysql서버에 맞게 DB설정을 수정한다.
5. admin/1111 로그인할수 있다.


이번 v0.6 에서 추가/변경사항
1. 회원관리기능 추가
2. 대용량파일 업로드시 스크립트 오류 수정
3. 디렉토리 트리 ajax로 바꿈
4. 디스크 용량체크


다음버전에 추가사항
1. 업로드 용량제한
2. 회원별 디렉토리 공유기능


Posted by 굿데이
2009. 2. 3. 10:49
개발이 쉽지가 않아서 미완성 소스를 공개합니다.

시간이 부족해서 OTL

버전은 0.5  입니다.

정식버전 1.0이 될때까지는 꾸준히 개발할 생각입니다.

이소스는 완전 무료이며 무한정 배포 가능합니다. ^^;;
(쓰실분이나 있으시려나...)

이웹하드 프로그램은 DNS-323에 사용하려 개발했습니다.

알고 계신분은 아시겠지만 이장비 성능이 좋지 않아서 성능에 촛점을 맞추어 개발하고 있습니다.


사용환경
OS: LINUX, Unix 계열 UTF-8환경

사용방법
1. 원하는 곳에 압축을 풀어놓습니다.
2. fileroot 디렉토리에 쓰기읽기 기능을 줍니다.

이버전은 크게 세가지 기능이 미흡하거나 구현이 안되어 있습니다.
1. 회원관리 기능이 없습니다.
2. 파일 업로드시 일정 시간마다 스크립트 경고창이 뜹니다.
3. 디자인이 전혀 되어 있지 않습니다. 알아서 디자인 입혀 쓰셔야 합니다.
(앞으로도 디자인은 크게 신경 안쓰려고 합니다.)

앞으로 구현할 기능
1. 회원가입 및 회원관리(MySQL 사용)
2. 파일업로드 컴포넌트 수정(또는 새로개발)
3. 파일다운로드 컴포넌트(이어받기 가능)
4. 사용자별 디렉토리 공유
5. 썸네일 기능

Posted by 굿데이
2009. 1. 22. 18:40

<?
    /***************************************************************
    프로그램명    : filedownload_zip.php
    설명            : 파일 여러개 zip 파일로 묶어서 받기
    작성일자    : 2005-10-06 오후 1:58
    작성자 : 윤영식
    ***************************************************************/

    // 에러 메시지 뿌리고 history.back()
    function error($msg) {
        echo "<script language=\"javascript\">\r\n";
        echo "    alert(\"".$msg."\");\r\n";
        echo "    history.back();\r\n";
        echo "</script>";
        exit();
    }

    // 디렉토리 통째로 삭제하기....
    function rm($fileglob) {
       if (is_string($fileglob)) {
           if (is_file($fileglob)) {
               return unlink($fileglob);
           } else if (is_dir($fileglob)) {
               $ok = rm("$fileglob/*");
               if (! $ok) {
                   return false;
               }
               return rmdir($fileglob);
           } else {
               $matching = glob($fileglob);
               if ($matching === false) {
                   trigger_error(sprintf('No files match supplied glob %s', $fileglob), E_USER_WARNING);
                   return false;
               }      
               $rcs = array_map('rm', $matching);
               if (in_array(false, $rcs)) {
                   return false;
               }
           }      
       } else if (is_array($fileglob)) {
           $rcs = array_map('rm', $fileglob);
           if (in_array(false, $rcs)) {
               return false;
           }
       } else {
           trigger_error('Param #1 must be filename or glob pattern, or array of filenames or glob patterns', E_USER_ERROR);
           return false;
       }
       return true;
    }

    // 업로드 파일 디렉토리
    $up_path = "../upload";
    $zip_dir = "../upload/tmp_zip";

    // tmp 디렉토리 만들기 위해서 file_dir 만들기
    $tmp = microtime();
    $tmp2 = explode(" ",$tmp);
    $file_dir = $tmp2[1].sprintf("%03d",(int)($tmp2[0]*1000));
    $tmp=null;
    $tmp2=null;
    
    // tmp 디렉토리
    $tmp_dir = $zip_dir."/".$file_dir;

    // tmp 디렉토리 생성
    if(!mkdir ($tmp_dir, 0700)) {
        error("파일 생성시 에러가 발생했습니다.");
        exit;
    }

    $sql = "SELECT id, filename FROM table";
    $result = mysql_query($sql);
    $i=0;
    while($row = mysql_fetch_assoc($result)) {
        $org_name = "/".$row[file_name];
        $new_name = "/".$id."_".$row[file_name];

        // tmp 디렉토리로 COPY
        @copy($up_path.$org_name,$tmp_dir.$new_name);
        $i++;
    }
    mysql_free_result($result);
    mysql_close();
    
    if (!$i) {
        rm($tmp_dir);
        error("선택된 파일이 없습니다.");
        exit;
    }

    // zip 으로 묶기
    // zip 경로는 서버에서 which zip 을 통해서 알아낸다.
    @exec("/usr/bin/zip ".$tmp_dir."/".$file_dir.".zip ".$tmp_dir."/*");

    // 다운로드 받기
    if( $fp = @fopen( $tmp_dir."/".$file_dir.".zip","r")) {
        Header("Content-type: file/unknown");
        Header("Content-Disposition: attachment; filename=".$file_dir.".zip");
        Header("Content-Description: PHP3 Generated Data");

        while ($data=fread($fp, filesize( $tmp_dir."/".$file_dir.".zip"))){
            print($data);
        }
    } else {
        error("서버에 자료파일이 없습니다.");
    }

    // 임시로 만들어진 모든 데이터 지우기, 단, 사용자가 취소를 누르면 서버상에 임시데이터가 지워지지 않으니 cron 을 통해 하루에 한번씩 지워주면 된다.
    rm($tmp_dir);
    exit;
?>


출처
http://wizard.ncafe.net/wt/?id=all&start=0&no=38&tag=%B4%D9%BF%EE%B7%CE%B5%E5&v_date=&que=

 

Posted by 굿데이
2009. 1. 21. 02:03
9일부터 개발하기 시작했으니까

대략 2주가 다되어 가네요.

어느정도 틀은 만들어졌고, 회원관리와 업, 다운로드 를 추가하면

1차 개발완료를 할수 있을것 같네요.

생각보다 쉽지 않은 웹하드 개발...

미리 개발해 놓으신 다른 개발자들의 소스들을 듬뿍~~

참조해서 만들고 있습니다 ^^;;

설 지나고, 대략 1월 말이나 2월초쯤 1차 개발된 웹하드 공개합니다.

ㅠㅠ 회사에서 눈치보며 개발하느라 생각보다 쉽지 않은...

아참~~ 그리고 웹하드 간단하게 나마 디자인 입혀 주실분~~

디자인 입혀주시는 분에게는 이 웹하드를 무제한 무료로 사용할수 있는 사용권과

앞으로 버전업될 모든 소스를 무료로 사용할수 있는 권한을 드립니다 ^^;;

그럼... 누군가 참여해 주시길 바라며...
Posted by 굿데이
2009. 1. 15. 13:40

/*

제작자이름 : navyism
제작자메일 : navyism@chol.com
관련사이트 : http://navyism.com

디렉토리 트리구조를 탐색기형태로 가져오기

*/

<?
$start = "./";    //시작위치
$limit = 50;    //폴더당 최대서브폴더

function get_tree($start,$depth=0,$root=0)
{
global $limit;

$dh=@opendir($start);

    for($i=0;$i<$depth;$i++)
    {
    $block.="<img src=blank.gif align=absmiddle border=0>";
    }

    unset($buff);

        if($depth)
        {
        $position="absolute";
        $visibility="hidden";
        }
        else
        {
        $position="";
        $visibility="visible";
        }


    while($dir=@readdir($dh))
    {
        if($dir=="." || $dir=="..")
        {
        continue;
        }

        if(!$dh2=@opendir("$start/$dir"))
        {
        continue;
        }
    
    $buff[]=$dir;    
    @closedir($dh2);
    }

    @sort($buff);

        if($i>=$limit)
        {
        $buff[$i]="more.....";
        }

    for($i=0;$i<sizeof($buff);$i++)
    {    
    echo "<div open=0
    style='height:17;position:$position;visibility:$visibility' 
    id='tree_${root}_${i}'>".$block." <a onfocus=this.blur() 
    href=\"javascript:show_div('${root}_${i}')\"><img 
    name='button_${root}_${i}' src=button+.gif align=absmiddle border=0></a> <img 
    name='folder_${root}_${i}' src=folder_close.gif align=absmiddle border=0> <input
    type=checkbox name='chk_${root}_${i}' onclick=flagging('${root}_${i}',this.checked)> <a onfocus=this.blur() 
    href=\"javascript:show_div('${root}_${i}')\"><font id='font_${root}_${i}' howmany=0>$buff[$i]</font></a><span id='span_${root}_${i}'></span></div>\n";
    
        if($i>=$limit)
        {
        break;
        }

    get_tree("$start/$buff[$i]",$depth+1,$root."_".$i);
    }

@closedir($dh);
}
?>
<html>
<body>

<style>
A:link    {
    color:#000000;
    text-decoration: none;
}
A:visited {
    color:#000000;
    text-decoration: none;
}
A:active  {
    color:#000000;
    text-decoration: none;
}
A:hover  {
    color:#0000cc;
    text-decoration: underline;
}

body
{    
font-size:9pt;
font-family:tahoma,굴림;
line-height:145%;
}
</style>

<script language=javascript>
function ereg(exp,str) 

exp=new RegExp(exp); 
exp=str.match(exp); 
return exp; 

function flagging(id,chk)
{
this_chk=id.split("_");
temp_chk="0";

    for(var i=1;i<this_chk.length;i++)
    {
    temp_chk+="_"+this_chk[i];
    span_chk=eval("span_"+temp_chk);
    font_chk=eval("font_"+temp_chk);


        if(chk)
        {
        font_chk.howmany++;
        }
        else
        {
        font_chk.howmany--;
        }

        if(font_chk.howmany)
        {
        font_chk.style.color="#0000cc";
        span_chk.innerHTML="<img src=flag.gif align=absmiddle>";
        }
        else
        {
        font_chk.style.color="#000000";
        span_chk.innerHTML="";
        }
    }    
}
function show_div(id)
{
this_div=eval("tree_"+id);
this_btn=eval("document.button_"+id);
this_fld=eval("document.folder_"+id);

this_haveson=0;

    if(this_div.open==0)
    {
    this_div.open=1;

        for(var i=0;i<<?=$limit?>;i++)
        {
            try
            {
            chld_div=eval("tree_"+id+"_"+i);
            chld_div.style.position='';
            chld_div.style.visibility='visible';
            this_haveson=1;
            }
            catch(Exception)
            {
            break;
            }
        }

        if(this_haveson)
        {
        this_btn.src='button-.gif';
        this_fld.src='folder_open.gif';
        }
        else
        {
        this_btn.src='blank.gif';
        this_fld.src='folder_close.gif';
        }
    }
    else
    {
    close_all(id);
    }
}

function close_all(id)
{
this_div=eval("tree_"+id);
this_div.open=0;

this_btn=eval("document.button_"+id);

    if(!ereg("blank\.gif$",this_btn.src))
    {
    this_btn.src='button+.gif';
    }

this_fld=eval("document.folder_"+id);
this_fld.src='folder_close.gif';

    for(var i=0;i<<?=$limit?>;i++)
    {
        try
        {
        chld_div=eval("tree_"+id+"_"+i);
        is_ok=1;
        }
        catch(Exception)
        {
        is_ok=0;
        }

        if(!is_ok)
        {
        break;
        }
        else
        {
        chld_div.style.position='absolute';
        chld_div.style.visibility='hidden';

        chld_btn=eval("document.button_"+id+"_"+i);

            if(!ereg("blank\.gif$",chld_btn.src))
            {
            chld_btn.src='button+.gif';
            }

        chld_fld=eval("document.folder_"+id+"_"+i);
        chld_fld.src='folder_close.gif';
        close_all(id+"_"+i);
        }
    }
}
</script>


<form name=reg>
<?
get_tree($start);
?>
</form>

<span id=res></span>
</body>
</html>

미리보기
http://libphp.com/explorer

이미지파일 (압축을 풀어서 소스와 같은 폴더에 위치시키세요)




출처
http://libphp.com/

Posted by 굿데이
2009. 1. 6. 15:06

처음 ffp을 설치하고, php와 mysql 서비스를 올리면 gd라이브러리를 사용할수 없습니다.

다음 명령어로 확인가능
php -i | grep GD

PHP Warning:  PHP Startup: Unable to load dynamic library '/ffp/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - File not found in Unknown on line 0

위 메시지를 보시면 알겠지만 gd라이브러리를 사용할수 없다고 나옵니다.

이런 메시지를 만나면 다음 2가지 패키지를 설치한 후에 웹서버를 재시작 해주시면 됩니다.
libjpeg-6b-1.tgz, libpng-1.2.29-1.tgz

다음과 같이 패키지를 설치해 주시면 됩니다.
mkdir /mnt/HD-a2/imsi
cd /mnt/HD_a2/imsi

wget http://www.inreto.de/dns323/fun-plug/0.5/packages/libpng-1.2.29-1.tgz
funpkg -i libpng-1.2.29-1.tgz

wget http://www.inreto.de/dns323/fun-plug/0.5/packages/libjpeg-6b-1.tgz
funpkg -i libjpeg-6b-1.tgz

/ffp/start/lighttpd.sh restart

자 이렇게 해서 또 한가지 문제를 풀어나가는군요.

원본서버에서 받지 못할경우를 대비해서 패키지를 첨부파일로 올려놓겠습니다.
Posted by 굿데이
2009. 1. 6. 10:14
DNS-323 장비에 lighttp 웹서버를 올렸다면

이제 php를 사용가능하게 만들어 줘야 제대로 된 웹서버라 할수 있지요.

적당한 위치에 임시 디렉토리를 만듭니다.
mnt/HD_a2/imsi 라는 디렉토리를 만들도록 하지요.

mkdir mnt/HD_a2/imsi

cd mnt/HD_a2/imsi

자~ 이제 설치에 필요한 파일들을 받을 차례 입니다.

wget http://81.216.140.39/dns-323/mysql_and_php/mysql-5.0.67-3.tgz
wget http://81.216.140.39/dns-323/mysql_and_php/php-5.2.6-mysql50-1.tgz

funpkg -i mysql-5.*.tgz
funpkg -i php-5.2.6-mysql5*.tgz

자.. 이제 설치까지 완료가 되었네요.


이제 설정 파일을 수정합니다.

cp /ffp/etc/examples/my.cnf /ffp/etc/.

wget http://81.216.140.39/dns-323/mysql_and_php/php.ini

cp /mnt/HD_a2/imsi/php.ini /ffp/etc/.

설정 파일을 /ffp/etc 디렉토리로 복사했습니다.

이제 ffp/etc 디렉토리로 이동해서 간단한 수정만 하면 됩니다.

php.ini파일을 열어서
extension=gd.so
extension=mysql.so
extension=pdo.so
extension=pdo_mysql.so

위부분의 주석을 풀어주시면 됩니다.

이제 마지막으로 새 데이터베이스를 생성합니다.
mysql_install_db


이제 끝~~ 이것으로 php와 mysql 세팅이 완료 되었습니다.

^^

ps, 필요한 파일은 첨부했으니 필요하면 여기서 받으세요.
Posted by 굿데이