engine = On : Apache에서 PHP 스크립트 언어 엔진 적용(Off로 설정시 PHP파일을 보여주지 못하고 다운로드하게 됨) zend.ze1_compatibility_mode = Off : zend 엔진 버전1의 호환모드 설정 short_open_tag = On : <? 태그 사용 허용(Off로 설정시 <?php, 와 <script> 태그만 인식) asp_tags = Off : ASP 스타일의 <%, %> 태그 사용여부 설정 precision = 12 : 부동소수점의 유효 자리수 설정 y2k_compliance = On : 2000년 호환모드로 설정 output_buffering = Off : 모든 파일의 출력 버퍼링 활성화 여부 설정(구체적인 숫자 입력시 출력 버퍼링을 특정 사이즈로 제한) ;output_handler = : 스크립트의 모든 출력을 특정 함수를 통해 할 수 있음 zlib.output_compression = Off : zlib을 사용해 페이지를 압축할 것인지 설정 ;zlib.output_compression_level = -1 : 압축 레벨 설정 ;zlib.output_handler = : zlib.output_compression을 활성화할 경우, 추가 출력 핸들러를 지정할 수 없음 implicit_flush = Off : On 설정시 print(), echo() 및 각 HTML 블록의 뒤에 flush()함수를 부르는 것과 동일하게 작용(성능저하 유발)
unserialize_callback_func = : unserialize 중에 정의되지 않은 클래스를 작성해야 할 경우, 콜백 함수를 호출(정의되지 않은 클래스를 작성해야 할 때마다 호출) allow_call_time_pass_reference = On : 함수 사용시 변수를 강제적으로 참조하는 것 금지
safe_mode = Off : 안전모드 사용여부 설정 safe_mode_gid = Off : 파일이 열릴 때, UID 비교검사 수행(On 설정시 GID 비교검사 수행) safe_mode_include_dir = : 지정한 디렉토리 및 하위 디렉토리의 파일을 include 하는 경우, UID/GID 검사 미수행 safe_mode_exec_dir = : (안전모드에서) system() 및 시스템 프로그램을 실행하는 함수의 경로(이 디렉토리에 없으면 함수를 실행할 수 없음) safe_mode_allowed_env_vars = PHP_ : (안전모드에서) 지정된 문자로 시작하는 환경변수만 변경 가능 safe_mode_protected_env_vars = LD_LIBRARY_PATH : putenv()로 변경할 수 없는 환경변수 설정 ;open_basedir = : 안전모드와 관계없이 PHP가 열 수 있는 디렉토리 설정 disable_functions = : 특정 함수 사용 금지 설정 disable_classes = : 특정 클래스 사용 금지 설정 ;highlight.string = #DD0000 : 문법의 하이라이트 표시 설정(string, comment, keywork, bg, default, html 설정 가능) ;ignore_user_abort = On : 클라이언트가 연결을 끊었을 때, 스크립트 수행을 중단한 것인지 설정(기본값은 스크립트 중단) ;realpath_cache_siae = 16k : realpath 캐쉬 양 설정 ;realpath_cache_ttl = 120 : 캐쉬의 유효기간을 초단위로 설정 expose_php = On : PHP가 해당 서버에 인스톨되고, 사용되고 있다는 내용 알림 설정(On 설정시 내용 알림)
max_execution_time = 30 : 스크립트 최대 실행시간(초단위) 설정 max_input_time = 60 : POST, GET, 파일업로드 등의 입력 데이터를 받아들이는 최대시간(초단위) 설정 memory_limit = 128M : 스크립트가 사용할 수 있는 최대 메모리양 설정
error_reporting = E_ALL & ~E_NOTICE : E_NOTICE를 제외한 모든 에러 출력(다음의 항목들이 사용 가능함, E_ALL[각주:1], E_ERROR[각주:2], E_RECOVERABLE_ERROR[각주:3], E_WARNING[각주:4], E_PARSE[각주:5], E_NOTICE[각주:6], E_CORE_ERROR[각주:7], E_CORE_WARNING[각주:8], E_COMPILE_ERROR[각주:9], E_COMPILE_WARNING[각주:10], E_USER_ERROR[각주:11], E_USER_WARNING[각주:12], E_USER_NOTICE[각주:13])
display_errors = On : 에러 표시 설정(보안상 이 기능 대신 error_log를 사용할 것을 권장) display_startup_errors = Off : PHP 시작시 에러 미표시 설정 log_errors = Off : 로그파일에 에러로그 기록여부 설정 ignore_repeated_errors = Off : 반복된 에러의 기록여부 설정(Off 설정시 반복 에러 기록 안함) track_errors = Off : $php_errormsg에 마지막 에러/경고 메시지 저장 여부 설정 ;html_errors = Off : 에러 메세지에 HTML 태그 추가여부 설정(Off 설정시 HTML 태그 미추가) ;error_prepend_string = "" : 에러 메세지 앞에 출력하는 라인 설정 ;error_append_string = "" : 에러 메세지의 뒤에 출력하는 라인 설정 ;error_log = filename : 지정된 파일에 에러 기록 ;error_log = syslog : syslog에 에러 기록
;arg_separator.output = "&" : PHP가 생성한 URL 인자를 구분하는 구분자 설정
;arg_separator.input = ";&" : PHP가 URL에서 변수를 분리하는데 사용하는 구분자 설정
variables_order = "EGPCS" : EGPCS[각주:14] 변수의 파싱순서 설정(GP로 설정시 GET 변수는 같은 이름의 POST 변수에 덮어씌워짐)
register_globals = Off : 입력 데이터의 글로벌 변수 등록여부 설정(Off 설정시 $var 대신 $_REQUEST["var"],
;include_path = ".:/php/includes" : require(), include(), fopen_with_path() 함수가 파일을 찾는 디렉토리 목록 설정 doc_root = : PHP 루트 디렉토리 설정(안전모드 설정시 루트 디렉토리 밖의 파일은 사용할 수 없음) user_dir : PHP 파일을 사용하는 유저의 홈 디렉토리(public_html) 이름 설정 extension_dir = "/usr/local/server/php/modules" : 확장모듈 디렉토리 설정 extension = mysqli.so ; : PHP가 시작할 때 읽어들일 모듈 설정 enable_dl = On : dl() 함수를 유효하게 할 것인지 설정 ; cgi.force_redirect = 1 : 대부분의 웹서버에서 PHP를 CGI로 사용할 때 보안을 위해 설정(기본값 On) ; cgi.redirect_status_env = ; : ? ;cgi.rfc2616_headers = 0 : PHP가 HTTP 응답코드를 보낼때 사용할 헤더 설정(0 설정시 Status: 헤더를, 1 설정시 RFC 2616 호환 헤더 전송)
file_uploads = On : 파일 업로드 허가여부 설정 ;upload_tmp_dir = : HTTP로 파일 업로드시 임시 작업 디렉토리 설정(미 지정시 시스템 디폴트 디렉토리[각주:15]가 사용됨) upload_max_filesize = 2M : 업로드 파일의 최대 사이즈 설정
allow_url_fopen = Off : 파일 액세스시 외부사이트 파일을 불러올 수 있는지여부 설정(보안상 Off로 설정할 것을 권장함) ;from="admin@myhome.com" : 익명 FTP의 패스워드 설정 ;user_agent = "PHP" : PHP가 전송하는 유저에이전트 설정 default_socket_timeout = 60 : 소켓기반 스트림의 기본 시간제한 설정 ;auto_detect_line_endings = Off : fget(), file()로 읽은 데이터의 줄바꿈 방식 선택여부 설정(On 설정시 유닉스, MS-DOS, 매킨토시 방식 중 어떤 것을 사용할 것인지 검사)
$GLOBALS |
모든 전역변수의 배열(global키워드처럼 함수 안에서 글로벌 변수에 접근할 수 있다. $GLOBALS['myvar']처럼 접근 |
$_SERVER |
서버환경 변수의 배열 |
$_GET |
GET 메소드로 넘어온 변수의 배열 |
$_POST |
POST 메소드로 넘어온 변수의 배열 |
$_COOKIE |
쿠키 변수의 배열 |
$_FILES |
파일 업로드와 관련된 변수의 배열 |
$_ENV |
환경 변수의 배열 |
$_REQUEST |
사용자가 입력한 변수의 배열로 $_GET, $_POST, $COOKIE를 포함 |
$_SESSION |
세션 변수의 배열 |
[산술 연산자]
연산자 |
설명 |
+ |
더하기 |
- |
빼기 |
* |
곱하기 |
/ |
나누기 |
% |
나머지 |
[복합 대입연산자]
연산자 |
예제 |
설명 |
+= |
$a += $b |
$a = $a +$b |
-= |
$a -= $b |
$a = $a - $b |
*= |
$a *= $b |
$a = $a * $b |
/= |
$a /= $b |
$a = $a / $b |
%= |
$a %= $b |
$a = $a % $b |
.= |
$a .= $b |
|
[비교연산자]
연산자 |
예제 |
설명 |
== |
$a == $b |
값이 같을 경우 1 == '1'도 참이 됨 |
=== |
$a === $b |
값뿐만 아니라 Type도 같은 경우에만 참이 됨 1 === 1만 참, 1==='1'은 거짓 |
!= |
$a != $b |
type과 상관없이 값이 다른경우 |
!== |
$a != $b |
Type만 달라도 다른 값으로 확인 |
< |
$a <$b |
작다 |
> |
$a >$b |
크다 |
<= |
$a <= 15 |
작거나 같다 |
>= |
$b >=6 |
크거나 같다 |
[논리연산자]
연산자 |
예제 |
설명 |
! |
!$a |
$a의 값 true→false, false →true |
&& |
$a && $b |
모두 true이면 true |
|| |
$a || $b |
둘중에 하나라도 true이면 true |
and |
$a and $b |
&&과 같음(우선순위는 낮음) |
or |
$a or $b |
||와 같음(우선순위는 낮음) |
xor |
$a xor $b |
두 개의 논리값이 같으면 false, 다르면 true |
[연산자 우선순위]
결합 순서 |
연산자 |
비고 |
없음 |
( ) |
|
없음 |
new |
|
왼쪽 |
[ ] |
|
없음 |
++ -- |
|
없음 |
~ - (int) (float) (string) (array) (object) (bool) @ |
|
없음 |
instanceof |
|
오른쪽 |
! |
|
왼쪽 |
* / % |
|
왼쪽 |
+ - . |
|
왼쪽 |
<< >> |
|
없음 |
< <= >>= <> |
|
없음 |
== != === !== |
|
왼쪽 |
& |
|
왼쪽 |
^ |
|
왼쪽 |
| |
|
왼쪽 |
&& |
|
왼쪽 |
|| |
|
왼쪽 |
? : |
|
오른쪽 |
= += -= *= /= .= %= &= |= ^= <<= >>= |
|
왼쪽 |
and |
|
왼쪽 |
xor |
|
왼쪽 |
or |
|
왼쪽 |
, |
다양한 사용 |
[형 검사 함수]
함수 |
내용 |
is_array() |
변수가 배열인지 |
is_double() |
변수가 부동소수점인지 검사 |
is_float() |
|
is_real() |
|
is_long() |
변수가 정수형인지 검사 |
is_int() |
|
is_integer() |
|
is_string() |
변수가 문자열인지 검사 |
is_bool() |
변수가 불린형인지 검사 |
is_object() |
변수가 객체인지 검사 |
is_resource() |
변수가 자원인지 검사 |
is_null() |
변수가 비어있는지 검사 |
is_scalar() |
변수가 정수형, 불리언, 문자열, 실수형인지 검사 |
is_numeric() |
변수가 숫자 또는 숫자로 구성된 문자열인지 검사 |
is_callable() |
변수에 지정된 값이 호출될 수 있는 함수의 이름인지 검사 |
[변수 상태 검사]
함수 |
내용 |
isset(변수이름) |
변수가 존재하면 true, 아니면 false |
empty(변수이름) |
변수가 존재하고 비어있지 않고, 0이 아닌값을 가지고 있으면 false 아니면 true |
[형 변환 함수]
함수 |
내용 |
intval("숫자", 진수) |
숫자를 지정된 진수로 인식해서 10진수 숫자로 변환해서 반환함 |
floatval(숫자) |
숫자를 실수형으로 변환 |
strval(숫자) |
숫자를 문자형으로 반환 |
[방명록 테이블 구성]
필드 |
형식 |
NULL여부 |
내용 |
key |
추가속성 |
id |
int(10) |
not null |
글번호 |
Primary Key |
auto_increment |
name |
varchar(20) |
not null |
이름 |
|
|
password |
varcahr(20) |
not null |
비밀번호 |
|
|
content |
text |
not null |
글 내용 |
|
|
writedate |
timestamp |
not null |
글이 등록된 날짜와시간 |
|
current_timestamp |
list 파일
<html> <head><title>방명록입니다</title></head> <body> <form action="insert.php" method ="post"> <table border="1" width="600"> <tr> <td>이름</td><td><input type="text" name="name"></td> <td>비밀번호</td><td><input type="password" name="password"></td> </tr> <tr> <td colspan="4"> <textarea name="content" cols="80" rows="5"></textarea> </td> </tr> <td colspan="4" align="center"><input type="submit" value="확인"></td> </tr> </table> </form>
</body> </html> |
[방명록 글 삭제 파일 구성]
<html> <form action='delete.php?id=1&mode=delete' method='post'> <table width='600' border='1'> <tr> <td> 이름</td> <td>비밀번호</td> <td><input type='submit' value='확인'></td> </tr> </table> <form> </html> |
[게시판 db 구성]
필드 |
형식 |
NULL여부 |
내용 |
key |
추가속성 |
|||
id |
int(10) |
not null |
글 번호 |
Primary Key |
auto_increment |
|||
name |
varchar(20) |
not null |
이름 |
|
|
|||
|
varchar(30) |
|
이메일 |
|
|
|||
password |
varcahr(12) |
not null |
비밀번호 |
|
|
|||
title |
varchar(70) |
not null |
제목 |
|
|
|||
content |
text |
not null |
내용 |
|
|
|||
writedate |
datetime |
not null |
글이 등록된 날짜와 시간 |
|
current_timestamp |
|||
ip |
varchar(15) |
not null |
Ip 주소 |
|
|
|||
viewcount |
int(10) |
not null |
조회수 |
|
|
|||
write 파일 구성
<html> <head> <title> 간단 게시판</title> <style> <!-- td { font-size : 9pt; } A:link { font : 9pt; color : black; text-decoration : none; font-family : 굴림; font-size : 9pt; } A:visited { text-decoration : none; color : black; font-size : 9pt; } A:hover { text-decoration : underline; color : black; font-size : 9pt; } --> </style> </head>
<body topmargin=0 leftmargin=0 text="#000000"> <center> <BR> <!-- 입력된 값을 다음 페이지로 넘기기 위해 FORM을 만든다. --> <table width="650" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td height="20" align="center" bgcolor="#111111" colspan="2"> <font color="white"><B>글 쓰 기</B></font> </td> </tr> <!-- 입력 부분 --> <tr> <td width="100" align="left">이름</td> <td align="left"> <INPUT type="text" name="name" size="20" maxlength="10"> </td> </tr> <tr> <td width="100" align="left" >이메일</td> <td align="left" > <INPUT type="text" name="email" size="20" maxlength="25"> </td> </tr> <tr> <td width="100" align="left">비밀번호</td> <td align="left"> <INPUT type="password" name="password" size="8" maxlength="8">(글을 수정,삭제할 때 필요합니다.) </td> </tr> <tr> <td width="100" align="left">제 목</td> <td align="left"> <INPUT type="text" name="title" size="60" maxlength="35"> </td> </tr> <tr> <td width="100" align="left">내용</td> <td align="left"> <TEXTAREA name="content" cols="65" rows="15"></TEXTAREA> </td> </tr> <tr> <td colspan="2" align="center"> <INPUT type="submit" value="글 저장하기"> <INPUT type="reset" value="다시 쓰기"> <INPUT type="button" value="되돌아가기" onclick="history.go(-1)"> </td> </tr> <!-- 입력 부분 끝 --> </table> </form> </center> </body> </html> |
edit 파일 구성
<html> <head> <title>간단 게시판</title> <style> <!-- td { font-size : 9pt; } A:link { font : 9pt; color : black; text-decoration : none; font-family : 굴림; font-size : 9pt; } A:visited { text-decoration : none; color : black; font-size : 9pt; } A:hover { text-decoration : underline; color : black; font-size : 9pt; } --> </style> </head> <body topmargin=0 leftmargin=0 text="#000000"> <center> <BR> <form action="update.php?id=17" method="post"> <table width="650" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td height="20" align="center" bgcolor="#111111" colspan="2"> <font color="white"><B>글 쓰 기</B></font> </td> </tr> <!—내용 입력 --> <tr> <td width="100" align="left">이름</td> <td align="left"> <INPUT type="text" name="name" size="20" maxlength="10" value="홍길동"> </td> </tr> <tr> <td width="100" align="left" >이메일</td> <td align="left" > <INPUT type="text" name="email" size="20" maxlength="25" value="alzio7@alzio.co.kr"> </td> </tr> <tr> <td width="100" align="left">비밀번호</td> <td align="left"> <INPUT type="password" name="password" size="8" maxlength="8">(비밀번호가 맞아야 수정이 가능합니다.) </td> </tr> <tr> <td width="100" align="left">제목</td> <td align="left"> <INPUT type="text" name="title" size="60" maxlength="35" value=" 제목을 입력합니다."> </td> </tr> <tr> <td width="100" align="left">내용</td> <td align="left"> <TEXTAREA name="content" cols="65" rows="15" >글 내용을 입력합니다.</TEXTAREA> </td> </tr> <tr> <td colspan="2" align="center"> <INPUT type="submit" value="글저장하기"> <INPUT type="reset" value="다시 쓰기"> <INPUT type="button" value="되돌아가기" onclick="history.go(-1)"> </td> </tr> <!-- 내용 입력 --> </table> </form> </center> </body> </html> |
read.php 파일 구성
<html> <head> <title>간단 게시판</title> <style> <!-- td {font-size : 9pt;} A:link {font : 9pt; color : black; text-decoration : none; font-family : 굴림; font-size : 9pt;} A:visited {text-decoration : none; color : black; font-size : 9pt;} A:hover {text-decoration : underline; color : black; font-size : 9pt;} --> </style> </head> <body topmargin="0" leftmargin="0" text="#464646"> <center> <BR> <table width="650" border="0" cellpadding="2" cellspacing="1" bgcolor="#777777"> <tr> <td height="20" colspan="4" align="center" bgcolor="#999999"> <font color="white"><B>글 제목 입니다.</B></font> </td> </tr> <tr> <td width="50" height="20" align="center" bgcolor="#EEEEEE">글쓴이</td> <td width="240" bgcolor="white">홍길동</td> <td width="50" height="20" align="center" bgcolor="#EEEEEE">이메일</td> <td width="240" bgcolor="white">alzio7@alzio.co.kr</td> </tr> <tr> <td width="50" height="20" align="center" bgcolor="#EEEEEE">날 짜</td> <td width="240" bgcolor="white">2030-12-11 00-00-00</td> <td width="50" height="20" align="center" bgcolor="#EEEEEE">조회수</td> <td width="240" bgcolor="white">0</td> </tr> <tr> <td bgcolor="white" colspan="4"> <font color="black"> <pre>글의 내용을 입력합니다.</pre> </font> </td> </tr> <!-- 기타 버튼 들 --> <tr> <td colspan="4" bgcolor="#999999"> <table width="100%"> <tr> <td width="200" align="left" height="20"> <a href="list.php?no=20"><font color="white">[목록보기]</font></a> <a href="write.php"><font color="white">[글쓰기]</font></a> <a href="edit.php?id=17"><font color="white">[수정]</font></a> <a href="delpass.php?id=17"><font color="white">[삭제]</font></a> </td> <!—이전 다음 표시 --> <td align="right"> <a href=read.php?id=18> <font color='white'>[이전]</font></a>"; <a href=read.php?id=16> <font color=white>[다음]</font></a>"; </td> </tr> </table> </b></font> </td> </tr> </table> </center> </body> </html> |
delpass 파일 구성
<html> <head> <title>간단 게시판</title> <style> <!-- td {font-size : 9pt;} A:link {font : 9pt;color : black;text-decoration : none; font-family: 굴림;font-size : 9pt;} A:visited {text-decoration : none; color : black; font-size : 9pt;} A:hover {text-decoration : underline; color : black; font-size : 9pt;} --></style> </head> <body topmargin="0" leftmargin="0" text="#464646"> <center> <BR> <!-- 입력된 값을 다음 페이지로 넘기기 위해 FORM을 만든다. --> <form action="delete.php?id=17" method="post">
<table width="300" border="0" cellpadding="2" cellspacing="1" bgcolor="#777777"> <tr> <td height=20 align="center" bgcolor="#999999"> <font color="white"><B>비 밀 번 호 확 인</B></font> </td> </tr> <tr> <td align="center"> <font color="white"><B>비밀번호 : </b> <INPUT type="password" name="password" size="8"> <INPUT type="submit" value="확인 "> <INPUT type="button" value="취소" onclick="history.go(-1)"> </td> </tr> </table> <body> </html> |
List 파일 구성
<html> <head> <title>간단 게시판</title> <style> <!-- td {font-size : 9pt;} A:link {font : 9pt;color : black;text-decoration : none; fontfamily : 굴림;font-size : 9pt;} A:visited {text-decoration : none; color : black; font-size : 9pt;} A:hover {text-decoration : underline; color : black; font-size : 9pt;} --> </style> </head> <body topmargin="0" leftmargin="0" text="#464646"> <center> <table width="650" border="0" cellpadding="2" cellspacing="1" bgcolor="#777777"> <!--표 제목 --> <tr height="20" bgcolor="#999999"> <td width="30" align="center"> <font color="white">번호</font> </td> <td width="370" align="center"> <font color="white">제 목</font> </td> <td width="50" align="center"> <font color="white">글쓴이</font> </td> <td width="60" align="center"> <font color="white">날 짜</font> </td> <td width="40" align="center"> <font color="white">조회수</font> </td> </tr> <tr> <!-- 번호 --> <td height="20" bgcolor="white" align="center">2</td> <!-- 제목 --> <td height="20" bgcolor="white"> <a href="read.php?id=<?php echo $id ?>&no=0">글 제목입니다.</a> </td> <!-- 이름 --> <td align="center" height="20" bgcolor="white"> <font color="black"> <a href="mailto:alzio7@alzio.co.kr">홍길동</a> </font> </td> <!-- 날짜 --> <td align="center" height="20" bgcolor="white"> <font color="black">2030-01-12</font> </td> <!-- 조회수 --> <td align="center" height="20" bgcolor="white"> <font color="black">20</font> </td> </tr> </table>
<table border="0"> <tr> <td width="600" height="20" align="center" rowspan="4"> <font color="gray">◀ 1 2 3 4 5 6 7 8 9 10 ▶</font> </td> </tr> </table> <a href="write.php">글쓰기</a> </center> </body> </html> |