달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

Linux(CentOS 5.5)에서 시놀리지(Synology DS209)로 스케줄링 백업 받기 입니다.

쉽게 말해서, 운영중인 리눅스 서버에서 NAS 장비로 해당 데이터를 백업합니다.
아래의 예시는 매일 12시에 백업 받는 내용으로써, Crontab 를 이용합니다.


[   Linux에서 설정할 내용.....   ]

vi /etc/rsyncd.conf<엔터>

i 입력

[백업모듈명<예:mybackup>]
path = /home/mybackup
comment = mybackup
uid = root
gid = root
use chroot = yes
read only = yes
hosts allow = 192.168.0.xx<접속허용할NASIP>
max connections = 1
timeout = 60

<ESC>키 입력
:wq<엔터>


vi /etc/xinetd.d/rsync
disable = yes 를   disable = no 로 변경

< vi 안에서 화살표로 y로 이동후 x 3번, i 입력, no 타자 치고 <ESC>키 입력, :wq 엔터 >

vi /etc/inittab
:$<엔터>
o 입력
null::once:/ntg/local/sbin/rsync --daemon 넣고
<ESC>키 입력
:wq<엔터>



killall -15 rsync    <데몬죽이기>
rsync --daemon    <데몬실행>
ps -aux | grep 'rsync'    <데몬확인,  rsync가 있으면 성공>



[ 시놀리지 장비에서 설정할 내용 ]

vi /etc/crontab<엔터>

:$<엔터>
o 입력
0       0       *       *       *       root    /usr/syno/bin/rsync -avzr 192.168.0.xxx::백업모듈명 /volume1/NetBackup/저장할주소 > /volume1/NetBackup/저장할로그파일명.log 2>&1           넣고
<ESC>키 입력
:wq<엔터>

<참고 : 192.168.0.xxx -> 리눅스 서버 주소>


/usr/syno/etc/rc.d/S04crond.sh stop
/usr/syno/etc/rc.d/S04crond.sh start


혹시나... 바로 백업 테스트 하시려면...
/usr/syno/bin/rsync -avzr 192.168.0.xxx::백업모듈명 /volume1/NetBackup/저장할주소



Posted by 새로운시작
|


Over a year ago I walked through an example of creating the basic foundation for a modal window using jQuery.  The goal was simplicity, minimalism, and flexibility to add-on functionality as needed.

As stated at the outset, this post was meant to illustrate a bare bones and simple example of a modal window. If you wanted to extend the functionality for example, it would be quite simple to [...] suit needs.

Last Year’s A Simple Modal Post

The example was well received in feedback from readers, and there was some constructive criticism as well. Equal to the amount of people that appreciated the minimalistic approach were requests from readers to support IE6, forms, and a host of other odds and ends.  Some readers had some useful feedback for features and additions that I purposefully did not include in an effort to keep things basic.

Therefore, I thought there was a nice opportunity to revisit the basic modal window script and make it a bit more comprehensive in an effort to suit the needs and requests of the aforementioned readers.  So before we get into the code, lets outline some things that have changed:

  • Converted for use as a jQuery plugin.
  • Added IE6 compatibility
  • Added Opera compatibility
  • Added ability to fade in and out
  • Added multiple ways of setting parameters
  • Added multiple content types (‘image’ and ‘iframe’)


출처 : http://deseloper.org/read/2009/10/jquery-simple-modal-window/

Posted by 새로운시작
|

* 이 펌웨어는 시놀리지에서 제공하고 있는 정식 펌웨어 입니다. 다운그레이드는 되지 않습니다.


Release Notes of USB Station 2

Version: DSM 3.0-1417

(2010/12/27)

Change log

  1. Multifunction printer is now supported to allow the print/fax/scan functions on their multifunction printer to be shared among family or colleagues over the same network. For the complete list of supported printers, please visit here.
  2. HDD Hibernation is now supported on the external USB HDD.

Limitation & Known Issues

Version: DSM 3.0-1336

(2010/10/05)

