| [ WWW ] in KIDS 글 쓴 이(By): pill (알약) 날 짜 (Date): 1996년09월02일(월) 20시41분34초 KDT 제 목(Title): 방문한 사람 ip알기.. #include <stdio.h> #include <stdlib.h> main() { char *addr,*host; char where[50]; FILE *fp; printf("Content-type: text/html\n\n"); addr = getenv( "REMOTE_HOST" ); if((fp=fopen("../where.html","a"))==NULL){ puts("File Open Error"); exit(1); } fprintf(fp,"Where:"); fprintf(fp,"%s\n", addr); fprintf(fp,"<br>"); fclose(fp); printf("You've come from %s.",where); } } 이상은 c로 짠 cgi입니다. 방문자의 ip를 읽어와서 where.html이라는 화일에 기록을 하지요. 아마도 도메인 네임으로 나오게 하려면 조금더 연구를 해야.. 저 같은 경우는 항상 들어오는 ip들은 도메인 네임을 나오게 했는데. 직접 도메인 네임을 환경변수로 불러오는 방법은 잘 모르겠습니다. 필~ ********************************************************************* Philsung, Kim. Organization Science & Evaluation Research Lab, Department of Industrial Management, KAIST (042) 869-5352, 4352 PAGER: (015) 404-8673 EMAIL: pill@mgt.kaist.ac.kr ********************************************************************* |