'php, codeigniter' 카테고리의 다른 글
한글 포함 여부 체크 (0) | 2015.07.14 |
---|---|
이름 별표 처리 (0) | 2015.07.14 |
태그제거, 태그안의 내용만 추출 (0) | 2015.06.09 |
remove_xss 함수 (0) | 2015.05.12 |
sso 공유 방법(서로 다른 웹언어(ASP,JSP,PHP)을 사용하여 세션을 공유하는법) (0) | 2015.04.30 |
한글 포함 여부 체크 (0) | 2015.07.14 |
---|---|
이름 별표 처리 (0) | 2015.07.14 |
태그제거, 태그안의 내용만 추출 (0) | 2015.06.09 |
remove_xss 함수 (0) | 2015.05.12 |
sso 공유 방법(서로 다른 웹언어(ASP,JSP,PHP)을 사용하여 세션을 공유하는법) (0) | 2015.04.30 |
* 태크안의 내용만 추출
$string = "<div class=\"name\">anyting</div>1234<div class=\"name\">anyting</div >abcd";
echo preg_replace('/(<div[^>]*>)(.*?)(<\/div.*?>)/i', '$2', $string);
* 태그제거
$string = "<table class=\"name\"><tr><td>anyting1</td></tr></table><table class=\"name\"><tr><td>anyting2</td><td>anyting3</td></tr></table>";
echo preg_replace('/\<[\/]?(table|tr|td)([^\>]*)\>/i', '', $string);
출처 : http://roresy.tistory.com/2311
이름 별표 처리 (0) | 2015.07.14 |
---|---|
fpdf - pdf 만들기 (0) | 2015.06.10 |
remove_xss 함수 (0) | 2015.05.12 |
sso 공유 방법(서로 다른 웹언어(ASP,JSP,PHP)을 사용하여 세션을 공유하는법) (0) | 2015.04.30 |
ffmpeg - mp4 썸네일 만들기 (0) | 2015.04.14 |
<?php
function RemoveXSS($val) {
// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed
// this prevents some character re-spacing such as <java\0script>
// note that you have to handle splits with \n, \r, and \t later since they *are*
// allowed in some inputs
$val = preg_replace('/([\x00-\x08][\x0b-\x0c][\x0e-\x20])/', '', $val);
// straight replacements, the user should never need these since they're normal characters
// this prevents like <IMG SRC=@avascript&
// #X3Aalert('XSS')>
$search = 'abcdefghijklmnopqrstuvwxyz';
$search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$search .= '1234567890!@#$%^&*()';
$search .= '~`";:?+/={}[]-_|\'\\';
for ($i = 0; $i < strlen($search); $i++) {
// ;? matches the ;, which is optional
// 0{0,7} matches any padded zeros, which are optional and go up to 8 chars
// @ @ search for the hex values
$val = preg_replace('/(&#[x|X]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val);
// with a ;
// @ @ 0{0,7} matches '0' zero to seven times
$val = preg_replace('/(�{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;
}
// now the only remaining whitespace attacks are \t, \n, and \r
$ra1 = Array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');
$ra2 = Array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');
$ra = array_merge($ra1, $ra2);
$found = true; // keep replacing as long as the previous round replaced something
while ($found == true) {
$val_before = $val;
for ($i = 0; $i < sizeof($ra); $i++) {
$pattern = '/';
for ($j = 0; $j < strlen($ra[$i]); $j++) {
if ($j > 0) {
$pattern .= '(';
$pattern .= '(&#[x|X]0{0,8}([9][a][b]);?)?';
$pattern .= '|(�{0,8}([9][10][13]);?)?';
$pattern .= ')?';
}
$pattern .= $ra[$i][$j];
}
$pattern .= '/i';
$replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag
$val = preg_replace($pattern, $replacement, $val); // filter out the hex tags
if ($val_before == $val) {
// no replacements were made, so exit the loop
$found = false;
}
}
}
return $val;
}
?>
fpdf - pdf 만들기 (0) | 2015.06.10 |
---|---|
태그제거, 태그안의 내용만 추출 (0) | 2015.06.09 |
sso 공유 방법(서로 다른 웹언어(ASP,JSP,PHP)을 사용하여 세션을 공유하는법) (0) | 2015.04.30 |
ffmpeg - mp4 썸네일 만들기 (0) | 2015.04.14 |
코드이그나이터 : session create sql > mssql (0) | 2015.04.02 |
dbcc checkident('table_name', reseed, 0)
pdo_mysql 연동 (0) | 2015.12.17 |
---|---|
MySQL IP 접속 권한 (0) | 2015.06.22 |
메일주소 포함된 필드 찾기 (0) | 2015.02.17 |
datetime 필드 검색 (0) | 2014.11.12 |
UNIX_TIMESTAMP 변환하기 (0) | 2014.10.13 |
1. SSO 솔류션을 이용하여 스크립트 체크을통해 로그인을 사용할수 있다.
- SSO 솔류션에서 정보를 가져오면 가능하다.
2. 하나의 웹언어에서 쿠키를 생성하여 다른 웹언어에서 읽어들여 세션변수에 저장합니다.
- 대신 같은 1차,2차 도메인에서만 쿠키변수에 쓰기,읽기가 가능하다.
www를 붙은 도메인과 붙지 않은 도메인에서 제대로 세션공유가 안일어날때
* index.php
<?
session_start();
$_SESSION["name"]="이xx";
$_SESSION["name1"]="하하하";
?>
<a href="http://www.skin4u.net/test1.php">www.skin4u.net</a>
<a href="http://skin4u.net/test2.php">skin4u.net</a>
* test1.php
<?
session_start();
echo $_SESSION["name"];
echo $_SESSION["name1"];
?>
* test2.php
<?
session_start();
echo $_SESSION["name"];
echo $_SESSION["name1"];
?>
www.skin4u.net에서 서핑을 하다가 세션을 구울시 skin4u.net로 다시 이동하여 서핑할경우 세션이 안먹혀 에러가 나는 경우가 있다 그럴경우에는 아래와 같이 조치한다.
session_start(); 전에 아래 코드를 넣어준다.
@header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
ini_set("session.cookie_domain", ".webprogram.co.kr");
출처 : http://www.zetswing.com/bbs/board.php?bo_table=PHP_LEC&wr_id=6&page=3
태그제거, 태그안의 내용만 추출 (0) | 2015.06.09 |
---|---|
remove_xss 함수 (0) | 2015.05.12 |
ffmpeg - mp4 썸네일 만들기 (0) | 2015.04.14 |
코드이그나이터 : session create sql > mssql (0) | 2015.04.02 |
MY_Router(컨트롤러 서브폴더 확장) 및 mssql_driver(mssql limit 확장) (0) | 2015.03.31 |
* 체크해서 값부여
if(!$('input:radio[name="delegate"]:checked').val()) {
$('input:radio[name="delegate"]:input[value="0"]').attr("checked",true);
}
* 체크여부
$('input:radio[name=이름]').is(':checked');
$('input:checkbox[name=이름]').is(':checked');
input 한글만, 영어만, 숫자만 (0) | 2015.07.23 |
---|---|
a 앵커 이동 부드럽게 이동 (0) | 2015.07.23 |
라디오값(radio) 가져오기 (0) | 2015.04.21 |
jquery validate 메시지를 alert으로 변환하기 (0) | 2015.04.06 |
이노릭스 어로드 파일 순서 설정 (0) | 2015.03.30 |