본문 바로가기

Programming

(57)
[PHP]htmlspecialchars에 대해 아마 htmlspecialchars 사용해 보신 분들은 &#로 변형되는 글자 때문에 고민하셨으리라 생각합니다. 이경우 보통 str_replace로 하나하나 바꿔주었죠. str_replace를 사용하는 방법도 있지만 모르시는 분들을 위해 다른 방법을 소개할까 합니다. function htmlspecialchars2($s) { return(strtr($s, array('&#' => '&#', '&' => '&', '"' => '"', ''))); } 어느게 더 빠른지 테스트나 해봐야겠네요. 그럼... 자료출처: http://www.nzeo.com/bbs/zboard.php?id=p_study&no=786 ##########################################################..
[PHP]트랜잭션 mysql_query("SET AUTOCOMMIT=0", $DB); mysql_query("begin", $DB); $SQL = " DELETE FROM " . $table . " WHERE NO = " . $R_NO . " "; //echo "SQL = " . $SQL . " "; mysql_query($SQL, $DB); if (mysql_errno() != 0) { $StrErrorMsg = mysql_error(); mysql_query("rollback", $DB); mysql_close($DB); ?>
[PHP]파일다운로드 $dnfile = $file; //실제 파일명 또는 경로 if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)) { if(strstr($HTTP_USER_AGENT, "MSIE 5.5")) { header("Content-Type: doesn/matter"); header("Content-disposition: filename=$dnfile"); header("Content-Transfer-Encoding: binary"); header("Pragma: no-cache"); header("Expires: 0"); } if(strstr($HTTP_USER_AGENT, "MSIE 5.0")) { Header("Content-type: fil..
[JAVASCRIPT]주석 //
[JAVASCRIPT]CONSOLE 오류 대처법 try{ console }catch(e){ console={}; console.log = function(){}; }
[PHP]함수 //모든상수출력print_r(get_defined_constants(true));//모든변수출력 function array_prt($arr,$lv) { $tab = ""; for($i=0;$i //php-extract function extract(array $data){ foreach($data as $key => $val){ $$key = $val; } } /*** SQL Injection 방지 ***/ function mysql_save($str) { if(is_numeric($str)) $ret = $str; else $ret = mysql_real_escape_string(htmlspecialchars(trim($str))); return $ret; } /*** 역슬래시(\) 제거 ***/ fu..
[ASP]헤더정보모두표시 For Each strKey In Request.ServerVariables response.write "[[[[[[[[strKey = ]]]]]]]]]]]]" & strKey & vbCrLf response.write "[[[[[[[Request.ServerVariables(strKey) = ]]]]]]]" & Request.ServerVariables(strKey) & vbCrLf Next
[ASP]ASP에서 URL인코딩 디코딩