== 디비 연결 테스트 == {{{ "); } $db = mysql_select_db("linflus_db"); /* $sql = "CREATE TABLE guest (no integer not null, name char(10), contents text(2000), password char(4), status integer, date date)"; $result = mysql_query($sql); if(!$result){ die('Can not create table'); }else{ echo($result); } */ $sql = "INSERT INTO guest values(1, 'ksh', 'hello', '1234', 1)"; $result = mysql_query($sql); $sql = "SELECT * FROM guest"; $result = mysql_query($sql); $obj = mysql_fetch_object($result); echo($obj->name); ?> }}} == 기본 화면 (index.php) == {{{ 방명록
이름       비밀번호  

}}} == 글자 수 제한의 처리 (process.php) == {{{ 10 ) { $posted_name = substr($_POST['input_name'],0,10); } else { $posted_name = $_POST['input_name']; } //비번 입력의 처리 if (strlen($_POST['input_pw']) > 4 ) { $posted_pw = substr($_POST['input_pw'],0,4); } else { $posted_pw = $_POST['input_pw']; } //내용 입력의 처리 if (strlen($_POST['context']) > 2000 ) { $posted_context = substr($_POST['context'],0,2000); } else { $posted_context = $_POST['context']; } ?> }}} == 입력 받은 내용 출력 (output.php) == {{{ "); echo("입력받은 비번 : ".$_POST['input_pw']."
"); echo("입력받은 내용 : ".$_POST['context']."
"); echo("
"); echo("출력된 이름(10byte) : ".$posted_name."
"); echo("출력된 비번(04byte) : ".$posted_pw."
"); echo("출력된 내용(2000byte) : ".$posted_context."
"); ?> }}} === 페이지(page.php) === {{{ input_name; echo $arr[$i]->input_pw; echo $arr[$i]->context; echo "
"; } for( $i=1; $i<=$total_page; $i++){ if($page == $i){ echo" [$i]"; } else{ echo"[$i]"; } } ?> }}} 요건 그냥 데이터(data.php) {{{ input_name = '강소현'; $arr[0]->input_pw = '1111'; $arr[0]->context = '반가워요 ?'; $arr[1]->input_name = '강승현'; $arr[1]->input_pw = '1122'; $arr[1]->context = '?????'; $arr[2]->input_name = '이정은'; $arr[2]->input_pw = '4444'; $arr[2]->context = '이런!! ㅠㅠㅠㅠ'; $arr[3]->input_name = '초운영'; $arr[3]->input_pw = '5555'; $arr[3]->context = '수강신청 실패 ㅠㅠ'; $arr[4]->input_name = '김상호'; $arr[4]->input_pw = '1242'; $arr[4]->context = '오늘도 지각이에요 ㅠㅠㅋ'; $arr[5]->input_name = '박정근'; $arr[5]->input_pw = '4576'; $arr[5]->context = '안녕하세요??'; $arr[6]->input_name = '컴공인'; $arr[6]->input_pw = '9994'; $arr[6]->context = '여기는 6피'; $arr[7]->input_name = '아아아'; $arr[7]->input_pw = '5221'; $arr[7]->context = '이름이 안 떠올라'; $arr[8]->input_name = '살려줘'; $arr[8]->input_pw = '4524'; $arr[8]->context = '이런!! ㅠㅠ 한계가 왔어!'; $arr[9]->input_name = '언제까지'; $arr[9]->input_pw = '1300'; $arr[9]->context = '이어지니?'; $arr[10]->input_name = '에구구'; $arr[10]->input_pw = '1142'; $arr[10]->context = '길디 길다'; $arr[11]->input_name = '공학관'; $arr[11]->input_pw = '4523'; $arr[11]->context = '입니다 ㅇㅁㅇ'; ?> }}} == 오늘의 상태 == 나머지 부분은 생략 기본화면에 첨부하면 되므로..ㅋ {{{ 방명록 . . . }}} == 색 바꾸기 == {{{ 배경색을 바꾸자
"); echo("
R   
G   
B   
혹은 그냥 색 이름 입력(영어로)  
"); if($_POST['clrname'] != NULL) { echo(''); } else { // 배경 색의 처리 $hexr=dechex($_POST['setr']); $hexg=dechex($_POST['setg']); $hexb=dechex($_POST['setb']); echo(''); } // 글자가 보이기 위해 글자 색의 처리 $txtr=dechex(255-$_POST['setr']); $txtg=dechex(255-$_POST['setg']); $txtb=dechex(255-$_POST['setb']); ?> }}} == 디비가 연결된 새로운 방명록 아래부터 시작~ == = 메인화면 ( index.php ) = {{{ 방명록 이름       비밀번호  

}}} == 데이터베이스에 연결 ( dbconnect.php ) == {{{ "); } else { echo("db 연결 실패
"); } if($tableconn) { echo("table 연결 성공
"); } else { echo("table 연결 실패
"); } echo("
"." ------------------------------------------"."
"); ?> }}} == 입력받은 내용을 쿼리로 만들어서 쏜다! ( make_query.php ) == {{{ 10 ) { $posted_name = substr($_POST['input_name'],0,10); } else { $posted_name = $_POST['input_name']; } //비번 입력의 처리 if (strlen($_POST['input_pw']) > 4 ) { $posted_pw = substr($_POST['input_pw'],0,4); } else { $posted_pw = $_POST['input_pw']; } //내용 입력의 처리 if (strlen($_POST['context']) > 2000 ) { $posted_context = substr($_POST['context'],0,2000); } else { $posted_context = $_POST['context']; } include "get_time.php"; $query = "insert into guest (name, pw, contents, date) values ('$posted_name', '$posted_pw', '$posted_context', '$date')"; ?> }}} == 쿼리를 만들때 시간을 저장하기 위해.. ( get_time.php ) == {{{ '); $unix_ts=mktime(); $date=date('Y-m-d', $unix_ts); ?> }}} == 입력을 받고, 이제 전체 테이블 출력! ( print.php ) == {{{ "); echo("내 용 : $contents

"); } ?> }}} == 출력을 위해 필요함 ( get_record.php ) == {{{ }}} ---- [2010PHP]