Change log

  • N/A. (This is the initial release of USB Station 2)

    Limitation & Known Issues for all versions

    1. On all browsers, single file upload is limited to 2GB for File Station. This is due to browsers' limitation.
    2. On Internet Explorer browser, single file download is limited to 4GB for File Station. This is due to Internet Explorer's limitation.
    3. USB Disk Limitation:
      • FAT32 format: is portable, easy and convenient to use on Windows and Mac OS X. Mac OS 9 does not support FAT32.
      • Native format: is the most reliable format. USB disks with such format can be used among different Synology products. The USB disk must be larger than 1GB.
    4. Multifunction Printer Limitation:
    Posted by 새로운시작
    |

    위의 프로그램은 리눅스(NAS) 장비에서 데이터가 손실되었을 경우, 쉽게 복원할 수 있도록 도와 줍니다.

    시스템이 손실되었다면, 더이상의 손실을 막기 위해 시스템을 안전하게 종료하고,
    하드디스크를 새로운 PC( 위의 프로그램이 설치된 ) 에 추가 장착하여 주십시오.
    ( 절대로 손실된 시스템(또는 NAS)에서 복원하지 않습니다 )

    그 이후 R-Linux를 실행하고 오른쪽 마우스를 눌러 Open Drive Files 를 클릭 합니다.



    만일 데이터(파티션)이 열리지 않는다면, 파일 시스템( 리눅스는 보통 Ext3, 4 )를 못찾기 때문이며, 여기서 이 프로그램은 윈도우(FAT32, NTFS)는 복원할 수 없음에 유의 바랍니다.

    위의 문제점이 발견되면 Scan 을 수행하시면 됩니다.
    정상적으로 수행된다면 아래와 같이 수행 됩니다.




    출처 : http://recovery-review.com/blog/2009/07/top-15-free-data-recovery-tools/

    오른쪽 마우스 버튼을 눌러서, 복원된 파일을 새로운 하드디스크(복원중인 하드디스크 저장 금지)에 복원 하시면 됩니다.

    꼭 소중한 데이터를 복원 하시길 바라겠습니다 ^^


    Posted by 새로운시작
    |

    Syno_UsersGuide_NAServer_krn.pdf
    USBSTATION2 사용 설명서 입니다.



    Posted by 새로운시작
    |




     
    "부족한 점의 수정 또는 사용자가 기능을 업데이트 할 경우 공개를 의무화" 한다는 조건 하 에 소스를 공개 합니다. 

      

    본 소스는 원본에서 출력 부분만 한글화 되었습니다.

     

      

    apc.php 소스는 아래와 같습니다.

     

    <?php
    /*
      +----------------------------------------------------------------------+
      | APC                                                                  |
      +----------------------------------------------------------------------+
      | Copyright (c) 2006 The PHP Group                                     |
      +----------------------------------------------------------------------+
      | This source file is subject to version 3.01 of the PHP license,      |
      | that is bundled with this package in the file LICENSE, and is        |
      | available through the world-wide-web at the following url:           |
      | http://www.php.net/license/3_01.txt                                  |
      | If you did not receive a copy of the PHP license and are unable to   |
      | obtain it through the world-wide-web, please send a note to          |
      | license@php.net so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
      | Authors: Ralf Becker <beckerr@php.net>                               |
      |          Rasmus Lerdorf <rasmus@php.net>                             |
      |          Ilia Alshanetsky <ilia@prohost.org>                         |
      +----------------------------------------------------------------------+
      | Korean:  Newpds - Jeong An-Ryeol <http://www.sdisk.net>              |
      +----------------------------------------------------------------------+

       All other licensing and usage conditions are those of the PHP Group.

     */

    $VERSION='$Id: apc.php,v 3.68 2007/07/22 00:25:48 gopalv Exp $';

    ////////// READ OPTIONAL CONFIGURATION FILE ////////////
    //if (file_exists("apc.conf.php")) include("apc.conf.php");
    ////////////////////////////////////////////////////////

    ////////// BEGIN OF DEFAULT CONFIG AREA ///////////////////////////////////////////////////////////

    defaults('USE_AUTHENTICATION',1);            // Use (internal) authentication - best choice if 
                                                // no other authentication is available
                                                // If set to 0:
                                                //  There will be no further authentication. You 
                                                //  will have to handle this by yourself!
                                                // If set to 1:
                                                //  You need to change ADMIN_PASSWORD to make
                                                //  this work!
    defaults('ADMIN_USERNAME','root');             // Admin Username
    defaults('ADMIN_PASSWORD','');      // Admin Password - CHANGE THIS TO ENABLE!!!

    // (beckerr) I'm using a clear text password here, because I've no good idea how to let 
    //           users generate a md5 or crypt password in a easy way to fill it in above

    //defaults('DATE_FORMAT', "d.m.Y H:i:s");    // German
    defaults('DATE_FORMAT''Y/m/d H:i:s');     // US

    defaults('GRAPH_SIZE',160);                    // Image size

    ////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////


    // "define if not defined"
    function defaults($d,$v) {
        if (!
    defined($d)) define($d,$v); // or just @define(...)
    }

    // rewrite $PHP_SELF to block XSS attacks
    //
    $PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES) : '';
    $time time();
    $host getenv('HOSTNAME');
    if(
    $host) { $host '('.$host.')'; }

    // operation constants
    define('OB_HOST_STATS',1);
    define('OB_SYS_CACHE',2);
    define('OB_USER_CACHE',3);
    define('OB_SYS_CACHE_DIR',4);
    define('OB_VERSION_CHECK',9);

    // check validity of input variables
    $vardom=array(
        
    'OB'    => '/^\d+$/',            // operational mode switch
        
    'CC'    => '/^[01]$/',            // clear cache requested
        
    'DU'    => '/^.*$/',            // Delete User Key
        
    'SH'    => '/^[a-z0-9]+$/',        // shared object description

        
    'IMG'    => '/^[123]$/',            // image to generate
        
    'LO'    => '/^1$/',                // login requested

        
    'COUNT'    => '/^\d+$/',            // number of line displayed in list
        
    'SCOPE'    => '/^[AD]$/',            // list view scope
        
    'SORT1'    => '/^[AHSMCDTZ]$/',    // first sort key
        
    'SORT2'    => '/^[DA]$/',            // second sort key
        
    'AGGR'    => '/^\d+$/',            // aggregation by dir level
        
    'SEARCH'    => '~^[a-zA-Z0-1/_.-]*$~'            // aggregation by dir level
    );

    // default cache mode
    $cache_mode='opcode';

    // cache scope
    $scope_list=array(
        
    'A' => 'cache_list',
        
    'D' => 'deleted_list'
    );

    // handle POST and GET requests
    if (empty($_REQUEST)) {
        if (!empty(
    $_GET) && !empty($_POST)) {
            
    $_REQUEST array_merge($_GET$_POST);
        } else if (!empty(
    $_GET)) {
            
    $_REQUEST $_GET;
        } else if (!empty(
    $_POST)) {
            
    $_REQUEST $_POST;
        } else {
            
    $_REQUEST = array();
        }
    }

    // check parameter syntax
    foreach($vardom as $var => $dom) {
        if (!isset(
    $_REQUEST[$var])) {
            
    $MYREQUEST[$var]=NULL;
        } else if (!
    is_array($_REQUEST[$var]) && preg_match($dom.'D',$_REQUEST[$var])) {
            
    $MYREQUEST[$var]=$_REQUEST[$var];
        } else {
            
    $MYREQUEST[$var]=$_REQUEST[$var]=NULL;
        }
    }

    // check parameter sematics
    if (empty($MYREQUEST['SCOPE'])) $MYREQUEST['SCOPE']="A";
    if (empty(
    $MYREQUEST['SORT1'])) $MYREQUEST['SORT1']="H";
    if (empty(
    $MYREQUEST['SORT2'])) $MYREQUEST['SORT2']="D";
    if (empty(
    $MYREQUEST['OB']))    $MYREQUEST['OB']=OB_HOST_STATS;
    if (!isset(
    $MYREQUEST['COUNT'])) $MYREQUEST['COUNT']=20;
    if (!isset(
    $scope_list[$MYREQUEST['SCOPE']])) $MYREQUEST['SCOPE']='A';

    $MY_SELF=
        
    "$PHP_SELF".
        
    "?SCOPE=".$MYREQUEST['SCOPE'].
        
    "&SORT1=".$MYREQUEST['SORT1'].
        
    "&SORT2=".$MYREQUEST['SORT2'].
        
    "&COUNT=".$MYREQUEST['COUNT'];
    $MY_SELF_WO_SORT=
        
    "$PHP_SELF".
        
    "?SCOPE=".$MYREQUEST['SCOPE'].
        
    "&COUNT=".$MYREQUEST['COUNT'];

    // authentication needed?
    //
    if (!USE_AUTHENTICATION) {
        
    $AUTHENTICATED=1;
    } else {
        
    $AUTHENTICATED=0;
        if (
    ADMIN_PASSWORD!='password' && ($MYREQUEST['LO'] == || isset($_SERVER['PHP_AUTH_USER']))) {

            if (!isset(
    $_SERVER['PHP_AUTH_USER']) ||
                !isset(
    $_SERVER['PHP_AUTH_PW']) ||
                
    $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME ||
                
    $_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) {
                
    Header("WWW-Authenticate: Basic realm=\"APC 로그인\"");
                
    Header("HTTP/1.0 401 Unauthorized");

                echo <<<EOB
                    <html><body>
                    <h1>인증 실패!</h1>
                    <big>올바르지 않는 사용자 이름 또는 패스워드!</big><br/>&nbsp;<br/>&nbsp;
                    <big><a href='$PHP_SELF?OB=
    {$MYREQUEST['OB']}'>계속하기...</a></big>
                    </body></html>
    EOB;
                exit;
                
            } else {
                
    $AUTHENTICATED=1;
            }
        }
    }
        
    // select cache mode
    if ($AUTHENTICATED && $MYREQUEST['OB'] == OB_USER_CACHE) {
        
    $cache_mode='user';
    }
    // clear cache
    if ($AUTHENTICATED && isset($MYREQUEST['CC']) && $MYREQUEST['CC']) {
        
    apc_clear_cache($cache_mode);
    }

    if (
    $AUTHENTICATED && !empty($MYREQUEST['DU'])) {
        
    apc_delete($MYREQUEST['DU']);
    }

    if(!
    function_exists('apc_cache_info') || !($cache=@apc_cache_info($cache_mode))) {
        echo 
    "표시할 수 있는 캐시 정보가 없습니다. APC 모듈이 동작하지 않는 것으로 보입니다.";
      exit;
    }

    $cache_user apc_cache_info('user'1);  
    $mem=apc_sma_info();
    if(!
    $cache['num_hits']) { $cache['num_hits']=1$time++; }  // Avoid division by 0 errors on a cache clear

    // don't cache this page
    //
    header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
    header("Cache-Control: post-check=0, pre-check=0"false);
    header("Pragma: no-cache");                                    // HTTP/1.0

    function duration($ts) {
        global 
    $time;
        
    $years = (int)((($time $ts)/(7*86400))/52.177457);
        
    $rem = (int)(($time-$ts)-($years 52.177457 86400));
        
    $weeks = (int)(($rem)/(7*86400));
        
    $days = (int)(($rem)/86400) - $weeks*7;
        
    $hours = (int)(($rem)/3600) - $days*24 $weeks*7*24;
        
    $mins = (int)(($rem)/60) - $hours*60 $days*24*60 $weeks*7*24*60;
        
    $str '';
        if(
    $years==1$str .= "$years 년, ";
        if(
    $years>1$str .= "$years 년 이상, ";
        if(
    $weeks==1$str .= "$weeks 주, ";
        if(
    $weeks>1$str .= "$weeks 주 이상, ";
        if(
    $days==1$str .= "$days 일,";
        if(
    $days>1$str .= "$days 일 이상,";
        if(
    $hours == 1$str .= " $hours 시간 그리고";
        if(
    $hours>1$str .= " $hours 시간 이상 그리고";
        if(
    $mins == 1$str .= " 1 분";
        else 
    $str .= " $mins 분 이상";
        return 
    $str;
    }

    // create graphics
    //
    function graphics_avail() {
        return 
    extension_loaded('gd');
    }
    if (isset(
    $MYREQUEST['IMG']))
    {
        if (!
    graphics_avail()) {
            exit(
    0);
        }

        function 
    fill_arc($im$centerX$centerY$diameter$start$end$color1,$color2,$text='',$placeindex=0) {
            
    $r=$diameter/2;
            
    $w=deg2rad((360+$start+($end-$start)/2)%360);

            
            if (
    function_exists("imagefilledarc")) {
                
    // exists only if GD 2.0.1 is avaliable
                
    imagefilledarc($im$centerX+1$centerY+1$diameter$diameter$start$end$color1IMG_ARC_PIE);
                
    imagefilledarc($im$centerX$centerY$diameter$diameter$start$end$color2IMG_ARC_PIE);
                
    imagefilledarc($im$centerX$centerY$diameter$diameter$start$end$color1IMG_ARC_NOFILL|IMG_ARC_EDGED);
            } else {
                
    imagearc($im$centerX$centerY$diameter$diameter$start$end$color2);
                
    imageline($im$centerX$centerY$centerX cos(deg2rad($start)) * $r$centerY sin(deg2rad($start)) * $r$color2);
                
    imageline($im$centerX$centerY$centerX cos(deg2rad($start+1)) * $r$centerY sin(deg2rad($start)) * $r$color2);
                
    imageline($im$centerX$centerY$centerX cos(deg2rad($end-1))   * $r$centerY sin(deg2rad($end))   * $r$color2);
                
    imageline($im$centerX$centerY$centerX cos(deg2rad($end))   * $r$centerY sin(deg2rad($end))   * $r$color2);
                
    imagefill($im,$centerX $r*cos($w)/2$centerY $r*sin($w)/2$color2);
            }
            if (
    $text) {
                if (
    $placeindex>0) {
                    
    imageline($im,$centerX $r*cos($w)/2$centerY $r*sin($w)/2,$diameter$placeindex*12,$color1);
                    
    imagestring($im,4,$diameter$placeindex*12,$text,$color1);    
                    
                } else {
                    
    imagestring($im,4,$centerX $r*cos($w)/2$centerY $r*sin($w)/2,$text,$color1);
                }
            }
        } 

        function 
    text_arc($im$centerX$centerY$diameter$start$end$color1,$text,$placeindex=0) {
            
    $r=$diameter/2;
            
    $w=deg2rad((360+$start+($end-$start)/2)%360);

            if (
    $placeindex>0) {
                
    imageline($im,$centerX $r*cos($w)/2$centerY $r*sin($w)/2,$diameter$placeindex*12,$color1);
                
    imagestring($im,4,$diameter$placeindex*12,$text,$color1);    
                    
            } else {
                
    imagestring($im,4,$centerX $r*cos($w)/2$centerY $r*sin($w)/2,$text,$color1);
            }
        } 
        
        function 
    fill_box($im$x$y$w$h$color1$color2,$text='',$placeindex='') {
            global 
    $col_black;
            
    $x1=$x+$w-1;
            
    $y1=$y+$h-1;

            
    imagerectangle($im$x$y1$x1+1$y+1$col_black);
            if(
    $y1>$yimagefilledrectangle($im$x$y$x1$y1$color2);
            else 
    imagefilledrectangle($im$x$y1$x1$y$color2);
            
    imagerectangle($im$x$y1$x1$y$color1);
            if (
    $text) {
                if (
    $placeindex>0) {
                
                    if (
    $placeindex<16)
                    {
                        
    $px=5;
                        
    $py=$placeindex*12+6;
                        
    imagefilledrectangle($im$px+90$py+3$px+90-4$py-3$color2);
                        
    imageline($im,$x,$y+$h/2,$px+90,$py,$color2);
                        
    imagestring($im,2,$px,$py-6,$text,$color1);    
                        
                    } else {
                        if (
    $placeindex<31) {
                            
    $px=$x+40*2;
                            
    $py=($placeindex-15)*12+6;
                        } else {
                            
    $px=$x+40*2+100*intval(($placeindex-15)/15);
                            
    $py=($placeindex%15)*12+6;
                        }
                        
    imagefilledrectangle($im$px$py+3$px-4$py-3$color2);
                        
    imageline($im,$x+$w,$y+$h/2,$px,$py,$color2);
                        
    imagestring($im,2,$px+2,$py-6,$text,$color1);    
                    }
                } else {
                    
    imagestring($im,4,$x+5,$y1-16,$text,$color1);
                }
            }
        }


        
    $size GRAPH_SIZE// image size
        
    if ($MYREQUEST['IMG']==3)
            
    $image imagecreate(2*$size+150$size+10);
        else
            
    $image imagecreate($size+50$size+10);

        
    $col_white imagecolorallocate($image0xFF0xFF0xFF);
        
    $col_red   imagecolorallocate($image0xD00x60,  0x30);
        
    $col_green imagecolorallocate($image0x600xF00x60);
        
    $col_black imagecolorallocate($image,   0,   0,   0);
        
    imagecolortransparent($image,$col_white);

        switch (
    $MYREQUEST['IMG']) {
        
        case 
    1:
            
    $s=$mem['num_seg']*$mem['seg_size'];
            
    $a=$mem['avail_mem'];
            
    $x=$y=$size/2;
            
    $fuzz 0.000001;

            
    // This block of code creates the pie chart.  It is a lot more complex than you
            // would expect because we try to visualize any memory fragmentation as well.
            
    $angle_from 0;
            
    $string_placement=array();
            for(
    $i=0$i<$mem['num_seg']; $i++) {    
                
    $ptr 0;
                
    $free $mem['block_lists'][$i];
                foreach(
    $free as $block) {
                    if(
    $block['offset']!=$ptr) {       // Used block
                        
    $angle_to $angle_from+($block['offset']-$ptr)/$s;
                        if((
    $angle_to+$fuzz)>1$angle_to 1;
                        
    fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
                        if ((
    $angle_to-$angle_from)>0.05) {
                            
    array_push($string_placement, array($angle_from,$angle_to));
                        }
                        
    $angle_from $angle_to;
                    }
                    
    $angle_to $angle_from+($block['size'])/$s;
                    if((
    $angle_to+$fuzz)>1$angle_to 1;
                    
    fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_green);
                    if ((
    $angle_to-$angle_from)>0.05) {
                        
    array_push($string_placement, array($angle_from,$angle_to));
                    }
                    
    $angle_from $angle_to;
                    
    $ptr $block['offset']+$block['size'];
                }
                if (
    $ptr $mem['seg_size']) { // memory at the end 
                    
    $angle_to $angle_from + ($mem['seg_size'] - $ptr)/$s;
                    if((
    $angle_to+$fuzz)>1$angle_to 1;
                    
    fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
                    if ((
    $angle_to-$angle_from)>0.05) {
                        
    array_push($string_placement, array($angle_from,$angle_to));
                    }
                }
            }
            foreach (
    $string_placement as $angle) {
                
    text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0])));
            }
            break;
            
        case 
    2
            
    $s=$cache['num_hits']+$cache['num_misses'];
            
    $a=$cache['num_hits'];
            
            
    fill_box($image30,$size,50,-$a*($size-21)/$s,$col_black,$col_green,sprintf("%.1f%%",$cache['num_hits']*100/$s));
            
    fill_box($image,130,$size,50,-max(4,($s-$a)*($size-21)/$s),$col_black,$col_red,sprintf("%.1f%%",$cache['num_misses']*100/$s));
            break;
            
        case 
    3:
            
    $s=$mem['num_seg']*$mem['seg_size'];
            
    $a=$mem['avail_mem'];
            
    $x=130;
            
    $y=1;
            
    $j=1;

            
    // This block of code creates the bar chart.  It is a lot more complex than you
            // would expect because we try to visualize any memory fragmentation as well.
            
    for($i=0$i<$mem['num_seg']; $i++) {    
                
    $ptr 0;
                
    $free $mem['block_lists'][$i];
                foreach(
    $free as $block) {
                    if(
    $block['offset']!=$ptr) {       // Used block
                        
    $h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s;
                        if (
    $h>0) {
                                                    
    $j++;
                            if(
    $j<75fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j);
                                                    else 
    fill_box($image,$x,$y,50,$h,$col_black,$col_red);
                                            }
                        
    $y+=$h;
                    }
                    
    $h=(GRAPH_SIZE-5)*($block['size'])/$s;
                    if (
    $h>0) {
                                            
    $j++;
                        if(
    $j<75fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j);
                        else 
    fill_box($image,$x,$y,50,$h,$col_black,$col_green);
                                    }
                    
    $y+=$h;
                    
    $ptr $block['offset']+$block['size'];
                }
                if (
    $ptr $mem['seg_size']) { // memory at the end 
                    
    $h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s;
                    if (
    $h 0) {
                        
    fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++);
                    }
                }
            }
            break;
        case 
    4
            
    $s=$cache['num_hits']+$cache['num_misses'];
            
    $a=$cache['num_hits'];
                    
            
    fill_box($image30,$size,50,-$a*($size-21)/$s,$col_black,$col_green,sprintf("%.1f%%",$cache['num_hits']*100/$s));
            
    fill_box($image,130,$size,50,-max(4,($s-$a)*($size-21)/$s),$col_black,$col_red,sprintf("%.1f%%",$cache['num_misses']*100/$s));
            break;
        
        }
        
    header("Content-type: image/png");
        
    imagepng($image);
        exit;
    }

    // pretty printer for byte values
    //
    function bsize($s) {
        foreach (array(
    '','K','M','G') as $i => $k) {
            if (
    $s 1024) break;
            
    $s/=1024;
        }
        return 
    sprintf("%5.1f %sBytes",$s,$k);
    }

    // sortable table header in "scripts for this host" view
    function sortheader($key,$name,$extra='') {
        global 
    $MYREQUEST$MY_SELF_WO_SORT;
        
        if (
    $MYREQUEST['SORT1']==$key) {
            
    $MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' 'D' 'A';
        }
        return 
    "<a class=sortable href=\"$MY_SELF_WO_SORT$extra&SORT1=$key&SORT2=".$MYREQUEST['SORT2']."\">$name</a>";

    }

    // create menu entry 
    function menu_entry($ob,$title) {
        global 
    $MYREQUEST,$MY_SELF;
        if (
    $MYREQUEST['OB']!=$ob) {
            return 
    "<li><a href=\"$MY_SELF&OB=$ob\">$title</a></li>";
        } else if (empty(
    $MYREQUEST['SH'])) {
            return 
    "<li><span class=active>$title</span></li>";
        } else {
            return 
    "<li><a class=\"child_active\" href=\"$MY_SELF&OB=$ob\">$title</a></li>";    
        }
    }

    function 
    put_login_link($s="로그인")
    {
        global 
    $MY_SELF,$MYREQUEST,$AUTHENTICATED;
        
    // needs ADMIN_PASSWORD to be changed!
        //
        
    if (!USE_AUTHENTICATION) {
            return;
        } else if (
    ADMIN_PASSWORD=='password')
        {
            print <<<EOB
                <a href="#" onClick="javascript:alert('apc.php 를 사용하기 위해서는 사용자 인증이 필요 합니다!');return false";>$s</a>
    EOB;
        } else if (
    $AUTHENTICATED) {
            print <<<EOB
                {$_SERVER['PHP_AUTH_USER']} 로그인!
    EOB;
        } else{
            print <<<EOB
                <a href="$MY_SELF&LO=1&OB={$MYREQUEST['OB']}">$s</a>
    EOB;
        }
    }


    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head><title>APC 정보 <?php echo $host ?></title>
    <style><!--
    body { background:white; font-size:100.01%; margin:0; padding:0; }
    body,p,td,th,input,submit { font-size:0.9em;font-family:돋움; }
    * html body   {font-size:0.9em}
    * html p      {font-size:0.8em}
    * html td     {font-size:0.8em}
    * html th     {font-size:0.8em}
    * html input  {font-size:0.9em}
    * html submit {font-size:0.9em}
    //td { vertical-align:top }
    td { vertical-align:center }
    a { color:black; font-weight:none; text-decoration:none; }
    a:hover { text-decoration:underline; }
    //div.content { padding:1em 1em 1em 1em; position:absolute; width:97%; z-index:100; }
    div.content { padding:1em 1em 1em 1em; position:absolute; z-index:100; }


    div.head div.login {
        position:absolute;
        right: 1em;
        top: 1.2em;
        color:white;
        width:6em;
        }
    div.head div.login a {
        position:absolute;
        right: 0em;
        background:rgb(119,123,180);
        border:solid rgb(102,102,153) 2px;
        color:white;
        font-weight:bold;
        padding:0.1em 0.5em 0.1em 0.5em;
        text-decoration:none;
        }
    div.head div.login a:hover {
        background:rgb(193,193,244);
        }

    h1.apc { background:rgb(153,153,204); margin:0; padding:0.5em 1em 0.5em 1em; }
    * html h1.apc { margin-bottom:-7px; }
    h1.apc a:hover { text-decoration:none; color:rgb(90,90,90); }
    h1.apc div.logo span.logo {
        background:rgb(119,123,180);
        color:black;
        border-right: solid black 1px;
        border-bottom: solid black 1px;
        font-style:italic;
        font-size:1em;
        padding-left:1.2em;
        padding-right:1.2em;
        text-align:right;
        }
    h1.apc div.logo span.name { color:white; font-size:0.7em; padding:0 0.8em 0 2em; }
    h1.apc div.nameinfo { color:white; display:inline; font-size:0.4em; margin-left: 3em; }
    h1.apc div.copy { color:black; font-size:0.4em; position:absolute; right:1em; }
    hr.apc {
        background:white;
        border-bottom:solid rgb(102,102,153) 1px;
        border-style:none;
        border-top:solid rgb(102,102,153) 10px;
        height:12px;
        margin:0;
        margin-top:1px;
        padding:0;
    }

    ol,menu { margin:1em 0 0 0; padding:0.2em; margin-left:1em;}
    ol.menu li { display:inline; margin-right:0.7em; list-style:none; font-size:85%}
    ol.menu a {
        background:rgb(153,153,204);
        border:solid rgb(102,102,153) 2px;
        color:white;
        font-weight:bold;
        margin-right:0em;
        padding:0.1em 0.5em 0.1em 0.5em;
        text-decoration:none;
        margin-left: 5px;
        }
    ol.menu a.child_active {
        background:rgb(153,153,204);
        border:solid rgb(102,102,153) 2px;
        color:white;
        font-weight:bold;
        margin-right:0em;
        padding:0.1em 0.5em 0.1em 0.5em;
        text-decoration:none;
        border-left: solid black 5px;
        margin-left: 0px;
        }
    ol.menu span.active {
        background:rgb(153,153,204);
        border:solid rgb(102,102,153) 2px;
        color:black;
        font-weight:bold;
        margin-right:0em;
        padding:0.1em 0.5em 0.1em 0.5em;
        text-decoration:none;
        border-left: solid black 5px;
        }
    ol.menu span.inactive {
        background:rgb(193,193,244);
        border:solid rgb(182,182,233) 2px;
        color:white;
        font-weight:bold;
        margin-right:0em;
        padding:0.1em 0.5em 0.1em 0.5em;
        text-decoration:none;
        margin-left: 5px;
        }
    ol.menu a:hover {
        background:rgb(193,193,244);
        text-decoration:none;
        }
        
        
    div.info {
        background:rgb(204,204,204);
        border:solid rgb(204,204,204) 1px;
        margin-bottom:1em;
        }
    div.info h2 {
        background:rgb(204,204,204);
        color:black;
        font-size:1em;
        margin:0;
        padding:0.1em 1em 0.1em 1em;
        }
    div.info table {
        border:solid rgb(204,204,204) 1px;
        border-spacing:0;
        width:100%;
        }
    div.info table th {
        background:rgb(204,204,204);
        color:white;
        margin:0;
        padding:0.1em 1em 0.1em 1em;
        }
    div.info table th a.sortable { color:black; }
    div.info table tr.tr-0 { background:rgb(238,238,238); }
    div.info table tr.tr-1 { background:rgb(221,221,221); }
    div.info table td { padding:0.3em 1em 0.3em 1em; }
    div.info table td.td-0 { border-right:solid rgb(102,102,153) 1px; white-space:nowrap; }
    div.info table td.td-n { border-right:solid rgb(102,102,153) 1px; }
    div.info table td h3 {
        color:black;
        font-size:1.1em;
        margin-left:-0.3em;
        }

    div.graph { margin-bottom:1em }
    div.graph h2 { background:rgb(204,204,204);; color:black; font-size:1em; margin:0; padding:0.1em 1em 0.1em 1em; }
    div.graph table { border:solid rgb(204,204,204) 1px; color:black; font-weight:normal; width:100%; }
    div.graph table td.td-0 { background:rgb(238,238,238); }
    div.graph table td.td-1 { background:rgb(221,221,221); }
    div.graph table td { padding:0.2em 1em 0.4em 1em; }

    div.div1,div.div2 { margin-bottom:1em; width:35em; }
    //div.div3 { position:absolute; left:40em; top:1em; width:580px; }
    div.div3 { position:absolute; left:37em; top:1em; width:500px; }

    div.sorting { margin:1.5em 0em 1.5em 2em }
    .center { text-align:center }
    .aright { position:absolute;right:1em }
    .right { text-align:right }
    .ok { color:rgb(0,200,0); font-weight:bold}
    .failed { color:rgb(200,0,0); font-weight:bold}

    span.box {
        border: black solid 1px;
        border-right:solid black 2px;
        border-bottom:solid black 2px;
        padding:0 0.5em 0 0.5em;
        margin-right:1em;
    }
    span.green { background:#60F060; padding:0 0.5em 0 0.5em}
    span.red { background:#D06030; padding:0 0.5em 0 0.5em }

    div.authneeded {
        background:rgb(238,238,238);
        border:solid rgb(204,204,204) 1px;
        color:rgb(200,0,0);
        font-size:1.2em;
        font-weight:bold;
        padding:2em;
        text-align:center;
        }
        
    input {
        background:rgb(153,153,204);
        border:solid rgb(102,102,153) 2px;
        color:white;
        font-weight:bold;
        margin-right:1em;
        padding:0.1em 0.5em 0.1em 0.5em;
        }
    //-->
    </style>
    </head>
    <body>
    <div class="head">
        <h1 class="apc">
            <div class="logo"><span class="logo">APC</span></div>
            <div class="nameinfo">Opcode 캐시</div>
        </h1>
        <div class="login">
        <?php put_login_link(); ?>
        </div>
        <hr class="apc">
    </div>
    <?php


    // Display main Menu
    echo <<<EOB
        <ol class=menu>
        <li><a href="$MY_SELF&OB=
    {$MYREQUEST['OB']}&SH={$MYREQUEST['SH']}">정보 새로 고침</a></li>
    EOB;
    echo
        
    menu_entry(1,'호스트 통계'),
        
    menu_entry(2,'시스템 캐시');
    if (
    $AUTHENTICATED) {
        echo 
    menu_entry(4,'부모 디렉토리');
    }
    echo
        
    menu_entry(3,'사용자 캐시'),
        
    menu_entry(9,'APC 버전');
        
    if (
    $AUTHENTICATED) {
        echo <<<EOB
            <li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascipt:return confirm('정말로 캐시를 정리 하시겠습니까?');">$cache_mode 캐시 정리</a></li>
    EOB;
    }
    echo <<<EOB
        </ol>
    EOB;


    // CONTENT
    echo <<<EOB
        <div class=content>
    EOB;

    // MAIN SWITCH STATEMENT 

    switch ($MYREQUEST['OB']) {





    // -----------------------------------------------
    // Host Stats
    // -----------------------------------------------
    case OB_HOST_STATS:
        
    $mem_size $mem['num_seg']*$mem['seg_size'];
        
    $mem_avail$mem['avail_mem'];
        
    $mem_used $mem_size-$mem_avail;
        
    $seg_size bsize($mem['seg_size']);
        
    $req_rate sprintf("%.2f",($cache['num_hits']+$cache['num_misses'])/($time-$cache['start_time']));
        
    $hit_rate sprintf("%.2f",($cache['num_hits'])/($time-$cache['start_time']));
        
    $miss_rate sprintf("%.2f",($cache['num_misses'])/($time-$cache['start_time']));
        
    $insert_rate sprintf("%.2f",($cache['num_inserts'])/($time-$cache['start_time']));
        
    $req_rate_user sprintf("%.2f",($cache_user['num_hits']+$cache_user['num_misses'])/($time-$cache_user['start_time']));
        
    $hit_rate_user sprintf("%.2f",($cache_user['num_hits'])/($time-$cache_user['start_time']));
        
    $miss_rate_user sprintf("%.2f",($cache_user['num_misses'])/($time-$cache_user['start_time']));
        
    $insert_rate_user sprintf("%.2f",($cache_user['num_inserts'])/($time-$cache_user['start_time']));
        
    $apcversion phpversion('apc');
        
    $phpversion phpversion();
        
    $number_files $cache['num_entries']; 
        
    $size_files bsize($cache['mem_size']);
        
    $number_vars $cache_user['num_entries'];
        
    $size_vars bsize($cache_user['mem_size']);
        
    $i=0;
        echo <<< EOB
            <div class="info div1"><h2>일반 캐시</h2>
            <table cellspacing=0><tbody>
            <tr class=tr-0><td class=td-0>APC 버전</td><td>$apcversion</td></tr>
            <tr class=tr-1><td class=td-0>PHP 버전</td><td>$phpversion</td></tr>
    EOB;

        if(!empty(
    $_SERVER['SERVER_NAME']))
            echo 
    "<tr class=tr-0><td class=td-0>APC 호스트</td><td>{$_SERVER['SERVER_NAME']} $host</td></tr>\n";
        if(!empty(
    $_SERVER['SERVER_SOFTWARE']))
            echo 
    "<tr class=tr-1><td class=td-0>서버 소프트웨어</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n";

        echo <<<EOB
            <tr class=tr-0><td class=td-0>공유 메모리</td><td> 전체 {$mem['num_seg']} 개, 용량 {$seg_size}
        <br/> ( 메모리 타입: 
    {$cache['memory_type']} , 락 타입: {$cache['locking_type']} )
        </td></tr>
    EOB;
        echo   
    '<tr class=tr-1><td class=td-0>시작 시간</td><td>',date(DATE_FORMAT,$cache['start_time']),'</td></tr>';
        echo   
    '<tr class=tr-0><td class=td-0>기동 시간</td><td>',duration($cache['start_time']),'</td></tr>';
        echo   
    '<tr class=tr-1><td class=td-0>파일 업로드 지원</td><td>',$cache['file_upload_progress'],'</td></tr>';
        echo <<<EOB
            </tbody></table>
            </div>

            <div class="info div1"><h2>파일 캐시</h2>
            <table cellspacing=0><tbody>
            <tr class=tr-0><td class=td-0>캐시된 파일</td><td>$number_files ($size_files)</td></tr>
            <tr class=tr-1><td class=td-0>적용된 수</td><td>
    {$cache['num_hits']}</td></tr>
            <tr class=tr-0><td class=td-0>적용되지 않은 수</td><td>
    {$cache['num_misses']}</td></tr>
            <tr class=tr-1><td class=td-0>적용된 /적용되지 않은 비율의 합</td><td>$req_rate (요청된 캐시/초)</td></tr>
            <tr class=tr-0><td class=td-0>적용된 비율</td><td>$hit_rate (요청된 캐시/초)</td></tr>
            <tr class=tr-1><td class=td-0>적용되지 않은 비율</td><td>$miss_rate (요청된 캐시/초)</td></tr>
            <tr class=tr-0><td class=td-0>삽입 비율</td><td>$insert_rate (요청된 캐시/초)</td></tr>
            <tr class=tr-1><td class=td-0>전체 캐시 수</td><td>
    {$cache['expunges']}</td></tr>
            </tbody></table>
            </div>

            <div class="info div1"><h2>사용자 캐시</h2>
            <table cellspacing=0><tbody>
        <tr class=tr-0><td class=td-0>캐시된 파일</td><td>$number_vars ($size_vars)</td></tr>
            <tr class=tr-1><td class=td-0>적용된 수</td><td>
    {$cache_user['num_hits']}</td></tr>
            <tr class=tr-0><td class=td-0>적용되지 않은 수</td><td>
    {$cache_user['num_misses']}</td></tr>
            <tr class=tr-1><td class=td-0>적용된 /적용되지 않은 비율의 합</td><td>$req_rate_user (요청된 캐시/초)</td></tr>
            <tr class=tr-0><td class=td-0>적용된 비율</td><td>$hit_rate_user (요청된 캐시/초)</td></tr>
            <tr class=tr-1><td class=td-0>적용되지 않은 비율</td><td>$miss_rate_user (요청된 캐시/초)</td></tr>
            <tr class=tr-0><td class=td-0>삽입 비율</td><td>$insert_rate_user (요청된 캐시/초)</td></tr>
            <tr class=tr-1><td class=td-0>전체 캐시 수</td><td>
    {$cache_user['expunges']}</td></tr>

            </tbody></table>
            </div>

            <div class="info div2"><h2>동작 설정</h2><table cellspacing=0><tbody>
    EOB;

        
    $j 0;
        foreach (
    ini_get_all('apc') as $k => $v) {
            
    //newpds
            //echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>",str_replace(',',',<br />',$v['local_value']),"</td></tr>\n";
            
    echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>";
            if (
    $AUTHENTICATED) { 
                echo 
    str_replace(',',',<br />',$v['local_value']);
            }
            else
            {
                echo 
    "<i>&lt;표시하지 않음&gt;</i>";
            }
            echo 
    "</td></tr>\n";
            
            
    $j $j;
        }


        if(
    $mem['num_seg']>|| $mem['num_seg']==&& count($mem['block_lists'][0])>1)
            
    $mem_note "메모리 사용<br />( 단편화 조각 표시 )";
        else
            
    $mem_note "메모리 사용";

        echo <<< EOB
            </tbody></table>
            </div>

            <div class="graph div3"><h2>호스트 통계 표시</h2>
            <table cellspacing=0><tbody>
    EOB;
        
    $size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10);
        echo <<<EOB
            <tr>
            <td class=td-0>$mem_note</td>
            <td class=td-1>적용된 수 &amp; 적용되지 않은 수의 비율</td>
            </tr>
    EOB;

        echo
            
    graphics_avail() ? 
                  
    '<tr>'.
                  
    "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF?IMG=1&$time\"></td>".
                  
    "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n"
                
    "",
            
    '<tr>',
            
    '<td class=td-0><span class="green box">&nbsp;</span>여유 공간: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
            
    '<td class=td-1><span class="green box">&nbsp;</span>적용된 수: ',$cache['num_hits'].sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n",
            
    '</tr>',
            
    '<tr>',
            
    '<td class=td-0><span class="red box">&nbsp;</span>사용 공간: ',bsize($mem_used ).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
            
    '<td class=td-1><span class="red box">&nbsp;</span>적용되지 않은 수: ',$cache['num_misses'].sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n";
        echo <<< EOB
            </tr>
            </tbody></table>

            <br/>
            <h2>상세한 메모리 사용률 및 조각 비율</h2>
            <table cellspacing=0><tbody>
            <tr>
            <td class=td-0 colspan=2><br/>
    EOB;

        
    // Fragementation: (freeseg - 1) / total_seg
        
    $nseg $freeseg $fragsize $freetotal 0;
        for(
    $i=0$i<$mem['num_seg']; $i++) {
            
    $ptr 0;
            foreach(
    $mem['block_lists'][$i] as $block) {
                if (
    $block['offset'] != $ptr) {
                    ++
    $nseg;
                }
                
    $ptr $block['offset'] + $block['size'];
                            
    /* Only consider blocks <5M for the fragmentation % */
                            
    if($block['size']<(5*1024*1024)) $fragsize+=$block['size'];
                            
    $freetotal+=$block['size'];
            }
            
    $freeseg += count($mem['block_lists'][$i]);
        }
        
        if (
    $freeseg 1) {
            
    //38.28% (6.0 MBytes out of 15.7 MBytes in 6 fragments) 
            
    $frag sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg);
            
    $frag sprintf("%.2f%% (%s 중 %s 를 %d 개로 조각)", ($fragsize/$freetotal)*100,bsize($freetotal),bsize($fragsize),$freeseg);

        } else {
            
    $frag "0%";
        }

        if (
    graphics_avail()) {
            
    $size='width='.(2*GRAPH_SIZE+150).' height='.(GRAPH_SIZE+10);
            echo <<<EOB
                <img alt="" $size src="$PHP_SELF?IMG=3&$time">
    EOB;
        }
        echo <<<EOB
            </br>조각 비율: $frag
            </td>
            </tr>
    EOB;
            if(isset(
    $mem['adist'])) {
              foreach(
    $mem['adist'] as $i=>$v) {
                
    $cur pow(2,$i); $nxt pow(2,$i+1)-1;
                if(
    $i==0$range "1";
                else 
    $range "$cur - $nxt";
                echo 
    "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n";
              }
            }
            echo <<<EOB
            </tbody></table>
            </div>
    EOB;
            
        break;


    // -----------------------------------------------
    // User Cache Entries
    // -----------------------------------------------
    case OB_USER_CACHE:
        if (!
    $AUTHENTICATED) {
            echo 
    '<div class="authneeded">사용자 캐시 정보를 보기 위해서 로그인이 필요 합니다!<br/>&nbsp;<br/>';
            
    put_login_link("로그인 하기!");
            echo 
    '</div>';
            break;
        }
        
    $fieldname='info';
        
    $fieldheading='User Entry Label';
        
    $fieldkey='info';

    // -----------------------------------------------
    // System Cache Entries        
    // -----------------------------------------------
    case OB_SYS_CACHE:    
        if (!isset(
    $fieldname))
        {
            
    $fieldname='filename';
            
    $fieldheading='스크립트 파일명';
            if(
    ini_get("apc.stat")) $fieldkey='inode';
            else 
    $fieldkey='filename'
        }
        if (!empty(
    $MYREQUEST['SH']))
        {
            echo <<< EOB
                <div class="info"><table cellspacing=0 style="width:1010px;"><tbody>
                <tr><th>속성</th><th>값</th></tr>
    EOB;

            
    $m=0;
            foreach(
    $scope_list as $j => $list) {
                foreach(
    $cache[$list] as $i => $entry) {
                    if (
    md5($entry[$fieldkey])!=$MYREQUEST['SH']) continue;
                    foreach(
    $entry as $k => $value) {
                        if (!
    $AUTHENTICATED) {
                            
    // hide all path entries if not logged in
                            
    $value=preg_replace('/^.*(\\/|\\\\)/','<i>&lt;표시하지 않음&gt;</i>/',$value);
                            if(
    $k == "filename")    $value="<i>&lt;표시하지 않음&gt;</i>";    //newpds
                        
    }

                        if (
    $k == "num_hits") {
                            
    $value=sprintf("%s (%.2f%%)",$value,$value*100/$cache['num_hits']);
                        }
                        if (
    $k == 'deletion_time') {
                            if(!
    $entry['deletion_time']) $value "None";
                        }
                        echo
                            
    "<tr class=tr-$m>",
                            
    "<td class=td-0>",ucwords(preg_replace("/_/"," ",$k)),"</td>",
                            
    "<td class=td-last>",(preg_match("/time/",$k) && $value!='None') ? date(DATE_FORMAT,$value) : $value,"</td>",
                            
    "</tr>";
                        
    $m=1-$m;
                    }
                    if(
    $fieldkey=='info') {
                        echo 
    "<tr class=tr-$m><td class=td-0>저장된 값</td><td class=td-last><pre>";
                        
    $output var_export(apc_fetch($entry[$fieldkey]),true);
                        echo 
    htmlspecialchars($output);
                        echo 
    "</pre></td></tr>\n";
                    }
                    break;
                }
            }

            echo <<<EOB
                </tbody></table>
                </div>
    EOB;
            break;
        }

        
    $cols=6;
        echo <<<EOB
            <div class=sorting><form>범위:
            <input type=hidden name=OB value=
    {$MYREQUEST['OB']}>
            <select name=SCOPE>
    EOB;
        echo 
            
    "<option value=A",$MYREQUEST['SCOPE']=='A' " selected":"",">활동</option>",
            
    "<option value=D",$MYREQUEST['SCOPE']=='D' " selected":"",">활동 안함</option>",
            
    "</select>",
            
    ", 정렬 기준:<select name=SORT1>",
            
    "<option value=H",$MYREQUEST['SORT1']=='H' " selected":"",">전체 방문자 수</option>",
            
    "<option value=Z",$MYREQUEST['SORT1']=='Z' " selected":"",">용량</option>",
            
    "<option value=S",$MYREQUEST['SORT1']=='S' " selected":"",">$fieldheading</option>",
            
    "<option value=A",$MYREQUEST['SORT1']=='A' " selected":"",">마지막 접속</option>",
            
    "<option value=M",$MYREQUEST['SORT1']=='M' " selected":"",">마지막 수정</option>",
            
    "<option value=C",$MYREQUEST['SORT1']=='C' " selected":"",">생성 날짜</option>",
            
    "<option value=D",$MYREQUEST['SORT1']=='D' " selected":"",">삭제 날짜</option>";
        if(
    $fieldname=='info') echo
            
    "<option value=D",$MYREQUEST['SORT1']=='T' " selected":"",">시간 종료</option>";
        echo 
            
    '</select>',
            
    '<select name=SORT2>',
            
    '<option value=D',$MYREQUEST['SORT2']=='D' ' selected':'','>내림 차순</option>',
            
    '<option value=A',$MYREQUEST['SORT2']=='A' ' selected':'','>오름 차순</option>',
            
    '</select>',
            
    '<select name=COUNT onChange="form.submit()">',
            
    '<option value=10 ',$MYREQUEST['COUNT']=='10' ' selected':'','>전체 10위</option>',
            
    '<option value=20 ',$MYREQUEST['COUNT']=='20' ' selected':'','>전체 20위</option>',
            
    '<option value=50 ',$MYREQUEST['COUNT']=='50' ' selected':'','>전체 50위</option>',
            
    '<option value=100',$MYREQUEST['COUNT']=='100'' selected':'','>전체 100위</option>',
            
    '<option value=150',$MYREQUEST['COUNT']=='150'' selected':'','>전체 150위</option>',
            
    '<option value=200',$MYREQUEST['COUNT']=='200'' selected':'','>전체 200위</option>',
            
    '<option value=500',$MYREQUEST['COUNT']=='500'' selected':'','>전체 500위</option>',
            
    '<option value=0  ',$MYREQUEST['COUNT']=='0'  ' selected':'','>모두</option>',
            
    '</select>',
        
    '&nbsp; 검색: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>',
            
    '&nbsp;<input type=submit value="진행!">',
            
    '</form></div>',

            
    '<div class="info"><table cellspacing=0 style="width:1010px;"><tbody>',
            
    '<tr>',
            
    '<th>',sortheader('S',$fieldheading,  "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('H','Hits',         "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('Z','Size',         "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('A','Last accessed',"&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('M','Last modified',"&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('C','Created at',   "&OB=".$MYREQUEST['OB']),'</th>';

        if(
    $fieldname=='info') {
            
    $cols+=2;
             echo 
    '<th>',sortheader('T','Timeout',"&OB=".$MYREQUEST['OB']),'</th>';
        }
        echo 
    '<th>',sortheader('D','Deleted at',"&OB=".$MYREQUEST['OB']),'</th></tr>';

        
    // builds list with alpha numeric sortable keys
        //
        
    $list = array();
        foreach(
    $cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) {
            switch(
    $MYREQUEST['SORT1']) {
                case 
    'A'$k=sprintf('%015d-',$entry['access_time']);     break;
                case 
    'H'$k=sprintf('%015d-',$entry['num_hits']);         break;
                case 
    'Z'$k=sprintf('%015d-',$entry['mem_size']);         break;
                case 
    'M'$k=sprintf('%015d-',$entry['mtime']);            break;
                case 
    'C'$k=sprintf('%015d-',$entry['creation_time']);    break;
                case 
    'T'$k=sprintf('%015d-',$entry['ttl']);            break;
                case 
    'D'$k=sprintf('%015d-',$entry['deletion_time']);    break;
                case 
    'S'$k='';                                        break;
            }
            if (!
    $AUTHENTICATED) {
                
    // hide all path entries if not logged in
                
    $list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','<i>&lt;표시하지 않음&gt;</i>/',$entry);
            } else {
                
    $list[$k.$entry[$fieldname]]=$entry;
            }
        }

        if (
    $list) {
            
            
    // sort list
            //
            
    switch ($MYREQUEST['SORT2']) {
                case 
    "A":    krsort($list);    break;
                case 
    "D":    ksort($list);    break;
            }
            
            
    // output list
            
    $i=0;
            foreach(
    $list as $k => $entry) {
          if(!
    $MYREQUEST['SEARCH'] || preg_match('/'.$MYREQUEST['SEARCH'].'/i'$entry[$fieldname]) != 0) {  
            if (!
    $AUTHENTICATED)    $entry['filename']="<i>&lt;표시하지 않음&gt;</i>";    //newpds
            
    echo
              
    '<tr class=tr-',$i%2,'>',
              
    "<td class=td-0 style='width:350px;word-break:break-all;'><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",md5($entry[$fieldkey]),"\">",$entry[$fieldname],'</a></td>',
              
    '<td class="td-n center">',$entry['num_hits'],'</td>',
              
    '<td class="td-n right">',$entry['mem_size'],'</td>',
              
    '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>',
              
    '<td class="td-n center">',date(DATE_FORMAT,$entry['mtime']),'</td>',
              
    '<td class="td-n center">',date(DATE_FORMAT,$entry['creation_time']),'</td>';    //newpds

            
    if($fieldname=='info') {
              if(
    $entry['ttl'])
                echo 
    '<td class="td-n center">'.$entry['ttl'].' 초</td>';
              else
                echo 
    '<td class="td-n center">정보 없음</td>';
            }
            if (
    $entry['deletion_time']) {

              echo 
    '<td class="td-last center">'date(DATE_FORMAT,$entry['deletion_time']), '</td>';
            } else if (
    $MYREQUEST['OB'] == OB_USER_CACHE) {

              echo 
    '<td class="td-last center">';
              echo 
    '[<a href="'$MY_SELF'&OB='$MYREQUEST['OB'], '&DU='urlencode($entry[$fieldkey]), '">삭제</a>]';
              echo 
    '</td>';
            } else {
              echo 
    '<td class="td-last center"> &nbsp; </td>';
            }
            echo 
    '</tr>';
            
    $i++;
            if (
    $i == $MYREQUEST['COUNT'])
              break;
          }
            }
            
        } else {
            echo 
    '<tr class=tr-0><td class="center" colspan=',$cols,'><i>데이터 없음</i></td></tr>';
        }
        echo <<< EOB
            </tbody></table>
    EOB;

        if (
    $list && $i count($list)) {
            echo 
    "<a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&COUNT=0\"><i>자세한 정보 표시 ( 나머지: ",count($list)-$i,'개 ) ...</i></a>';
        }

        echo <<< EOB
            </div>
    EOB;
        break;


    // -----------------------------------------------
    // Per-Directory System Cache Entries
    // -----------------------------------------------
    case OB_SYS_CACHE_DIR:    
        if (!
    $AUTHENTICATED) {
            break;
        }

        echo <<<EOB
            <div class=sorting><form>범위:
            <input type=hidden name=OB value=
    {$MYREQUEST['OB']}>
            <select name=SCOPE>
    EOB;
        echo 
            
    "<option value=A",$MYREQUEST['SCOPE']=='A' " selected":"",">활동</option>",
            
    "<option value=D",$MYREQUEST['SCOPE']=='D' " selected":"",">활동 안함</option>",
            
    "</select>",
            
    ", 정렬 기준:<select name=SORT1>",
            
    "<option value=H",$MYREQUEST['SORT1']=='H' " selected":"",">전체 방문자 수</option>",
            
    "<option value=Z",$MYREQUEST['SORT1']=='Z' " selected":"",">전체 용량</option>",
            
    "<option value=T",$MYREQUEST['SORT1']=='T' " selected":"",">파일(들) 갯수</option>",
            
    "<option value=S",$MYREQUEST['SORT1']=='S' " selected":"",">디렉토리 이름</option>",
            
    "<option value=A",$MYREQUEST['SORT1']=='A' " selected":"",">(평균) 용량</option>",
            
    "<option value=C",$MYREQUEST['SORT1']=='C' " selected":"",">(평균) 방문자 수</option>",
            
    '</select>',
            
    '<select name=SORT2>',
            
    '<option value=D',$MYREQUEST['SORT2']=='D' ' selected':'','>내림 차순</option>',
            
    '<option value=A',$MYREQUEST['SORT2']=='A' ' selected':'','>오름 차순</option>',
            
    '</select>',
            
    '<select name=COUNT onChange="form.submit()">',
            
    '<option value=10 ',$MYREQUEST['COUNT']=='10' ' selected':'','>전체 10위</option>',
            
    '<option value=20 ',$MYREQUEST['COUNT']=='20' ' selected':'','>전체 20위</option>',
            
    '<option value=50 ',$MYREQUEST['COUNT']=='50' ' selected':'','>전체 50위</option>',
            
    '<option value=100',$MYREQUEST['COUNT']=='100'' selected':'','>전체 100위</option>',
            
    '<option value=150',$MYREQUEST['COUNT']=='150'' selected':'','>전체 150위</option>',
            
    '<option value=200',$MYREQUEST['COUNT']=='200'' selected':'','>전체 200위</option>',
            
    '<option value=500',$MYREQUEST['COUNT']=='500'' selected':'','>전체 500위</option>',
            
    '<option value=0  ',$MYREQUEST['COUNT']=='0'  ' selected':'','>모두</option>',
            
    '</select>',
            
    ", 디렉토리 그룹:<select name=AGGR>",
            
    "<option value='' selected>없음</option>";
            for (
    $i 1$i 10$i++)
                echo 
    "<option value=$i",$MYREQUEST['AGGR']==$i " selected":"",">$i 레벨</option>";
            echo 
    '</select>',
            
    '&nbsp;<input type=submit value="진행!">',
            
    '</form></div>',

            
    '<div class="info"><table cellspacing=0 style="width:1010px;"><tbody>',
            
    '<tr>',
            
    '<th>',sortheader('S','디렉토리 이름',    "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('T','Number of Files',"&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('H','Total Hits',    "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('Z','Total Size',    "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('C','Avg. Hits',    "&OB=".$MYREQUEST['OB']),'</th>',
            
    '<th>',sortheader('A','Avg. Size',    "&OB=".$MYREQUEST['OB']),'</th>',
            
    '</tr>';

        
    // builds list with alpha numeric sortable keys
        //
        
    $tmp $list = array();
        foreach(
    $cache[$scope_list[$MYREQUEST['SCOPE']]] as $entry) {
            
    $n dirname($entry['filename']);
            if (
    $MYREQUEST['AGGR'] > 0) {
                
    $n preg_replace("!^(/?(?:[^/\\\\]+[/\\\\]){".($MYREQUEST['AGGR']-1)."}[^/\\\\]*).*!""$1"$n);
            }
            if (!isset(
    $tmp[$n])) {
                
    $tmp[$n] = array('hits'=>0,'size'=>0,'ents'=>0);
            }
            
    $tmp[$n]['hits'] += $entry['num_hits'];
            
    $tmp[$n]['size'] += $entry['mem_size'];
            ++
    $tmp[$n]['ents'];
        }

        foreach (
    $tmp as $k => $v) {
            switch(
    $MYREQUEST['SORT1']) {
                case 
    'A'$kn=sprintf('%015d-',$v['size'] / $v['ents']);break;
                case 
    'T'$kn=sprintf('%015d-',$v['ents']);        break;
                case 
    'H'$kn=sprintf('%015d-',$v['hits']);        break;
                case 
    'Z'$kn=sprintf('%015d-',$v['size']);        break;
                case 
    'C'$kn=sprintf('%015d-',$v['hits'] / $v['ents']);break;
                case 
    'S'$kn $k;                    break;
            }
            
    $list[$kn.$k] = array($k$v['ents'], $v['hits'], $v['size']);
        }

        if (
    $list) {
            
            
    // sort list
            //
            
    switch ($MYREQUEST['SORT2']) {
                case 
    "A":    krsort($list);    break;
                case 
    "D":    ksort($list);    break;
            }
            
            
    // output list
            
    $i 0;
            foreach(
    $list as $entry) {
                echo
                    
    '<tr class=tr-',$i%2,'>',
                    
    "<td class=td-0>",$entry[0],'</a></td>',
                    
    '<td class="td-n center">',$entry[1],'</td>',
                    
    '<td class="td-n center">',$entry[2],'</td>',
                    
    '<td class="td-n center">',$entry[3],'</td>',
                    
    '<td class="td-n center">',round($entry[2] / $entry[1]),'</td>',
                    
    '<td class="td-n center">',round($entry[3] / $entry[1]),'</td>',
                    
    '</tr>';

                if (++
    $i == $MYREQUEST['COUNT']) break;
            }
            
        } else {
            echo 
    '<tr class=tr-0><td class="center" colspan=6><i>데이터 없음</i></td></tr>';
        }
        echo <<< EOB
            </tbody></table>
    EOB;

        if (
    $list && $i count($list)) {
            echo 
    "<a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&COUNT=0\"><i>자세한 정보 표시 ( 나머지: ",count($list)-$i,'개 ) ...</i></a>';
        }

        echo <<< EOB
            </div>
    EOB;
        break;

    // -----------------------------------------------
    // Version check
    // -----------------------------------------------
    case OB_VERSION_CHECK:
        if (!
    $AUTHENTICATED) {
            echo 
    '<div class="authneeded">APC 버전 정보를 보기 위해서 로그인이 필요 합니다!<br/>&nbsp;<br/>';
            
    put_login_link("로그인 하기!");
            echo 
    '</div>';
            break;
        }
    //newpds
        
    echo <<<EOB
            <div class="info"><h2>APC 버전 정보</h2>
            <table cellspacing=0 style="width:1010px;"><tbody>
            <tr>
            <th></th>
            </tr>
    EOB;

        
    $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apc.rss");
        if (!
    $rss) {
            echo 
    '<tr class="td-last center"><td>APC 버전 정보를 가져올 수 없습니다.</td></tr>';
        } else {
            
    $apcversion phpversion('apc');

            
    preg_match('!<title>APC ([0-9.]+)</title>!'$rss$match);
            echo 
    '<tr class="tr-0 center"><td>';
            if (
    version_compare($apcversion$match[1], '>=')) {
                echo 
    '<div class="ok">최신 버전의 APC 를 사용하고 있습니다. ( 사용 버전: '.$apcversion.' )</div>';
                
    $i 3;
            } else {
                echo 
    '<div class="failed">오래된 버전의 APC 를 사용하고 있습니다. ( 사용 버전: '.$apcversion.' ), 
                    <a href="http://pecl.php.net/package/APC/'
    .$match[1].'">여기
                    http://pecl.php.net/package/APC/'
    .$match[1].'</a> 에서 ( 최신 버전: '.$match[1].' ) 을 업그레이드 하실 수 있습니다.
                    </div>'
    ;
                
    $i = -1;
            }
            echo 
    '</td></tr>';
            echo 
    '<tr class="tr-0"><td><h3>변경 사항:</h3><br/>';

            
    preg_match_all('!<(title|description)>([^<]+)</\\1>!'$rss$match);
            
    next($match[2]); next($match[2]);

            while (list(,
    $v) = each($match[2])) {
                list(,
    $ver) = explode(' '$v2);
                if (
    $i && version_compare($apcversion$ver'>=')) {
                    break;
                } else if (!
    $i--) {
                    break;
                }
                echo 
    "<b><a href=\"http://pecl.php.net/package/APC/$ver\">".htmlspecialchars($v)."</a></b><br><blockquote>";
                echo 
    nl2br(htmlspecialchars(current($match[2])))."</blockquote>";
                
    next($match[2]);
            }
            echo 
    '</td></tr>';
        }
        echo <<< EOB
            </tbody></table>
            </div>
    EOB;
        break;

    }

    echo <<< EOB
        </div>
    EOB;

    ?>

    <!-- <?php echo "\nBased on APCGUI By R.Becker\n$VERSION\n"?> -->
    </body>
    </html>

     

     

     

     

    Posted by 새로운시작
    |

     
     
     
    dpkg-deb --extract dpkg_1.10.28_powerpc.deb  target
     

    1. 패키지에 대한 정보 보기

     #dpkg --info file_name

     

    2. 패키지에 들어있는 파일 보기

     #dpkg --contents file_name

     

    3. 패키지 설치하기

     #dpkg -i file_name

     

    4. 패키지를 풀어헤치기만 하고 설정하지 않기

     #dpkg --unpack file_name

     

    5. --unpack으로 풀어헤친 패키지를 설정하기

     #dpkg --configure file_name

     

    6. 패키지 삭제하기

     #dpkg --remove package_name

     

    7. 설정파일까지 삭제하기

     #dpkg --purge package_name

     

    8. 패키지 내의 파일 검색

     #dpkg -L package_name

     

    9. 어떤 파일이 어떤 패키지에 들어있는지 알고자 할 때

     #dpkg -S 패턴

     

    10. 설치된 패키지 리스트보기

    #dpkg -l

     
     
     
     
     
    dpkg-www for Debian
    -------------------
    WWW interface to dpkg and apt.
    With this cgi program you can browse Debian packages using a WEB browser.
    You can easily follow package dependencies and browse package documentation
    with a mouse click.
    If you have properly configured the package you can also query which packages
    own a non-installed file or have a certain value in a control field.
    You can even install or remove packages from your browser if this feature is
    enabled in the site configuration file.
    WARNING! Allowing access to /cgi-bin/dpkg from any foreign host could allow
    a malicious external user to know your installed packages and try possible
    security exploits. You should check your local http server configuration
    and disable access to dpkg-www from external hosts. You should add the
    following lines to apache's httpd.conf:
        # Disable execution of dpkg from remote hosts
        <Location /cgi-bin/dpkg>
        order deny,allow
        deny from all
        allow from localhost
        allow from .your.domain
        </Location>
    WARNING! Enabling the WEB installation feature could potentially introduce
    security holes in your system and your network. Use at yout own risk!
    --
    Massimo Dal Zotto <dz@debian.org>  Thu Jan 11 21:26:25 MET 2001
     
     

     
    Posted by 새로운시작
    |



    在使用PHP过程中发现,自己编写的php代码因为都是源代码方式放在服务器上的所以很容易就被别人拿走随便修改(变成自己开发的)使用了。
    为了保住自己的劳动成果,我一直寻找一种可以加密php代码的软件。
    最著名的就是Zend公司的Zendencoder了,但是不是开源软件(要价很高,也没有找到破解版)。
    既然收费的用不起,我们就用开源的。我找到了php_screw这个开源软件,目前最新版本是1.3
    网址
    http://sourceforge.net/projects/php-screw/
    我的安装环境
    系统:Slackware 10
    软件:Apache 1.3.31
    PHP 4.3.7
    以上环境全部是slackware 10默认安装后自带的。具体的Apache+php+mysql安装方法参照如下
    支持php的Apache环境安装
    获得软件
    下载php_screw-1.3 (
    http://prdownloads.sourceforge.net/php-screw/php_screw-1.3.tgz?download)

    安装
    1.将获得的php_screw-1.3.tgz文件放到/usr/local目录下,然后用tar解压缩
    tar zxvf php_screw-1.3.tgz

    2.进入/usr/local/php_screw-1.3目录开始安装
    cd /usr/local/php_screw-1.3
    phpize
    ./confiugre

    3.设置自己用来加密的密码
    vi my_screw.h

        -- Please change the encryption SEED key (pm9screw_mycryptkey) into the
          values according to what you like.
          The encryption will be harder to break, if you add more values to the
          encryption SEED array. However, the size of the SEED is unrelated to
          the time of the decrypt processing.

        * If you can read and understand the source code, to modify an original
          encryption logic will be possible. But in general, this should not
          be necessary.

        OPTIONAL: Encrypted scripts get a stamp added to the beginning of the
              file. If you like, you may change this stamp defined by
              PM9SCREW and PM9SCREW_LEN in php_screw.h. PM9SCREW_LEN must
              be less than or equal to the size of PM9SCREW.

    4.编译
    make

    5.拷贝modules目录下的php_screw.so文件到/usr/lib/php/extension目录下
    cp modules/php_screw.so /usr/lib/php/extension/

    6.编辑php.ini文件
    在php.ini文件里,加入如下语句
    extension=php_screw.so

    7.重新启动Apache
    /etc/rc.d/rc.httpd restart

    8.编译加密工具
    cd tools
    make

    9.将tools目录下加密用的工具screw拷贝到适当目录
    cp screw /usr/bin/

    经过以上的10步,就已经把php_screw-1.3全部安装完成了。并且现在的php也已经支持解释加密过的php文件了
    使用
    1.现写一个要加密的php文件。
    我写了如下的一个用来测试php速度的compute.php文件
    <?
    $a=0;
    $t=time();
    for($i=0;$i<5000000;$i++)
      {$a=$a*$i;}
    $t1=time();
    echo "<p>";
    echo "It used:";
    echo $t1-$t;
    echo "seconds";
    ?>

    将上面的compute.php文件放到/var/www/htdocs目录下。通过浏览器访问,将显示出php在大量计算时的速度(只能粗略估计一下)
    2.将我们写的php文件加密
    cd /var/www/htdocs/
    screw compute.php

    我们加密后,现在目录下的compute.php文件就是我们已经加密的了。而源文件被改名为compute.php.screw存放了。
    我们现在再测试一下compute.php,看看能否正常使用?速度如何?
    我比较了一下,加密前后的速度大概一样,基本没有太多的损失。

    http://www.unixtech.cn/read.php?tid=463


    1. DownLoad
    <A class=con_link href="http://prdownloads.sourceforge.net/php-screw/" target=_blank>http://prdownloads.sourceforge.net/php-screw/</A>
    2. 사전준비
    - PHP4.X 이상
    - PHP with zlib ( 컴파일시 --with-zlib )
    으로 확인
    - UNIX system OS (LINUX, FreeBSD, etc. are included)
    3. 설치
    % tar xvfz php_screw-XXX.tgz
    % phpize
    % ./configure
    % vi my_screw.h
    SEED KEY을 개인적으로 변경하여 사용하십시요.
    % make
    % cp modules/php_screw.so /usr/local/lib/php/extensions/php_screw.so
    php_screw.so 를 적당한 디렉토리에 복사
    % vi php.ini
    를 통하여 php.ini의 위치를 확인후 해당 php.ini의 설정을 변경한다.
    zend_extension="/usr/local/lib/php/extension/php_screw.so"
    % /usr/local/apache/bin/apachectl restart
    % cd tools
    % make // 암호화툴을 컴파일 한다.
    % cp screw /usr/bin
    암호화툴을 적당한 디렉토리에 복사한다. PATH가 잡혀 있는 디렉토리 추천
    4. 사용법
    % cat test.php
    % screw test.php
    Success Crypting(test.php)
    % ls -al
    -rw-r--r-- 1 root root 38 May 23 00:56 test.php
    -rw-r--r-- 1 root root 20 May 23 00:56 test.php.screw
    * 영문 README 파일보기
    내용출처 : [기타] 인터넷 : <A class=con_link href="http://www.ihelpers.co.kr" target=_blank>http://www.ihelpers.co.kr</A>




     

    Posted by 새로운시작
    |

    주의 . 이 글은 외국의 http://syno.haeflinger.com/index.php/USBStation2 를 기반으로 번역 작성된 것입니다.
             모든 저작권은 원 출처에 있으며, 잘못된 번역이나 오역이 있을 수 있으므로
             참고하여 읽어 주시면 감사 드리겠습니다.

     USB STATION 2는Synology의 새로운 모델 입니다.

    이 제품은 800MHz의 프로세서와 RAM 128MB로 구성되어 있으며, 냉각 팬이 없어서, 매우 조용합니다. 이 제품은 내장형 하드디스크가 있지 않지만, DSM 버전 3.0(빌드1336) 이 내장되어 있으며, USB 드라이브를 연결하여 사용 합니다. ( USB가 2개 내장되어 있습니다)

     공식제품설명

    개 요

    1. 포장풀기
    2. 시작하기
      1. 디스크를 연결하기
      2. 시스템 정보
    3. USB STATION 2 DSM 소개
      1. 제어판
      2. 응용프로그램 사용
      3. 시스템 정보
      4. 디스크 정보
    4. 미디어서버 – DLNA
    5. Ipkg 설치
      5.5 설치 방법
           5.5.1 새로운 펌웨어 설치
           5.5.2 ipkg 설치
    6. 성능
    7. 결론

     포장풀기

    시작하기

    이 제품을 사용하기 위해서는 간단하게 전원을 넣으면 됩니다. 네트워크는 DHCP로 자동으로 연결되며, DSM 3.0 인터페이스를 통해 쉽게 이용할 수 있습니다. 이 제품의 펌웨어는 내부 플래시 메모리를 통하여 저장됩니다. 또한 FAN이 없기 때문에, 소음이 발생되지 않습니다. 이 제품은 약 4W 정도의 전력이 소비 됩니다.

    디스크를 연결하기

    제품에 내장된 USB 포트를 통하여, 2.5인치 하드디스크 (NTFS포멧, 250GB) 를 연결 합니다. 이 제품은 사용시에는 7.6w의 전력이 소모되며, 대기시에는 6.6w가 소모 됩니다.

    시스템 정보

    리눅스 커널 및 CPU에 관한 정보

     

    외부로 연결된 2개의 USB 디스크와 몇가지 정보

     USB STATION 2 DSM 소개

     DSM 3.0의 처음 화면 입니다.

    제어판

    여기에서 다양한 어플리케이션 설정을 사용할 수 있습니다.

    응용 프로그램 사용

    여기에 사용 가능한 응용 프로그램과, 리소스를 볼 수 있는 창이 바탕화면에 표시되어 있습니다.

     

    시스템 정보

    외장 드라이브 (2.5인치)와 1기기가 SD카드와 카드 리더기로 삽입된 2기가 XD카드가 표시된 시스템 정보 입니다.

    디스크 정보

    설치된 디스크에 대한 파티션 정보를 출력합니다. 외장드라이브 및 SD카드, XD카드의 파티션 형식을 보여 줍니다.

    또 다른 예시 입니다.

    안전하게 디스크를 제거하기 위해서는 DSM을 이용하거나, 제품의 오른쪽에 있는 버튼을 이용하여 제거할 수 있습니다. DSM을 통하여 사용하는 디스크 제거는 선택적으로 가능하지만, 버튼을 통해서는 모든 디스크를 일괄 제거 합니다.

    미디어 서버 – DLNA

    USB STATION2는 미디어 서버기능이 내장되어 있습니다. 이 기능은 어떠한 디스크를 통해서 인덱스 파일을 생성할 것인지 설정이 가능합니다.

    미디어 파일이 어디에 저장될 것인지 위치를 지정할 수 있습니다.

    비디오, 음악, 사진 등은 위에서 미리 정의된 폴더를 참조합니다.

    주의. 미디어 파일은 전체 디스크가 아닌, 특정 위치에 저장되며, 이 설정을 참조로 미디어 파일을 NAS에서 찾습니다. 이는 특정위치에만 색인이 저장되므로, 데이터가 손상될 수 있음에 주의해야 합니다.

     Ipkg 설치

    시스템 파티션 "/"이 읽기전용(타입 squashfs)로 되어 있다는 것을 알았을 때, 누군가가 엑세스 권한이 가능하도록 분석하지 않는다면 설치가 어렵다는 사실을 알았습니다.

    USBStation> mount

    /dev/root on / type squashfs (ro,relatime)
    /tmp on /tmp type tmpfs (0)
    none on /dev/pts type devpts (gid=4,mode=620)
    /sys on /sys type sysfs (0)
    /proc/bus/usb on /proc/bus/usb type usbfs (0)
    /dev/sdk1 on /volumeUSB1/usbshare type ext4 (nodelalloc)
    /dev/sdl1 on /volumeUSB3/usbshare type vfat (utf8,umask=000,shortname=mixed,uid=1024,gid=100)

     마지막 2개의 라인은 카드 리더기에 해당 됩니다:

    • /dev/sdk1 : 4GB의 CF 카드 (ext4 형식)
    • /dev/sdl1 : 1GB SD 카드 (FAT32 형식)

    USBStation> df -h

    Filesystem Size Used Available Use% Mounted on
    /dev/synoboot1 64.5M 64.5M 0 100% /
    /tmp 61.5M 612.0K 60.9M 1% /tmp
    /dev/sdk1 3.7G 145.5M 3.5G 4% /volumeUSB1/usbshare
    /dev/sdl1 941.6M 236.8M 704.8M 25% /volumeUSB3/usbshare

     그렇기 때문에, 시놀리지 공식 포럼 및 여기 사이트를 방문하여 펌웨어 업데이트를 통하여, ipkg가 적용 가능한 것을 알게 되었습니다.

    설치 방법

    쉽게 펌웨어를 설치할 수 있는 방법을 소개 합니다.
    이 업데이트를 통하여, 잘못되었을 경우 모든 책임은 사용자에게 있습니다.

    설치방법

    1. 압축해제 (7개의 rar 파일)
    2. PC에 해제된 파일 보관 (약 69MB)
    3. USBStation의 관리 페이지를 열고 (제어판) 펌웨어 업데이트 페이지로 이동
    4. 새로운 펌웨어를 선택 합니다 (us2-20101124-fsicon.pat)

        5.  "확인"을 클릭 합니다.

    새로운 펌웨어 설치

    펌웨어가 설치되었다면, SSH 또는 텔넷으로 로그인하여 아래와 같이 변화가 있는지 체크 합니다.

    원본 펌웨어에 비해, 위의 심볼릭링크(volume1/@optware)가 생성되었고, 약간의 파티션 크기도 변경 되었습니다.

    USBStation> df -h

    Filesystem Size Used Available Use% Mounted on
    /dev/synoboot1 65.3M 65.3M 0 100% /
    /tmp 61.5M 616.0K 60.9M 1% /tmp
    /dev/sdk1 3.7G 145.5M 3.5G 4% /volumeUSB1/usbshare
    /dev/sdl1 941.6M 236.8M 704.8M 25% /volumeUSB3/usbshare

    이제 ipkg를 설치 가능하게 되었습니다.

    Ipkg 설치

    Ipkg를 설치하기 위해서는, 내부 메모리에도 설치가 가능하지만, 용량이 제한 됩니다. 그렇기 때문에 외부에 연결된 (디스크, USB 메모리 카드 등)에 패키지를 설치 합니다.

    설치 파일을 업로드 합니다.

    cd /volumeUSB1/usbshare

    wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/syno-mvkw-bootstrap_1.2-7_arm.xsh

    아래와 같이 입력하고

    cd /volumeUSB1/usbshare
    mkdir @optware
    cd /volume1/
    ln -s /volumeUSB1/usbshare/@optware

    다음 설치를 진행 합니다.

    cd /volumeUSB1/usbshare
    sh syno-mvkw-bootstrap_1.2-7_arm.xsh

    아래의 과정을 통해서 /opt 폴더가 /volume1/@optware (/dev/sdk1로 마운트) 됨을 확인할 수 있습니다.

    USBStation> df –h

    Filesystem Size Used Available Use% Mounted on
    /dev/synoboot1 65.3M 65.3M 0 100% /
    /tmp 61.5M 616.0K 60.9M 1% /tmp
    /dev/sdk1 3.7G 145.5M 3.5G 4% /volumeUSB1/usbshare
    /dev/sdl1 941.6M 236.8M 704.8M 25% /volumeUSB3/usbshare

    /opt 폴더와 /volumeUSB1/usbshare/@optware (cf 메모리)가 동일한 크기 입니다

    USBStation> cd /volume1

    USBStation> ls -l
    lrwxrwxrwx 1 root root 29 Nov 25 08:40 @optware -> /volumeUSB1/usbshare/@optware

    Ipkg 업데이트

    USBStation> date
    Thr Nov 25 16:28:44 CET 2010

    USBStation> ipkg update
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/Packages.gz
    Inflating http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/Packages.gz
    Updated list of available packages in /opt/lib/ipkg/lists/cross
    Successfully terminated.

    USBStation>

    PHP 설치하기

    USBStation> ipkg install php

    Installing php (5.2.14-1) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/php_5.2.14-1_arm.ipk
    Installing bzip2 (1.0.6-1) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/bzip2_1.0.6-1_arm.ipk
    Installing openssl (0.9.8p-1) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/openssl_0.9.8p-1_arm.ipk
    Installing libxml2 (2.7.7-2) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/libxml2_2.7.7-2_arm.ipk
    Installing libxslt (1.1.26-1) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/libxslt_1.1.26-1_arm.ipk
    Installing gdbm (1.8.3-2) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/gdbm_1.8.3-2_arm.ipk
    Installing libdb (4.2.52-3) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/libdb_4.2.52-3_arm.ipk
    Installing pcre (8.10-1) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/pcre_8.10-1_arm.ipk
    Installing cyrus-sasl-libs (2.1.23-2) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/cyrus-sasl-libs_2.1.23-2_arm.ipk
    Installing psmisc (22.13-1) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/psmisc_22.13-1_arm.ipk
    Installing openldap-libs (2.3.43-2) to root...
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/openldap-libs_2.3.43-2_arm.ipk
    Configuring bzip2
    update-alternatives: Linking //opt/bin/bzip2 to /opt/bin/bzip2-bzip2
    Configuring cyrus-sasl-libs
    Configuring gdbm
    Configuring libdb
    Configuring libxml2
    Configuring libxslt
    Configuring openldap-libs
    Configuring openssl
    Configuring pcre
    Configuring php
    Configuring psmisc
    update-alternatives: Linking //opt/bin/killall to /opt/bin/psmisc-killall
    update-alternatives: Linking //opt/bin/pidof to /opt/bin/psmisc-killall
    Successfully terminated.

    확인

    USBStation> which php
    /opt/bin/php

    USBStation>

    성능

    개인적으로 테스트를 해보지 않았지만, EXT3와 NTFS로 포맷된 하드디스크를 아래와 같이 수치를 제공 합니다.

    테스트 한 PC는 GS105 넷기어와 USB 2GB의 파일을 1GB/s의 랜(MTC 1500)을 통하여 진행하였습니다. 프로그램은 FileZilla 를 사용하였으며, AMD 애슬론 64x2 듀얼코어 4600+ 2.41GHz (윈도우 7)의 환경 입니다.

     디스크 포맷 EXT3 (USB 외장형 IDE 드라이브)

    • PC -> USB Station : 14 Mo/s (Ecriture)
    • USB Station -> PC : 17 Mo/s (Lecture)

    디스크 포맷 NTFS (2.5인치)

    • PC -> USB Station : 4 à 5 Mo/s (Ecriture)
    • USB Station -> PC : 14 Mo/s (Lecture)

     아래는 Synology의 자료 입니다.

    테스트 전송 및 리소스 모니터에서의 네트워크 사용량

     

    결론

    USB 외장형 드라이브를 사용하는 NAS로써, 조용하고 쾌적하며 매우 적은 전력을 소모랍니다.
    또한 DSM 3.0 인터페이스를 사용합니다.

    그것은 EXT3, 4를 지원하며, NTFS인 디스크 및 USB, 메모리 카드(SD,XD,CF 등)을 지원합니다. 그렇지만 안타깝게도 내트워크 백업은 지원하지 않습니다.

    또한 가격이 매우 저렴합니다.

    Posted by 새로운시작
    |
    majorversion="3"
    minorversion="0"
    buildphase="0"
    buildnumber="1338"
    builddate="2010/09/29"
    unique="synology_88f6180_us2"
    extractsize=195324

    빌드정보가 1338인 베타 펌웨어 입니다.
    제조사에서 공식적으로 제공되는 펌웨어는 아닙니다.

    특별하게 외관적으로는 변한게 없습니다만.
    이전 초기펌웨어(빌드 1336)에서는 약간 불안정한 동작이 발견되어 테스트 중에 있습니다.

    * 추신 : optware 용 폴더는 생성되지 않습니다. ( Not Include OPT folder. )
    * 주의 : 이 펌웨어를 설치 후에는 다운그레이드 되지 않습니다 ( Don`t Downgrade FW. Synology Inc, limited. )




    Posted by 새로운시작
    |