반응형


:: ASP 에서 표현할 경우
     response.write(formatnumber( value, 0, -1 ))

:: PHP 에서 표현할 경우
     echo number_format($value);

:: Perl Script 에서 표현할 경우
     print cm($value);
    sub cm {
          my $num = shift;
          my ($n) = $num =~ /(\d+)/;
          1 while $n =~ s/(\d+)(\d{3})/$1,$2/;
          $num =~ s/(\d+)/$n/;
          $num;
     }

:: JSP 에서 표현할 경우
     new DecimalFormat("###,###,###,###,###").format(value);
     보통은 Bean으로 만들어서 표현을 합니다.

:: MS-SQL Query에 의해 표현할 경우
     SELECT
    REPLACE(CONVERT(VARCHAR,CONVERT(MONEY,1234567890),1),'.00','')
     결과값          
     1,234,567,890
     (1개 행 적용됨)
반응형

'WEB > CGI' 카테고리의 다른 글

Classic ASP Tricks  (0) 2019.07.15
ASP 에서 쿠키 <-> PHP에서 쿠키  (0) 2010.10.21
PHP, universal file download logic  (0) 2010.10.21
php for windows 로 메일보내기  (0) 2010.10.21
PHP 숫자에 점찍기, 소수점이하 '..'처리  (0) 2010.10.21
반응형

Response.Cookies("user")("id") = 'userid'
Response.Cookies("user")("name") = 'abc'
Response.Cookies("user")("adult") = 'Y'



echo $_COOKIE['user'];
id=userid&name=abc&adult=Y
반응형
반응형
반응형

'Tip & Tech > Linux | Unix' 카테고리의 다른 글

Jenkins 다른 계정으로 구동  (0) 2019.07.15
GCC .so만들기  (0) 2010.10.21
shell scripting - date 사용하기  (0) 2010.10.21
AVR-GCC 설치법...  (0) 2010.10.21
Solaris 에서의 pkgadd 사용 예  (0) 2010.10.21
반응형

// $Path : 파일의 풀패스(http://..보다는 실제 상대디렉토리로 지정해주는게 좋다)
// $user_file : 파일명.

