나이구하기 - 주민등록번호 이용 // 나이(주민등록번호를 이용) function AGE_jumin($lno,$rno) { $refArray = Array(18,19,19,20,20,16,16,17,17,18); $refyy = substr($rno,0,1); $biryear = $refArray[$refyy] * 100 + substr($lno,0,2); $nowyear = date("Y"); return $nowyear - $biryear + 1; } PHP 2013.02.19
숫자를 한글로 바꾸기 // 숫자를 한글로 바꾸기 function numtokor($num) { $text =''; $d_symbol = array('4' => "만", '8' => "억", '12' => "조", '16' => "경", '20' => "해", '24' => "시", '28' => "양", '32' => "구", '36' => "간", '40' => "정", '44' => "재", '48' => "극", '52' => "항하사", '56' => "아승지", '60' => "나유타", '64' => "불가사의", '68' => "무량대수"); $p_symbol = array('0' => "", '1' => "십", '2' => "백", '3' => "천"); $t_symbol = array('0' => "", '.. PHP 2013.02.19
영문 단어의 첫번째 글자 대문자로 (영어 이름) ucwords (PHP 3>= 3.0.3, PHP 4 )ucwords -- 문자열에 있는 각 단어의 처음 글자를 대문자로 바꾼다. string ucwords ( string str) str의 각각의 단어의 첫문자가 알파벳이라면 그 글자를 대문자로 바꾼다. 예 1. ucwords() 예$text = "mary had a little lamb and she loved it so."; $text = ucwords($text); // $text 는 : Mary Had A Little Lamb And She Loved It So. 이 된다. PHP 2013.02.19
HTTP 에러 코드표 400 요청실패 문법상 오류가 있어, 서버가 요청사항을 이해하지 못함, 클라이언트는 수정없이 요청사항을 반복하지 않을 것이다. 401.1 권한 없음 (접속실패) 이 에러는 서버에 로그온 하려는 요청사항이 서버에 들어있는 권한과 비교했을 때 맞지 않을 경우 발생한다. 이 경우, 여러분이 요청한 자원에 접근할 수 있는 권한을 부여받기 위해 서버 운영자에게 요청해야 할 것이다. 401.2 권한 없음(서버설정으로 인한 접속 실패) 이 에러는 서버에 로그온 하려는 요청사항이 서버에 들어있는 권한과 비교했을 때 맞지않을 경우 발생한다. 이것은 일반적을 으로 적절한 www-authenticate head field를 전송하지 않아서 발생한다. 401.3 권한 없음(자원에 대한 ACL에 기인한 권한 없음) 이 에러는 .. etc 2013.02.19
소스보기 금지 등 기능 막기 1. 마우스 오른쪽메뉴, 드래그, 선택복사 금지하기 oncontextmenu='return false' : 마우스 오른쪽 메뉴 금지 ondragstart=return false : 드래그 금지 onselectstart='return false' : 선택복사 금지 참고 onkeydown="return false" 키보드 완전 금지 2. 마우스 오른쪽 버튼 클릭시 경고 메세지 3. 새로고침(F5), 전체창(F11) 막기 4. shift, ctrl (쉬프트, 컨트롤)키 클릭하면 경고메세지 띄우기 자바스크립트 2013.02.19
외국인 등록번호 체크 function fgn_no_chksum(reg_no) { var sum = 0; var odd = 0; buf = new Array(13); for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i)); odd = buf[7]*10 + buf[8]; if (odd%2 != 0) { return false; } if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) { return false; } multipliers = [2,3,4,5,6,7,8,9,2,3,4,5]; for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]); .. 자바스크립트 2013.02.18
플래쉬 칼라픽커 Color Picker Directions Once you have found the color you want, the color code is displayed at the bottom right of the color picker where it says 'Color Code'. You can either highlight that color code and copy it or just click the 'Copy' button located between the 'OK' and 'Cancel' buttons. To pick multiple colors at a time, find a color and hit 'OK'. It will add the color to your custom pallet .. etc 2013.02.18
브라우져와 OS 알아내는 함수 // get_browser() 함수는 이미 있음 function get_brow($agent) { $agent = strtolower($agent); //echo $agent; if (preg_match("/msie 5.0[0-9]*/", $agent)) { $s = "MSIE 5.0"; } else if(preg_match("/msie 5.5[0-9]*/", $agent)) { $s = "MSIE 5.5"; } else if(preg_match("/msie 6.0[0-9]*/", $agent)) { $s = "MSIE 6.0"; } else if(preg_match("/msie 7.0[0-9]*/", $agent)) { $s = "MSIE 7.0"; } else if(preg_match("/msie 8.. PHP 2013.02.18
select radio checkbox [ select box 컨트롤 ] select box의 내용 가져오기 $("#select_box > option:selected").val(); select box의 값 설정 $("#select_box > option[value=지정값]").attr("selected", "true") select disabled $('#sign02_emp_id').attr('disabled', 'true'); 해제 $('#sign02_emp_id').attr('disabled', ''); // 'false'를 줬을경우 안됨 선택된 값 읽기 $("#아이디 option:selected").val(); $("select[name=이름]").val(); 선택된 내용 읽기 $("#아이디 option:selected").text(.. jQuery 2013.02.18
jQuery 금액 콤마 플러그인 $(function(){ $('#money').bind('blur', function(){ $(this).toPrice(); }); jQuery 2013.02.18
jquery 숫자만 jQuery 숫자만 입력 1.input 2.javascript $(document).ready(function(){ $('.numberic').keypress(function(e){ if(e.which && (e.which 57) ) e.preventDefault(); }); $('.numberic').keyup(function(){ if( $(this).val() != null && $(this).val() != '' ) { var tmps = parseInt($(this).val().replace(/[^0-9]/g, '')) || 0; $(this).val(tmps); } }); }); jQuery 2013.02.18
jquery radio checked, select option selected $("input[name=cUse]")[0].checked $("input[name=cUse]").attr("checked", (chk== '1' ? 'checked' : '')); radio 선택된 값 가져오기 $("input[@name=rList][@checked]").val() radio의 value값으로 선택하기 $("input[@name=rList]").filter('input[@value='+sValue+']').attr("checked", "checked"); select box 선택된 값 가져오기 $("#ddl > option:selected").val(); select box의 value값으로 선택하기 $("#ddl > option[@value="+sValue+"]").attr("sele.. jQuery 2013.02.18
XSS 공격 방지 함수 /* XSS 공격 방지 함수 */ function hasJsInUrl($arr) { foreach ($arr as $k => $v) { if (false !== strpos(strtolower(substr($v, 4)), 'script')) { echo "\n"; exit; } } } //end func hasJsInUrl(&$_REQUEST); function hasCookieAttackStr() { foreach ($_SESSION as $k => $v) { if (is_array($v)) { $rst = arrayHasAttackStr($v); } else { $rst = hasAttackStr($v); } if ($rst) { return true; } } return false; } //end .. PHP 2013.02.18
jQuery & iframe iframe 내부 요소 선택 $('#iframeID').contains().find('#id').html(); $('#iframeID').contains().find(':checkbox:checked').size(); // 체크된 체크박스 개수 iframe에서 부모 요소 선택 $('#id', parent.document) 부모의 다른 iframe에 접근 : $("#id", parent.frames['frameId'].document) jQuery iframe Sizing http://sonspring.com/journal/jquery-iframe-sizing Resizing iFrame with jQuery UI http://stackoverflow.com/questions/1234144/resizing.. jQuery 2013.02.18
jquery 사이트 - 1 http://www.trendskitchens.co.nz/jquery/contextmenu/ 네임텍 http://labs.abeautifulsite.net/projects/js/jquery/contextMenu/demo/ 네임텍 http://www.uploadify.com/demos/ 파일업로드 http://highslide.com/#examples jQuery 2013.02.18