'프로그래밍 > php' 카테고리의 다른 글
[php]파일을 문자열로 읽기. (0) | 2018.03.08 |
---|---|
PHP Simple HTML DOM Parser (0) | 2018.02.27 |
컨텐츠 내용중 첫번째 IMG주소 뽑아내기 (0) | 2018.02.27 |
GD (0) | 2018.02.27 |
captcha (0) | 2018.02.27 |
[php]파일을 문자열로 읽기. (0) | 2018.03.08 |
---|---|
PHP Simple HTML DOM Parser (0) | 2018.02.27 |
컨텐츠 내용중 첫번째 IMG주소 뽑아내기 (0) | 2018.02.27 |
GD (0) | 2018.02.27 |
captcha (0) | 2018.02.27 |
## 기본 GD처리
$file_name_arr = explode(".", $_FILES['name']); $extention = strtolower($file_name_arr[count($file_name_arr)-1]); $file_name = time()."_".rand(9999,9999999).".".$extention; // 파일명 임의생성 $output_image = $files_data['tmp_name']; $upload_file_path = $_FILES['tmp_name']; $upload_file_type = mime_content_type($upload_file_path); //타입별로 로드시킴 switch($upload_file_type) { case "image/png": $im = imagecreatefrompng($upload_file_path); break; case "image/jpg": case "image/jpeg": $im = imagecreatefromjpeg($upload_file_path); break; case "image/gif": $im = imagecreatefromgif($upload_file_path); break; } if($im) { $output_image = _IMAGE_DIR.$folder_dir."/".$file_name; // 이미지 저장 위치 $imginfo = getimagesize($upload_file_path); imagecopyresampled($im, $im, 0, 0, 0, 0, 0, 0, $imginfo[0], $imginfo[1]); //이미지생성부분 //imagejpeg($im, $destpath, 100); switch($extention){ case 'gif': imagegif($im,$output_image); break; case 'png': imagepng($im,$output_image); break; case 'jpg': case 'jpeg': imagejpeg($im,$output_image, 100);break; //JPG 이미지로 표출됨 default : $rs['result'] = false; $rs['msg'] = '이미지 처리 실패'; return $rs; } ImageDestroy($im); //메모리 해제 }
PHP Simple HTML DOM Parser (0) | 2018.02.27 |
---|---|
정규식 예제 (0) | 2018.02.27 |
컨텐츠 내용중 첫번째 IMG주소 뽑아내기 (0) | 2018.02.27 |
captcha (0) | 2018.02.27 |
날짜 or 시간 (0) | 2018.02.27 |
PHP simple captcha
PHP용 심플 captcha
https://github.com/claviska/simple-php-captcha
thx to Cory LaViska.
사용법소개
데모 소스
위의 라이브러리를 가지고 직접 데모를 만들어 보았다.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <? session_start(); include ( "simple-php-captcha.php" ); $PREV_Captcha = $_SESSION [ 'captcha' ][ 'code' ]; $POST_Captcha = $_POST [ 'captcha' ]; if ( ! empty ( $PREV_Captcha ) && ! empty ( $POST_Captcha ) ) { if ( strcasecmp ( $PREV_Captcha , $POST_Captcha ) != 0 ) { echo "<script>alert('이미지에 출력된 글자와 다릅니다.');</script>" ; } else { echo "<script>alert('정상');</script>" ; } } //end if $_SESSION [ 'captcha' ] = simple_php_captcha(); ?> <!DOCTYPE html> <html lang= "en" > <head> <!-- meta --> <meta name= "Author" content= "serpiko@hanmail.net" /> <meta http-equiv= "Content-Type" content= "text/html; charset=UTF-8" /> <meta charset= "utf-8" > <meta http-equiv= "X-UA-Compatible" content= "IE=edge, chrome=1" /> <meta name= "viewport" content= "width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" /> <meta name= "format-detection" content= "telephone=no" /> <!-- link --> <link rel= "stylesheet" type= "text/css" href= "" /> <!-- script --> <title>Document</title> <style> * { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; } </style> </head> <body> <div id= "wrap" > <form method= 'post' action= '<?=$PHP_SELF?>' > PREV_Captcha : <input type= 'text' size= '100' value= '<?=$PREV_Captcha?>' /> <br /> POST_Captcha : <input type= 'text' name= '' size= '100' value= '<?=$POST_Captcha?>' /> <br /><br /> 할당된 캡챠<br /> <img src= "<?=$_SESSION['captcha']['image_src']?>" style= 'width:100px;border:1px solid blue;border-radius:7px;' /><br /><br /> 사용자 캡챠 입력<br /> captcha : <input type= 'text' size= '100' name= 'captcha' value= "" /> <br /> <button type= 'submit' >확인</button> </form> </div> </body> </html> |
데모 보기
출처: http://serpiko.tistory.com/589 [삽SAP(Study And Programming) 질 블로그. by허정진]
PHP Simple HTML DOM Parser (0) | 2018.02.27 |
---|---|
정규식 예제 (0) | 2018.02.27 |
컨텐츠 내용중 첫번째 IMG주소 뽑아내기 (0) | 2018.02.27 |
GD (0) | 2018.02.27 |
날짜 or 시간 (0) | 2018.02.27 |
## 기간 일 구하기
echo intval((strtotime(종료일) - strtotime(시작일)) / 86400);
## 날짜 몇분전 으로 표시
// $date1:기준시간 timestamp // $date2:계산할시간 timestamp function getGlobalDate($date1, $date2) { $dtDiff = $date1 - $date2; if($dtDiff < 60) $rs = intval($dtDiff) . "/sec"; else if($dtDiff < 60*60) $rs = intval($dtDiff / (60)) . "/min"; else if($dtDiff < 60*60*24) $rs = intval($dtDiff / (60*60)) . "/hour"; else if($dtDiff < 60*60*24*7) $rs = intval($dtDiff / (60*60*24)) . "/day"; else if($dtDiff < 60*60*24*30) $rs = intval($dtDiff / (60*60*24*7)) . "/week"; else if($dtDiff < 60*60*24*365) $rs = intval($dtDiff / (60*60*24*30)) . "/month"; else $rs = intval($dtDiff / (60*60*24*365)) . "/year"; return $rs; }
## 남은시간 계산
/* 설 명 해당시간의 남은시간 계산함수 사용예 diff_time(timestamp) 리턴값 배열 */ function diff_time( $timestamp ) { $date1 = $timestamp; $date2 = time(); $total_secs = abs($date1-$date2); $diff_in_days = floor( $total_secs / 86400 ); $rest_hours = $total_secs % 86400; $diff_in_hours = floor( $rest_hours / 3600 ); $rest_mins = $rest_hours % 3600; $diff_in_mins = floor( $rest_mins / 60 ); $diff_in_secs = floor( $rest_mins % 60 ); $time_diff["days"] = (int)($diff_in_days); $time_diff["hours"] = $diff_in_hours; $time_diff["mins"] = $diff_in_mins; $time_diff["secs"] = $diff_in_secs; return $time_diff; }
## 한시간 전 날짜와 시간 구하기
echo date("Y-m-d H:i:s", mktime(date("H")-1, date("i"), date("s"), date("m"), date("d"), date("Y"))); 15일전 날짜 구하기 $date = date('Y-m-d H:i:s', strtotime('-15 day')); 타임스템프 변환 $sch_end_date = '2017-01-30 23:59:59'; $timestamp = strtotime($sch_end_date); echo date('Y-m-d H:i:s', $timestamp); exit; $time = time(); date("Y-m-d",strtotime("-1 day", $time)); // 하루 전(어제) date("Y-m-d",strtotime("-1 day", $time)); // 하루 전(어제) date("Y-m-d",strtotime("now", $time)); // 현재 date("Y-m-d",strtotime("+1 day", $time)); // 하루 후(내일) date("Y-m-d",strtotime("+1 week", $time)); // 일주일 후 date("Y-m-d",strtotime("-1 month", $time)); // 한달 전 date("Y-m-d",strtotime("+1 month", $time)); // 다음달 date("Y-m-d",strtotime("+6 month", $time)); // 6달후 date("Y-m-d",strtotime("+12 month", $time)); // 12달후 date("Y-m-d",strtotime("next Thursday", $time)); // 다음주 목요일 date("Y-m-d",strtotime("last Monday", $time)); // 지난 월요일 date("Y-m-d",strtotime("10 September 2000", $time)); // 2000년 9월 10일 date("Y-m-d", strtotime('first day of')) // 해당월의 1일 date("Y-m-d:i:s", strtotime("now", $time)); //현재 시간 date("Y-m-d:i:s", strtotime("+5 minutes", $time)); //현재 시간에서 5분 후
## 한주의 시작일과 마지막일 구하기
$today = date("Ymd"); $week_day = date("w", mktime(0, 0, 0, substr($today, 4, 2), substr($today, 6, 2), substr($today, 0, 4)) ); $week_start = date("Ymd", mktime(0, 0, 0, substr($today, 4, 2), substr($today, 6, 2)-$week_day, substr($today, 0, 4)) ); $week_day2 = 6 - $week_day; $week_end = date("Ymd", mktime(0, 0, 0, substr($today, 4, 2), substr($today, 6, 2)+$week_day2, substr($today, 0, 4)) ); echo $week_start ."~". $week_end;
PHP Simple HTML DOM Parser (0) | 2018.02.27 |
---|---|
정규식 예제 (0) | 2018.02.27 |
컨텐츠 내용중 첫번째 IMG주소 뽑아내기 (0) | 2018.02.27 |
GD (0) | 2018.02.27 |
captcha (0) | 2018.02.27 |
1. syntaxhighlighter_3.0.83.zip파일 압축해제
2. 티스토리ADMIN -> 꾸미기 -> 스킨편집 -> html편집
- 파일 업로드 탭
script. style 파일 모두 업로드
- HTML 탭
</head>안에 아래 내용 삽입
윈도우 메모리 관리 툴 - RAMMAP (0) | 2018.03.08 |
---|---|
SyntaxHighlighter 옵션 (0) | 2018.02.27 |
Configuration
Name | Value | Description |
---|---|---|
bloggerMode | false | blogger.com 에서 사용중이라면 true로 설정할 것 |
clipboardSwf | null | clipboard로 사용할 url을 적는다. |
strings | Object | 각종 메시지를 재정의할 수 있다. 자세한 설정을 참조 +_+ |
stripBrs | false | br 태그 무시 여부 결정 |
toolbarItemWidth | 16 | 툴바 아이템 가로 크기 |
toolbarItemHeight | 16 | 툴바 아이템 세로 크기 |
tagName | "pre" | 다른 태그를 사용하고 싶다면 설정. |
위의 설정을 Syntax highlighter 로드하는 js 안에 입력하여 사용.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <script type= "text/javascript" > SyntaxHighlighter.defaults[ 'toolbar' ] = false ; // 툴바 설정 (기본값 True) //SyntaxHighlighter.defaults['gutter'] = true; // 라인 번호 설정 (기본값 True) //SyntaxHighlighter.defaults['tab-size'] = 2; // 탭 사이즈 설정 (기본값 4) //SyntaxHighlighter.defaults['first-line'] = 1; // 라인 시작 숫자 (기본값 1) //SyntaxHighlighter.defaults['auto-links'] = false; // 링크 설정 (기본값 true) SyntaxHighlighter.config.bloggerMode = true ; SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf' ; //SyntaxHighlighter.config.stripBrs = true; . . . SyntaxHighlighter.all() </script> |
Default
각종 기본 설정을 재정의할 수 있다.
Name | Value | Description |
---|---|---|
auto-links | true | url 등이 있을때 자동으로 링크 걸어주는지 여부 |
class-name | '' | custom class 사용시 설정 |
collapse | false | collapse로 사용할 것인가? view source등을 클릭해야 소스가 보이도록.. |
first-line | 1 | 첫 라인의 라인넘버 |
gutter | true | 라인넘버 보이도록? |
highlight | null | 라인별로 강조하고 싶은 경우 [1, 2, 3] 또는 해당 라인넘버 |
html-script | false | 스크립트(php, jsp 등)에 포함된 HTML/XML을 하이라이트 할 것인가 여부, true로 설정하면 반드시 shBrushXml.js를 로드하여야 한다. |
light | false | toolbar + gutter 를 한 옵션으로 처리할 때 사용. |
smart-tabs | true | 스마트 탭 사용 여부 |
tab-size | 4 | 탭 크기. |
toolbar | true | 툴바 켜고 끄기 |
wrap-lines | true | 줄바꿈 할 것인지 설정 |
- 기본 설정은 default에 정의 하여 아래와 같이사용할 수 있으며
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <script type= "text/javascript" > SyntaxHighlighter.defaults[ 'toolbar' ] = false ; // 툴바 설정 (기본값 True) SyntaxHighlighter.defaults[ 'gutter' ] = true ; // 라인 번호 설정 (기본값 True) SyntaxHighlighter.defaults[ 'tab-size' ] = 2; // 탭 사이즈 설정 (기본값 4) SyntaxHighlighter.defaults[ 'first-line' ] = 1; // 라인 시작 숫자 (기본값 1) SyntaxHighlighter.defaults[ 'auto-links' ] = false ; // 링크 설정 (기본값 true) SyntaxHighlighter.config.bloggerMode = true ; SyntaxHighlighter.config.stripBrs = true ; . . . SyntaxHighlighter.all() </script> |
만약 여러가지 옵션을 동시에 지정하고 싶을 경우 세미콜론(;)으로 구분하여 연속으로 지정하면 됩니다
1 | <pre class="brush: js; ruler: true; first-line: 10; highlight: [2, 4, 6]">...</pre> |
brush 종류
Brush name | Brush aliases | File name |
---|---|---|
ActionScript3 | as3, actionscript3 | shBrushAS3.js |
Bash/shell | bash, shell | shBrushBash.js |
C# | c-sharp, csharp | shBrushCSharp.js |
C++ | cpp, c | shBrushCpp.js |
CSS | css | shBrushCss.js |
Delphi | delphi, pas, pascal | shBrushDelphi.js |
Diff | diff, patch | shBrushDiff.js |
Groovy | groovy | shBrushGroovy.js |
JavaScript | js, jscript, javascript | shBrushJScript.js |
Java | java | shBrushJava.js |
JavaFX | jfx, javafx | shBrushJavaFX.js |
Perl | perl, pl | shBrushPerl.js |
PHP | php | shBrushPhp.js |
Plain Text | plain, text | shBrushPlain.js |
PowerShell | ps, powershell | shBrushPowerShell.js |
Python | py, python | shBrushPython.js |
Ruby | rails, ror, ruby | shBrushRuby.js |
Scala | scala | shBrushScala.js |
SQL | sql | shBrushSql.js |
Visual Basic | vb, vbnet | shBrushVb.js |
XML | xml, xhtml, xslt, html, xhtml | shBrushXml.js |
소스코드를 입력할때 주의해야할 사항은 꺽쇠 <>를 변환해줘야 합니다.
만약 그대로 꺽쇠를 작성하면 제대로 동작하지 않을 수 있습니다.
하지만 이러한 꺽쇠를 그때그때 수정해야 하면 너무 번거롭기 때문에
꺽쇠를 자동으로 변환해주는 사이트를 소개하며 포스팅을 마치겠습니다.
parkjuwan 사이트 : (http://parkjuwan.dothome.co.kr/webapp/ltgt_conv/)
출처 : http://chongmoa.com/webtool/3007
윈도우 메모리 관리 툴 - RAMMAP (0) | 2018.03.08 |
---|---|
SyntaxHighlighter 셋팅 (0) | 2018.02.27 |
- 방어구 채색 변경은 마이하우스 갈 필요 없이 공방에서도 가능하다.
(장비 생산 → 방어구 → OPTIONS 버튼)
- 마찬가지로 동반자 방어구 채색 변경도 공방에서 된다.
- 훈련구역으로 가고싶을 때 마이하우스에 들를 필요 없이 바로 이동할 수 있다.
(지도 → □버튼(전역 맵) → 조사거점 → 훈련구역)
- 조사거점에서 여러 상호작용 대상이 뭉쳐있을 때 L2/R2 버튼으로 말 걸 대상을 바꿀 수 있다. 푸기가 NPC나 퀘스트게시판 근처에서 얼쩡댈 때 쓰자
- NPC들 대사는 X버튼으로 스킵할 수 있다.
- 독 치료용 아이템으로 해독제 말고 한방약을 가져가자. 이게 먹는 속도가 훨씬 빠르다.
- 귀환옥은 긴급탈출 용도 외에도, 몹에게 인식당해 캠프 빠른이동을 못하는 짜증나는 상황에 유용하다.
- 볼가노스의 몸이 딱딱해졌을 때는 불속성 공격을 하면 풀린다. 용암 필드 주변에 부싯돌이 많으니 주워서 쓰면 간단.
- 몬스터를 잡았을 때의 카메라 워킹은 OPTIONS로 스킵할 수 있다. 갈무리 하는데에 방해되니 다 넘겨버리자.
- 채집할 때와 갈무리할 때 ○버튼을 오래 꾹 눌러주자. 연속으로 행동을 계속 하기 때문에 시간이 절약된다.
- 마찬가지로 퀘스트 보상 받을 때도 ○버튼을 꾹 눌러주자. 쫘라락 하고 빠르게 먹을 수 있다.
- 조사퀘스트 목록에서 '미등록' 탭으로 가면 난이도☆ 순으로 정렬되기 때문에 원하는 몹을 찾기가 좀 더 쉬워진다.(역전퀘는 해당無 ㅠ)
- 혹시 팔아서 돈 버는 용도의 '환금 아이템'을 안 팔고 쟁여놓고 있진 않은가? 아이템 박스를 확인해보자.
(아이템 박스 → 아이템 확인/매각 → R2 두번 누름(소재 목록) → R3 버튼 눌러서 정렬 후 가장 뒤쪽에 있는 아이템 확인)
- 지인과 음성채팅을 할 때는 게임내 기능보다는 플스의 파티 기능을 쓰는게 낫다.
- PC용 USB 키보드 또는 블루투스 키보드를 플스에 연결하면 이걸로 텍스트 입력을 할 수 있으니 여건이 된다면 활용해보자. 몬헌의 경우 PC 게임처럼 Enter로 채팅할 수 있다. 또한 집회구역 번호를 입력할 때 아주 편하다.
- R3 스틱을 건드려서 숏컷이 의도치 않게 조작되는 일이 잦아 짜증난다면 옵션에서 '숏컷 조작 설정'을 타입 2로 바꾸자.
- 몬스터가 떨군 유실물은 찾기가 어려운데, 지도를 열어보면 물음표 모양 아이콘으로 표시된다. 미니맵에는 안 뜨니 꼭 지도를 열자. 단, 강도복장으로 떨군 환금아이템은 표시되지 않는다.
---------------------------------------------------
※팁은 아니고 그냥 재밌는 소소한 디테일 요소들
- 캠프 밖에 멀리 떨어진 곳에서 접수원을 망원경으로 관찰해보자. 주인공 캐릭터가 캠프 밖에 있을 때 하는 여러 행동들을 관찰할 수 있다.(보급상자 뒤적거리기, 책읽다가 졸기 등등)
- 3인 이상 파티 퀘스트 중에 캠프에 들어가보면 동반자 아이루가 가끔 혼자 무술 수련을 하고있다.(공수도?)
- 식당의 요리 컷신에 나오는 고양이들은 메라루인듯?(확실친 않음)
- 특급 마이하우스에서 하프 연주하는 아이루의 손을 잘보면 BGM에 맞춰서 움직인다. 즉, 얘가 BGM을 연주하고 있다.(다만 싱크는 살짝 안 맞음)
- 마이하우스의 침대나 벤치 등에서 휴식할 때 캐릭터가 환경생물들에게 먹이를 뿌리는데 이 때 생물들 반응이 제각각이다. 감상해보자.
출처 : http://m.ruliweb.com/game/84513/board/read/53297?view_best=1