프로그램/php2014. 2. 20. 19:56
반응형

header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
php 소스 제일 상단에 위 소스를 삽입한다.

 

이렇게 해도 안된다면 session_start()를 확인해본다. <- 자세히 보기

반응형
Posted by 은둔고수
반응형

키코드(event.keycode)값을 알려주는 사이트 : http://www.w3.org/2002/09/tests/keys.html

37 : 왼쪽 화살표 (←)

38 : 위쪽 화살표 (↑)

39 : 오른쪽 화살표 (→)

40 : 아래쪽 화살표 (↓)

13 : 엔터키 (Enter Key)

반응형
Posted by 은둔고수
반응형

substring

첫 번째 인자는 시작지점, 두 번째 인자는 끝지점(옵션)

예>

var s = 'ABC1234';

s.substring(3) -> 1234

s.substring(0,3) -> ABC

 

substr

첫 번째 인자는 시작지점, 두 번째 인자는 추출할 문자열의 길이

예>

s.substr(3,1) -> 1

s.substr(0,3) -> ABC

s.substr(3,4) -> 1234 

반응형
Posted by 은둔고수
프로그램/linux2014. 1. 27. 15:45
반응형

]# rename [변경할 문자] [변경될 문자] 변경할 파일명

 

 ]# rename tn_1 tn_3 tn_1*

 

리눅스에서 파일명을 변경하는 방법으로 파일을 옯길 수 있는 이동 명령어 mv를 이용해서 할 수도 있지만

이름 변경 명령어 rename이 있다.

또한 rename 명령어를 이용하면 많은 파일을 일괄 변경을 할 경우에 편리하다. 

반응형
Posted by 은둔고수
프로그램/php2014. 1. 16. 19:20
반응형

php.ini 파일 위치를 먼저 확인한다. <- 더보기

phpinfo()를 php 파일로 만들어서 웹 브라우저를 실행한다.

 

Configuration File (php.ini) Path 이 부분이 설정한 php.ini 파일이 있는 위치이다.

Loaded Configuration File 이 부분은 php.ini 파일이 로딩된 경로이며

none 또는 값이 없으면 설정한 경로에 파일이 없는 경우일 수 있으며

설정한 값이 아닌 기본 설정으로 로딩이 된 경우이다.

 

 

php.ini 파일을 찾아

Configuration File (php.ini) Path 위치에 php.ini 파일을 옮긴 후

설정을 변경해서 적용한 후 아파치를 재 시작한다.

php.ini 설정을 변경해서 apache를 재 시작했음에도 적용이 안된다면 이 두 부분을 확인해본다.

반응형
Posted by 은둔고수
프로그램/php2014. 1. 16. 19:00
반응형

]# whereis php.ini

또는

<? phpinfo(); ?> 파일을 만들어서 웹 브라우저에서 실행한 후

Configuration File (php.ini) Path 이 부분을 확인한다.

 

 

php.ini 설정을 변경해도 적용이 안된다면 더보기>

반응형
Posted by 은둔고수
프로그램/php2014. 1. 16. 18:46
반응형

php.ini 파일을 연 후 date.timezone = asia/seoul 설정을 해 준 후 아파치(apache) 데몬을 재 시작한다.

 

 에러 내용 :

Warning: date(): It is not safe to rely on the system's timezone settings.You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in 에러 파일 경로 on line 1

 

php 5.3.x 버전 이후부터 date.timezone을 설정해야 한다. 더보기> php.ini 설정 파일 위치 찾기

반응형
Posted by 은둔고수
반응형

String.prototype.atrim = function()
{
 return this.replace(/\s/g,'');
}

 

모든 공백을 제거한 후 값을 반환한다.

사용 예 : document.getElementById("id").value = document.getElementById("id").value.atrim();

<input type="text" onblur="this.value=this.value.atrim()" />

tirm() : 좌우 공백 없애기 더보기> 

반응형
Posted by 은둔고수
프로그램/php2014. 1. 3. 21:13
반응형

header("Content-type: text/html; charset=utf-8");

UTF-8로 변환

 

header("Content-type: text/html; charset=euc-kr");

EUC-KR로 변환

 

제일 상단에 적용.

반응형
Posted by 은둔고수
반응형

 

<!DOCTYPE HTML>
<html>
 <head>
  <title>javascript 나이 계산</title>
  <style>
  input {height:12px;}
  p {display:inline;}
  .nb {ime-mode: disabled;}
  #y {width:30px;}
  #m, #d {width:15px;}
  #btn_age {height:20px;}
  </style>
  <script type="text/javascript">
  // 숫자 확인
  String.prototype.only_number = function(){
   return this.replace(/[^0-9]/gi, '');
  }

  // 나이 계산
  function fnAge()
  {
   var today = new Date();
   var y = document.getElementById('y').value;

   if(y == '' || y.length < 4)
   {
    alert('년도(예>1990)를 입력하세요.');
    document.getElementById('age').innerText = '?';
    document.getElementById('y').focus();
    return false;
   }

   if(Number(y) < (today.getFullYear() - 150))
   {
    alert('나이가 너무 많습니다.');
    document.getElementById('age').innerText = '?';
    document.getElementById('y').focus();
    return false;
   }

   if(Number(y) >= today.getFullYear())
   {
    alert('1살 이하입니다.');
    document.getElementById('age').innerText = '?';
    document.getElementById('y').focus();
    return false;
   }

   var m = document.getElementById('m').value;

   if(m == '' || m.length < 1 || (Number(m) < 1 || Number(m) > 12))
   {
    alert('월(예>1~12)을 입력하세요.');
    document.getElementById('age').innerText = '?';
    document.getElementById('m').focus();
    return false;
   }

   var d = document.getElementById('d').value;

   if(d == '' || d.length < 1 || (Number(d) < 1 || Number(d) > 31))
   {
    alert('일(예>1~31)을 입력하세요.');
    document.getElementById('d').focus();
    return false;
   }

   var birthday = new Date(m + '/' + d + '/' + y);
   var years = today.getFullYear() - birthday.getFullYear();

   // 현재 년도에서 생일을 재설정
   birthday.setFullYear(today.getFullYear());

   // 생일이 지났으면 -1
   if(today < birthday)
   {
    years--;
   }

   document.getElementById('age').innerHTML = years;
  }
  </script>
 </head>
<body>
 <p>생년월일 : </p>
 <input type="text" id="y" maxlength="4" class="nb" value="" onblur="this.value=this.value.only_number();" />년
 <input type="text" id="m" maxlength="2" class="nb" value="" onblur="this.value=this.value.only_number();" />월
 <input type="text" id="d" maxlength="2" class="nb" value="" onblur="this.value=this.value.only_number();" />일
 / 나이 : 만
 <p id="age">?</p>살
 <input type="button" id="btn_age" onclick="fnAge()" value="확인" />
</body>
</html>

반응형
Posted by 은둔고수