header("Cache-control: private");
if (eregi("(MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)) {
            Header("Content-type:application/octet-stream");
            Header("Content-Length:".filesize($Path));
            Header("Content-Disposition:attachment;filename=".$user_file);
            Header("Content-Transfer-Encoding:binary");
            Header("Pragma:no-cache");
            Header("Expires:0");
        } else {
            Header("Content-type:file/unknown");
            Header("Content-Length:".filesize($Path));
            Header("Content-Disposition:attachment; filename=".$user_file);
            Header("Content-Description:PHP3 Generated Data");
            Header("Pragma: no-cache");
            Header("Expires: 0");
        }

        if (is_file($Path)) {
            $fp = fopen($Path, "rb");
            if (!fpassthru($fp)) fclose($fp);
            clearstatcache();
        } else {
            echo "해당 파일이나 경로가 존재하지 않습니다.";
        }



// php school에서 팁에 올라와있는거 정리했숩니다.
반응형
반응형

== windows: dhcp 에서 외부 ISP의 smtp를 이용하여 메일발송 하기 ==

1. php.ini에서 smtp세팅을 수정한다.

[mail function]
; For Win32 only.
SMTP =mail.kornet.net

; For Win32 only.
sendmail_from =id@mydomain.com

2. 관리도구->인터넷 정보 서비스->기본 SMTP 가상 서비스
엑세스탭, 연결제어(연결(N)): 아래목록만에 사용할 smtp서버 등록 (mail.kornet.net)

엑세스탭, 릴레이제한(릴레이(E)): 아래목록만에 사용할 smtp서버 등록 (mail.kornet.net)

3. 아파치, smtp 가상서비스 재시작

4. 테스트
#================================================================
<?        
mail("foolbabo@netian.com", "후후후클클클", "이혀순입니다.php + winNT + console로 보내고 있3",
     "From: 이혀순(webmaster@windows.or.kr)\nReply-To: foolbabo@netian.com\nContent-Type:text/html;charset=EUC-KR\nX-Mailer: PHP/".phpversion());
                
?>
#================================================================

반응형

'WEB > CGI' 카테고리의 다른 글

ASP 에서 쿠키 <-> PHP에서 쿠키  (0) 2010.10.21
PHP, universal file download logic  (0) 2010.10.21
PHP 숫자에 점찍기, 소수점이하 '..'처리  (0) 2010.10.21
PHP 날짜 더하기, 날짜 비교하기  (0) 2010.10.21
PHP MSSQL용 API  (0) 2010.10.21
반응형

echo number_format(145677676) ."<br>";
echo number_format(145677676,2) ."<br>";
echo number_format(145677676.42,2) ."<br>";

//결과
//145,677,676
//145,677,676.00
//145,677,676.42
반응형

'WEB > CGI' 카테고리의 다른 글

PHP, universal file download logic  (0) 2010.10.21
php for windows 로 메일보내기  (0) 2010.10.21
PHP 날짜 더하기, 날짜 비교하기  (0) 2010.10.21
PHP MSSQL용 API  (0) 2010.10.21
2000 이후 달라진 SMTP (ASP, CDO)  (0) 2010.10.21
반응형

--- 더하기 ---

echo strtotime("+1 day"), "\n";
오늘에서 하루뒤, 즉 내일의 timestamp가 출력됩니다.
즉,

date('ymd',strtotime("+1 day"));
로하면 내일의 ymd형식의 날짜가 출력됩니다.
+2로하면 이틀 뒤
32일이라도 알아서 변경해줍니다.
timestamp형식이기 때문이죠.

뭐, date('ymd',mktime(0,0,0,date('m'),date('d')+2,date('Y')));
로 해도 결과는 같습니다.
정형화되게 할려면 mktime를 사용하는게 좋습니다.


--- 비교하기 ---
        $senddate = "2006-01-09"        ;                        
                $todate =date ("Y-m-d", mktime(0,0,0,date('m'),date('d'),date('Y')) );


        $ee = strtotime($todate);
        $ss = strtotime($senddate);
        $day = 86400;
        
        
        echo ($ee-$ss)/$day."<br>";
        

        echo "<br>".$senddate;
        echo "<br>".$todate;
반응형

'WEB > CGI' 카테고리의 다른 글

php for windows 로 메일보내기  (0) 2010.10.21
PHP 숫자에 점찍기, 소수점이하 '..'처리  (0) 2010.10.21
PHP MSSQL용 API  (0) 2010.10.21
2000 이후 달라진 SMTP (ASP, CDO)  (0) 2010.10.21
csv 파일 서버 저장 JSP  (0) 2010.10.21
반응형


// 1. 커넥트 (1포인트 획득)
$conexao = mssql_connect("host ip or domain","id","password");
// 2. 디비선택 (1포인트획득)
mssql_select_db("database",$conexao);                

// 3. 주위에 외치기 ( 1포인트 획득)
$qu = "select count(*) as ctn  from talbe";
//echo $qu;

// 4. 쿼리 실행하여 결과 받아오기 (1포인트 획득)
$query = mssql_query($qu);
// 5. 쿼리를 object로 페치 (1포인트 획득)
$retorno = mssql_fetch_object($query);

// 5. 총 5포인트 버블로 해당 데이터 불러오기
$dccount = $retorno->ctn;
반응형
반응형

/*
$file_ext : 확장자 명 (ex : jpg)
$file_name : 입력한 파일 명 (ex : sss.jpg)
*/

/* 1. substr */
/*------------------------------------------------------*/
$file_ext = substr( strrchr($file_name,"."),1);
/*------------------------------------------------------*/

/* 2. explode */
/*------------------------------------------------------*/
$type = explode(".", $file_name);
$file_ext = $type[count($type)-1];  
/*------------------------------------------------------*/

/*
        1. substr을 이용하여 "."으로 구분해 내는 방법...
           xxx.tar.z 와 같은 "."가 여러개인 경우 해결 방법은
        마지막 "."뒤의 스트링만 확장자로 분리하여야 한다.
        그 해결방법으로
        2. explode를 이용하여 "."을 기준으로 배열에 저장 후
        배열의 크기-1 의 위치에 있는 스트링이 확장자를 분리해
        낼 수 있다.  
*/
반응형

'WEB > CGI' 카테고리의 다른 글

*OutputStream 한글 인코딩 처리  (0) 2010.10.21
JSP 파일 업로드  (0) 2010.10.21
E-mail programming 관련  (0) 2010.10.20
JSP에서 한글인코딩이 안될때  (0) 2010.10.20
PHP 문자열중 원하는 Tag만 제거하기  (0) 2010.10.19
반응형

[PHP] PHP Full Library 컴파일
.....................................................................
http://prdownloads.sourceforge.net/freetype/freetype-2.2.1.tar.gz?download
freetype : remove
# rpm -qa |grep freetype
freetype-2.1.3-6
# rpm -e --nodeps freetype-2.1.3-6

freetype : install
# cd freetype-2.1.10
# ./configure
# make
# make install
# cd /usr/local/include/ 해서 freetype2가 설치되어 있는지 확인합니다.

.....................................................................
http://prdownloads.sourceforge.net/libungif
http://sourceforge.net/project/showfiles.php?group_id=102202
libgif : remove

libgif : install
# cd giflib-4.1.0
# ./configure
# make
# make install
# ls -al /usr/local/lib/libgif.a : 날짜확인

libungif : remove

libungif : install
# cd libungif-4.1.0
# ./configure
# make
# make install

.....................................................................
http://prdownloads.sourceforge.net/libpng/
libpng : remove
# rpm -qa | grep libpng
libpng-1.2.2-16
# rpm -e --nodeps libpng-1.2.2-16

libpng : install
# ./configure
# make
# make install

libpng : install
# cd libpng-1.2.8
# cd scripts
# cp makefile.linux ../makefile
# cd ..
# make test
=> 컴파일 에러 발생하면..........................
# cd /usr/local/lib
# cp libz.so* /usr/lib
# cd /usr/lib
[lib]# rm -rf libz.so
[lib]# rm -rf libz.so.1
[lib]# ln -s libz.so.1.2.8 libz.so
[lib]# ln -s libz.so.1.2.8 libz.so.1
-------------------------------------------------
# make install
# ls -al /usr/local/lib/libpng*

libpng 1.2.9 ...............................
./configure
make
make install

..........................................................................
X 6b-33 이 설치되어있다면 제거하지 말고 devel RPM 만 추가 설치 요망.......
http://freshmeat.net/projects/libjpeg/
libjpeg : remove
# rpm -qa libjpeg
libjpeg-6b-26
# rpm -e --nodeps libjpeg-6b-26

another method From: http://site.n.ml.org/info/libjpeg/
I downloaded libjpeg-6b.tar.gz and put it in ~/tmp. There,
$ tar xzvf libjpeg-6b.tar.gz
$ cd jpeg-6b
$ ./configure --enable-shared
$ make test
$ make
. The directory /usr/local/man/man1 didn't exist. I created it, with:
# mkdir /usr/local/man
# mkdir /usr/local/man/man1
. Then,
# make install

# ls -al /usr/local/lib/libjpeg*

another method ................
libjpeg : install
# cd jpeg-6b
# ./configure
# make
# make test
# make install
# make install-lib
# make install-headers

.....................................................................
http://dl.maptools.org/dl/libtiff/
libtiff : remove
rpm -qa libtiff

libtiff : Install
# cd tiff-3.7.2/
# ./configure (Press enter/return to use default paths)
# make
# make install

.....................................................................
####################################################
gd 라이브러리를 등록하기전에 /usr/local/lib이 반드시 라이브러리패스에
등록되어 있어야 정상적으로 gd에서 위에 추가된 라이브러리를 불러온다.
# echo "/usr/local/lib" >> /etc/ld.so.conf
# /sbin/ldconfig
####################################################
http://www.boutell.com/gd/
libgd : remove
# rpm -qa gd
gd-1.8.4-11
# rpm -e --nodeps gd-1.8.4-11

libgd : install
# cd gd-2.0.28
# ./configure --with-freetype-dir=/usr/local/include/freetype2        ## 수정 옵션하나 추가.
# make
.....................................................................................
[root@ gd-2.0.35]# make
make: Warning: File `.deps/webpng.Po' has modification time 3e+04 s in the future
cd . && /bin/sh /home/nexer/pack/gd-2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
cd . && /bin/sh /home/nexer/pack/gd-2.0.35/config/missing --run automake-1.9 --foreign
cd . && /bin/sh /home/nexer/pack/gd-2.0.35/config/missing --run autoconf
configure.ac:64: error: possibly undefined macro: AM_ICONV
     If this token and others are legitimate, please use m4_pattern_allow.
     See the Autoconf documentation.
make: *** [configure] Error 1
make 중 아래 에러나면 "make"를 한번더 날려준다.....................................

# make install

.....................................................................
wget ftp://ftp.gnome.org/mirror/gnome.org/sources/libxml2/2.6/libxml2-2.6.22.tar.gz
wget ftp://ftp.gnome.org/mirror/gnome.org/sources/libxml2/2.6/libxml2-2.6.26.tar.gz
libxml : remove
#rpm -qa | grep libxml
libxml-1.8.17-8
# rpm -e --nodeps libxml-1.8.17-8

libxml : install
# cd libxml2-2.6.22
# ./configure
# make
# make install

.....................................................................
zlib : remove
# rpm -qa zlib
zlib-1.1.4-8
rpm -e --nodeps zlib-1.1.4-8

zlib : install
#cd zlib-1.2.1
//-->libz.so와 관련된 모듈을 생성시킨다 이것이 정말 중요하다
# ./configure -s
# make

//--> libz.a를 만든다
# ./configure
# make test
# make install

[root@davinci zlib-1.1.4]# mv libz.so* /usr/local/lib
[root@davinci zlib-1.1.4]# ls /usr/local/lib

####################################################
zlib을 새로 설치하였다면 /usr/local/lib이 반드시 라이브러리패스에
등록되어 있어야 rpm등 zlib을 사용하는 프로그램이 정상적으로 구동된다.
# echo "/usr/local/lib" >> /etc/ld.so.conf
# /sbin/ldconfig
####################################################

.....................................................................
mySQL 종료
mySQL 삭제

mySQL 설치
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-mysqld-user=root \
--with-charset=euckr

!!"--with-charset=euckr" <= euckr : 4.0 에서 사용안됨 4.1 에선 됨

make

make install

./scripts/mysql_install_db

/usr/local/mysql/bin/mysqld_safe --user=root &

.....................................................................
http://ftp.apache-kr.org/httpd/httpd-2.2.9.tar.gz    
아파치 종료.
아파치 삭제.

apache2 : install
./configure \
--prefix=/usr/local/apache2 \
--enable-module=so \
--enable-module=rewrite \
--enable-dav \
--enable-dav-fs \

2.2.9 //////////////
./configure \
--prefix=/usr/local/apache2 \
--enable-dav \
--enable-dav-fs \
--enable-so \
--enable-ssl

# make
# make install

.....................................................................
php 삭제.

php : install
./configure \
--prefix=/usr/local/php5 \
--with-exec-dir=/usr/bin \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-apache-install=/usr/local/apache2 \
--with-config-file-path=/etc \
--disable-debug \
--enable-safe-mode \
--enable-track-vars \
--enable-sockets \
--enable-mailparse \
--enable-calender \
--enable-sysvsem=yes \
--enable-sysvshm=yes \
--enable-magic-quotes \
--enable-gd-native-ttf \
--enable-versioning \
--enable-url-includes \
--enable-trans-id \
--enable-inline-optimization \
--enable-bcmath \
--enable-sigchild \
--enable-module=so \
\
--with-ttf \
--with-gettext \
--with-mod_charset \
--with-charset=euc_kr \
--with-language=korean \
\
--with-freetype \
--with-freetype-dir=/usr/local/include/freetype2 \
\
--with-xml \
--with-libxml-dir=/usr/lib \
--with-zlib \
--with-zlib-dir=/usr/lib \
--with-tiff \
--with-tiff-dir=/usr/lib \
--with-gd \
--with-gd-dir=/usr/lib \
\
--with-ungif \
--with-ungif-dir=/usr/local/lib \
--with-jpeg \
--with-jpeg-dir=/usr/local/lib \
--with-png \
--with-png-dir=/usr/local/lib \
--with-gif \
--with-gif-dir=/usr/local/lib \
\
--with-mysql

--with-mysql=/usr/lib/mysql

!!!!!!2008-09-12!!!!!! 성공함

DEFAULT LIB ++++++++++++++++++++++++++++++++++++++++++++++++++++++
./configure \
--prefix=/usr/local/php5 \
--with-exec-dir=/usr/bin \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-apache-install=/usr/local/apache2 \
--with-config-file-path=/etc \
--disable-debug \
--enable-safe-mode \
--enable-track-vars \
--enable-sockets \
--enable-mailparse \
--enable-calender \
--enable-sysvsem=yes \
--enable-sysvshm=yes \
--enable-magic-quotes \
--enable-gd-native-ttf \
--enable-versioning \
--enable-url-includes \
--enable-trans-id \
--enable-inline-optimization \
--enable-bcmath \
--enable-sigchild \
--enable-module=so \
\
--with-ttf \
--with-gettext \
--with-mod_charset \
--with-charset=euc_kr \
--with-language=korean \
\
--with-gd \
--with-gd-dir=/usr/lib \
--with-gif \
--with-gif-dir=/usr/lib \
--with-tiff \
--with-tiff-dir=/usr/lib \
\
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--with-png \
--with-png-dir=/usr/local/lib \
--with-jpeg \
--with-jpeg-dir=/usr/local/lib \
--with-xml \
--with-libxml-dir=/usr/local/lib \
\
--with-mysql=/usr/local/mysql

#--enable-ftp \

# make
# make install
# cp php.ini-dist /etc/php.ini

....................................................................

./configure \
--prefix=/usr/local/php5 \
--with-exec-dir=/usr/bin \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-apache-install=/usr/local/apache2 \
--with-config-file-path=/etc \
--disable-debug \
--enable-safe-mode \
--enable-track-vars \
--enable-sockets \
--enable-mailparse \
--enable-calender \
--enable-sysvsem=yes \
--enable-sysvshm=yes \
--enable-magic-quotes \
--enable-gd-native-ttf \
--enable-versioning \
--enable-url-includes \
--enable-trans-id \
--enable-inline-optimization \
--enable-bcmath \
--enable-sigchild \
--enable-module=so \
\
--with-ttf \
--with-gettext \
--with-mod_charset \
--with-charset=euc_kr \
--with-language=korean \
\
--with-tiff \
--with-tiff-dir=/usr/lib \
--with-xml \
--with-libxml-dir=/usr/lib \
\
--with-freetype \
--with-freetype-dir=/usr/local/include/freetype2 \
\
--with-gd \
--with-gd-dir=/usr/local/lib \
--with-gif \
--with-gif-dir=/usr/local/lib \
--with-jpeg \
--with-jpeg-dir=/usr/local/lib \
--with-xml \
--with-libxml-dir=/usr/local/lib \
\
--with-mysql=/usr/local/mysql


....................................................................
./configure \
--prefix=/usr/local/php5 \
--with-exec-dir=/usr/bin \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-apache-install=/usr/local/apache2 \
--with-config-file-path=/etc \
--disable-debug \
--enable-safe-mode \
--enable-track-vars \
--enable-sockets \
--enable-mailparse \
--enable-calender \
--enable-sysvsem=yes \
--enable-sysvshm=yes \
--enable-magic-quotes \
--enable-gd-native-ttf \
--enable-versioning \
--enable-url-includes \
--enable-trans-id \
--enable-inline-optimization \
--enable-bcmath \
--enable-sigchild \
--enable-module=so \
\
--with-ttf \
--with-gettext \
--with-mod_charset \
--with-charset=euc_kr \
--with-language=korean \
\
--with-jpeg \
--with-jpeg-dir=/usr/lib \
--with-mysql \
\
--with-freetype \
--with-freetype-dir=/usr/local/include/freetype2 \
\
--with-xml \
--with-libxml-dir=/usr/local/lib \
--with-png \
--with-png-dir=/usr/local/lib \
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--with-gd \
--with-gd-dir=/usr/local/lib \
--with-gif \
--with-gif-dir=/usr/local/lib \
--with-ungif \
--with-ungif-dir=/usr/local/lib \
--with-tiff \
--with-tiff-dir=/usr/local/lib
반응형

+ Recent posts