Search Results for '프로그래밍'


1206 posts related to '프로그래밍'

  1. 2019/10/30 JavaScript 스택(stack)을 이용한 사칙연산(+ - * /) 계산기
  2. 2019/10/30 화이트 도메인 스팸 차단 리스트 / 도메인 설정
  3. 2019/10/30 JavaScript 어제날짜, 내일날짜 구하기
  4. 2019/10/30 정규표현식 제목에 특수문자 정리하는 정규식
  5. 2019/10/30 PHP date 함수에서 사용할 수있는 포맷문자열
  6. 2019/09/18 BeautifulSoup4 에러 해결 방법
  7. 2019/09/16 파이썬 IP 확인 소스
  8. 2019/08/29 그누보드 각 게시판 글 수 구하기
  9. 2019/08/21 mysql 특정 문자열 치환 ( 특정 문자열 변경 ) REPLACE
  10. 2019/07/30 시놀로지 폴더 마운트
  11. 2019/07/23 파이썬 실행파일 만들기 icon 파일 포함하여 4
  12. 2019/07/21 구글 공식 ADB, Fastboot툴 다운로드 제공
  13. 2019/07/18 영카트 orderformupdate.php 특정 회원 주문시 입금 처리 하기
  14. 2019/06/27 자바스크립트 멋진 소스 데모
  15. 2019/05/10 위치정보를 가져오기 위해서는 getCurrentPosition() 함수를 사용하면 됩니다.
  16. 2019/04/12 tr class 개수 처리
  17. 2019/04/12 특정 DB ENGINE 일괄변경
  18. 2019/04/12 숫자를 한글로 금액 단위 사용시
  19. 2019/04/12 CURL 사용법
  20. 2019/04/12 남은 일수 체크
  21. 2019/04/12 php 소스 그대로 노출되는 경우
  22. 2019/04/01 랜덤 배너 노출 스크립트
  23. 2019/04/01 값이 숫자인지 확인, Is_numeric() 함수
  24. 2019/04/01 페이지 접속시 자동으로 한번만 새로고침 하기
  25. 2019/04/01 동영상 사이트 주소 정규식
  26. 2019/03/25 홈페이지 쇼핑몰 최적화 방법
  27. 2019/03/22 php코드의 에러를 알려주는 사이트
  28. 2019/03/22 검색엔진최적화(seo) 필수 메타태그
  29. 2019/03/22 if, else 를 줄이는 방법
  30. 2019/03/21 php substr 함수 사용법
사용자 삽입 이미지



엑셀과 MYSQL 연동처리 하는 프로그램입니다 오라클에서 업데이트를 안해서 데이터가 많아지면 먹통이 되네요.
이를 써야 할지 말아야할지 고민입니다.

https://dev.mysql.com/downloads/windows/excel/ 

최신 버전을 받을수 있습니다.
2019/11/08 13:55 2019/11/08 13:55
<script>
// 연산자의 연산 우선순위
function getOpPrec(op) 
    switch (op)
    {
        case '*':
        case '/':
            return 5;
        case '+':
        case '-':
            return 3;    
        case '(': 
            return 1;    
    }
    return -1;
}
// 연산자의 우선순위 비교
function whoPrecOp(op1, op2) 
{
    return getOpPrec(op1) >= getOpPrec(op2);    // op1의 연산순위가 높거나 같다면 참
}
function postfixNotation(exp) 
{  
    var stack = [], convExp = [], tok, popOp; 
    exp = exp.replace(/\s/g, '').match(/[\d\.]+|[^\d\.]/g).reverse();  // 공백제거 및  배열로 분리
    while (tok = exp.pop()) {    
        // 숫자가 아니라면(연산자라면) 
        if (isNaN(tok)) {    
            switch (tok)
            {
                case '(':
                    stack.push(tok);
                    break;
                case ')':
                    while (1) {
                        popOp = stack.pop();
                        if ( popOp == '(' )
                            break;
                        convExp.push(popOp);
                    }
                    break;
                case '+': case '-':
                case '*': case '/':
                    while (stack.length && whoPrecOp(stack[stack.length-1], tok))
                        convExp.push(stack.pop());
                    stack.push(tok);
                    break;
            }
        } else     // 숫자라면(피연산자라면)
            convExp.push(tok); 
    }          
    while (stack.length)  
        convExp.push(stack.pop());    
    return convExp;  
}
function evalPostfixNotation(exp) 
{
    var i, tok, n1, n2, stack = [];
    for (i in exp) {   
        tok = exp[i];
        // 연산자라면 
        if (isNaN(tok)) {
            n2 = Number(stack.pop());
            n1 = Number(stack.pop());
            switch (tok)
            {
                case '*':
                    stack.push(n1 * n2);
                    break;
                case '/':
                    stack.push(n1 / n2);
                    break;
                case '+':
                    stack.push(n1 + n2);
                    break;
                case '-':
                    stack.push(n1 - n2);
                    break;
            }
        } else     // 숫자라면            
            stack.push(tok);
    } 
    return stack.pop();
}
document.write( evalPostfixNotation(postfixNotation( '((3.5 - 2) + 3.4) * (14 - 10)' )));
</script>
2019/10/30 15:16 2019/10/30 15:16
https://spam.kisa.or.kr/white/sub1.do

이메일서버 등록하면 끝 !
2019/10/30 15:14 2019/10/30 15:14
$yesterday = date("Y-m-d", mktime(0,0,0,date("m"),date("d")-1,date("Y")));
$tomorrow = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+1,date("Y")));
2019/10/30 15:11 2019/10/30 15:11
제목에 특수문자 정리하는 정규식
[한글, 숫자, 영어, <>/,.%&-"' ] 딱 이문자들만 허용!
더 추가하고 싶은 문자 있으면 [대괄호] 안에 추가 하면 됩니다.
php 예제 
$subject = preg_replace("|([^가-힣0-9a-zA-Z\s<>\(\)\[\]\"\'.,/&%:-])|u", " ", $subject);
2019/10/30 15:08 2019/10/30 15:08
a : "am" 또는 "pm"
A : "AM" 또는 "PM"
d : 두자리로 표현되는 날짜, 즉 "01"~"31"
D : 세글자로 표현되는 요일, 즉 "Fri"
F : 월을 긴 문장으로 나타냅니다. 즉 "January"
h : 시간을 12시간 단위로 나타냅니다. "01"~"12"
H : 시간을 24시간 단위로 나타냅니다.
g : 시간을 12시간 단위로 0 없이 나타냅니다. "1"~"12"
G : 시간을 24시간 단위로 0 없이 나타냅니다. "0"~"24"
i : 분을 나타냅니다. "00"~"59"
j : 날짜를 0 없이 나타냅니다. "1"~"31"
l : (L의 소문자)요일을 나타냅니다. "Friday"
L : 윤년인지의 여부를 나타냅니다. "0" 또는 "1"
m : 달을 나타냅니다. "01"~"12"
n : 0 없이 달을 나타냅니다. "1"~"12"
M : 3글자로 달을 나타냅니다. "Jan"
s : 초를 나타냅니다. "00"~"59"
S : 영어에서 순서를 나타내는 2글자로 된 접미사; "th", "nd"
t : 주어진 달의 날 수; 즉 "28"~"31"
U : 기준시점(GMT 1970년 1월1일 00:00:00)으로부터 지난 시간을 초로 표시
w : 요일을 숫자로 표시합니다. 즉 "0"(일요일) ~ "6"(토요일)
Y : 4글자로 연도표시, "1999"
y : 2글자로 연도표시, "99"
z : 날짜를 표시, "0"~"365"
Z : 지역간의 시간편차를 초단위로 표시, 즉 "-43200"~"43200"
2019/10/30 15:06 2019/10/30 15:06
한시간 넘도록 오류를 뿜어

$ pip uninstall BeautifulSoup4
$ easy_install BeautifulSoup4

그냥 지웠다 설치 하니 해결 된다. 젠장할~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019/09/18 13:21 2019/09/18 13:21
from requests import get
import time

ip = get('https://youngsam.net/ipadd.php').text

while True:
print(ip)
time.sleep(5)
2019/09/16 11:08 2019/09/16 11:08
그누보드 각 게시판 글 수 구하기
<?php
$row = sql_fetch(" select bo_count_write from g5_board where bo_table='free' ");
echo $row[bo_count_write];
?>
2019/08/29 10:58 2019/08/29 10:58
mysql 특정 문자열 치환 ( 특정 문자열 변경 ) REPLACE


UPDATE 테이블명 SET 필드명 = REPLACE(필드명, '치환전 내용', '치환후 내용');


REPLACE
2019/08/21 16:56 2019/08/21 16:56
sudo mount --bind /volume2/homes/openkr /volume1/web/openkr

위 형식으로 실행하면 reboot 이후 마운트가 헤지 된다. 이를 해결 할 방법이 있다. 

시놀로지 6X 이후 부터 변경

/usr/local/etc/rc.d  디렉토리에 S99mount.sh 파일을 만들어서 넣어 주면 자동 실행 된다.

즉 

/usr/local/etc/rc.d 폴더에 S99mount.sh 파일을 만들어서 내용에  sudo mount --bind /volume2/homes/openkr /volume1/web/openkr

한줄 추가 하면 끝난다  퍼미션 755 주고 재부팅 하면 끝

====================================================================================

6.2 버전 부터 [작업 스케줄러]  사용자 정의 스크립트 마운트 기능이 추가 되었습니다. 
 
mount --bind /volume2/homes/openkr /volume1/web/openkr

추가하면 끝

사용자 삽입 이미지
2019/07/30 21:37 2019/07/30 21:37
EXE 파일 만들기
실행파일을 만들 000.py파일이 있는 폴더로 이동한 후에
pyinstaller.exe 000.py  실행합니다.
파일 하나로 만들려면 -F 옵션을 줍니다.
pyinstaller.exe -F 000.py
만약 console창을 숨기고 싶으면 다음과 같은 --noconsole 옵션을 추가하면 됩니다.
pyinstaller.exe -F --noconsole 000.py
실행파일 아이콘 삽입
pyinstaller.exe -F --noconsole --icon=icon\icon.ico ipadd.py

pyinstaller --onefile --icon=icon\icon.ico ipadd.py
icon 이라는 폴더의 icon.ico 파일입니다. 혹시 target.py 과 동일한 경로에 있을경우 --icon 를 -icon 수정하면 됩니다.
어떤 경우 C:\ 경로 가 아닌경우 액세스 오류가 나는 경우가 있습니다. 이럴경우 C 경로로 이동하여 실행 하면 정상 작동 합니다.
...
2019/07/23 12:59 2019/07/23 12:59
https://dl.google.com/android/repository/platform-tools-latest-windows.zip  윈도우



https://dl.google.com/android/repository/platform-tools-latest-darwin.zip 맥




https://dl.google.com/android/repository/platform-tools-latest-linux.zip 리눅스

2019/07/21 16:31 2019/07/21 16:31
$od_status = '주문';
$od_tno    = '';
if ($od_settle_case == "무통장")
{
    $od_receipt_point   = $i_temp_point;
    $od_receipt_price   = 0;
    $od_misu            = $i_price - $od_receipt_price;
if ($member['mb_id'] == "test") {
$od_misu = 0; // 미수잔액을 0으로
$od_receipt_price = $i_price; // 입금금액  $i_price  
}
if($od_misu == 0) {
$od_status      = '입금';
$od_receipt_time = G5_TIME_YMDHIS;
}
}

대략 272 라인 
shop/orderformupdate.php
2019/07/18 21:29 2019/07/18 21:29
https://www.developerdrive.com/11-experimental-javascript-projects-pushing-the-boundaries-of-scripting/

11 EXPERIMENTAL JAVASCRIPT PROJECTS PUSHING THE BOUNDARIES OF SCRIPTING

http://it79.egloos.com/v/1046109
2019/06/27 21:27 2019/06/27 21:27
<script>
var x=document.getElementById("demo");
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
  }
function showPosition(position)
  {
  x.innerHTML="Latitude: " + position.coords.latitude +
  "<br />Longitude: " + position.coords.longitude;
  }
</script>
2019/05/10 11:30 2019/05/10 11:30
var numOfVisibleRows = $('tr.erd').filter(function() {
  return $(this).css('display') !== 'none';
}).length;
 
for(var ii=1;ii<=numOfVisibleRows;ii++) {
}
2019/04/12 12:05 2019/04/12 12:05
<?php
include_once('./_common.php');
$sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'dbbame' and engine = 'InnoDB'";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
    $tbl = $row[0];
    $sql = "ALTER TABLE $tbl ENGINE=MyISAM";
    mysql_query($sql);
}
?>
 
 
InnoDB 인 것을 MyISAM으로
2019/04/12 12:04 2019/04/12 12:04
$pricem=$price_sum_tot; 
$trans_kor=array("","일","이","삼","사","오","육","칠","팔","구"); 
$price_unit=array("","십","백","천","만","십","백","천","억","십","백","천","조","십","백","천"); 
$valuecode=array("","만","억","조"); 
$value=strlen($pricem); 
$k=0; 
for($i=$value;$i>0;$i--){ 
    $vv=""; 
    $vc=substr($pricem,$k,1); 
    $vt=$trans_kor[$vc]; 
    $k++; 
    if($i%5 ==0){ 
        $vv=$valuecode[$i/5];
    } else { 
        if($vc) $vv=$price_unit[$i-1];
    } 
    
    $vr=$vr.$vt.$vv; 
}
2019/04/12 12:02 2019/04/12 12:02
cURL (Client URL Library Functions)
제작자 Daniel Stenberg 의 설명을 그대로 변역하면
curl is a comand line tool for transferring files with URL syntax
커맨드라인에서 URL 문법을 사용하여 파일을 전송 프로그램
내가 원하는 주소의 페이지에서 내가 임의의 값을 넣고 그 넣은 값으로 페이지에서 리턴되는 값을 받아오는 역할을 한다.
PHP에서 cURL을 사용하려는 사람들 대부분이 아마도 HTTPS 접속 때문일 것이다.
소켓 또는 그 외 여러가지 접속방법이 있는데 굳이 cURL을 사용하는 건 속도면에서도 빠르고 HTTPS도 쉽게 접속할 수 있기 때문이다.
cURL 모듈을 서버에 설치해야 합니다.(리눅스 - curl.so, 윈도우 - php_curl.dll 확장모듈 필요)
 
cURL로 가능한 일
HTTPS certificates
HTTP POST
HTTP PUT
FTP upload
HTTP Form
cookie
authentication
 
cURL, Client URL Library Functions
curl_init : 세션 초기화, 핸들값 리턴
curl_setopt : 옵션 세팅
curl_exec : curl을 실행
curl_errno : 에러번호를 가져온다.
curl_error : 에러 메시지를 가져온다.
curl_getinfo : 상태 정보를 리턴한다.
curl_close : curl 세션을 닫는다
 
[예제1 : POST방식으로 데이터 전송(simple)]
<?
$post_data = array(
"name" => "홍길동",
"birthday" => "1980-08-20"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://www.example.com);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
?>
 
[예제2: POST방식으로 데이터 전송(function)]
<?
function fetch_page($url,$param,$cookies,$referer_url){
if(strlen(trim($referer_url)) == 0) $referer_url= $url;
$curlsession = curl_init ();
curl_setopt ($curlsession, CURLOPT_URL, \"$url\");
curl_setopt ($curlsession, CURLOPT_POST, 1);
curl_setopt ($curlsession, CURLOPT_POSTFIELDS, \"$param\");
curl_setopt ($curlsession, CURLOPT_POSTFIELDSIZE, 0);
curl_setopt ($curlsession, CURLOPT_TIMEOUT, 60);
if($cookies && $cookies!=\"\"){
curl_setopt ($curlsession, CURLOPT_COOKIE, \"$cookies\");
}
curl_setopt ($curlsession, CURLOPT_HEADER, 1); //헤더값을 가져오기위해 사용합니다. 쿠키를 가져오려고요.
curl_setopt ($curlsession, CURLOPT_USERAGENT, \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\");
curl_setopt ($curlsession, CURLOPT_REFERER, \"$referer_url\");
ob_start();
$res = curl_exec ($curlsession);
$buffer = ob_get_contents();
ob_end_clean();
if (!$buffer) {
$returnVal = \"Curl Fetch Error : \".curl_error($curlsession);
}else{
$returnVal = $buffer;
}
curl_close($curlsession);
return $returnVal;
}
?>
 
[예제3 : 파일 전송]
<?
$post_data['data[0]'] = "@image/img_01.jpg";
$post_data['data[0]'] = "@image/img_02.jpg";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://www.example.com/upload.php);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$postResult = curl_exec($ch);
?>
[예제4 : https 접속]
<?
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"https://www.test.com"); //접속할 URL 주소
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // 인증서 체크같은데 true 시 안되는 경우가 많다.
// default 값이 true 이기때문에 이부분을 조심 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_SSLVERSION,3); // SSL 버젼 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_HEADER, 0); // 헤더 출력 여부
curl_setopt ($ch, CURLOPT_POST, 1); // Post Get 접속 여부
curl_setopt ($ch, CURLOPT_POSTFIELDS, "var1=str1&var2=str2"); // Post 값 Get 방식처럼적는다.
curl_setopt ($ch, CURLOPT_TIMEOUT, 30); // TimeOut 값
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // 결과값을 받을것인지
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
 
[예제5 : curl을 이용한 Gmail 로그인]
$src = "https://".$gmailId.":".$gmailPw."@mail.google.com/mail/feed/atom";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, 'My Agent Name');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
$res = curl_exec($ch);
curl_close($ch);
/** 결과는 Atom xml 형식이다. DOM 또는 xml 파싱 function을 이용해서 파싱하면 됩니다. **/
echo $res;
?>
 
[예제6 : cURL을 이용한 웹페이지 가져오기]
<?php
function get_content($url) {
$agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)';
$curlsession = curl_init ();
curl_setopt ($curlsession, CURLOPT_URL, $url);
curl_setopt ($curlsession, CURLOPT_HEADER, 0);
curl_setopt ($curlsession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curlsession, CURLOPT_POST, 0);
curl_setopt ($curlsession, CURLOPT_USERAGENT, $agent);
curl_setopt ($curlsession, CURLOPT_REFERER, "");
curl_setopt ($curlsession, CURLOPT_TIMEOUT, 3);
$buffer = curl_exec ($curlsession);
$cinfo = curl_getinfo($curlsession);
curl_close($curlsession);
if ($cinfo['http_code'] != 200)
{
return "";
}
return $buffer;
}
?>
 
curl_close
기능 : cURL 세션을 닫는다.
구문 : curl_close(resource ch)
cURL 세션을 닫고, 리소스를 비워준다. 또한 cURL 핸들은 삭제된다.
 
기능 : 마지막 에러 번호를 리턴해 준다.
구문 : curl_errno(resource ch)
만일 연산 후 어떠한 에러도 발행하지 않았다면 0(zero)을 리턴한다.
 
Error Code
There exists a bunch of different error codes and their corresponding error messages that may appear during bad conditions. At the time of this writing, the exit codes are:
1 - Unsupported protocol. This build of curl has no support for this protocol.
2 - Failed to initialize.
3 - URL malformat. The syntax was not correct.
잘못된 형식의 도메인
5 - Couldn't resolve proxy. The given proxy host could not be resolved.
6 - Couldn't resolve host. The given remote host was not resolved.
해당 도메인을 못찾는다는 뜻
네임서버가 제대로 등록되어 있는지 확인하고 도메인도 정확한지 확인할 것.
7 - Failed to connect to host.
8 - FTP weird server reply. The server sent data curl couldn't parse.
9 - FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change to a directory that doesn't exist on the server.
11 - FTP weird PASS reply. Curl couldn't parse the reply sent to the PASS request.
13 - FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.
14 - FTP weird 227 format. Curl couldn't parse the 227-line the server sent.
15 - FTP can't get host. Couldn't resolve the host IP we got in the 227-line.
17 - FTP couldn't set binary. Couldn't change transfer method to binary.
18 - Partial file. Only a part of the file was transferred.
19 - FTP couldn't download/access the given file, the RETR (or similar) command failed.
21 - FTP quote error. A quote command returned error from the server.
22 - HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code only appears if -f/--fail is used.
23 - Write error. Curl couldn't write data to a local filesystem or similar.
25 - FTP couldn't STOR file. The server denied the STOR operation, used for FTP uploading.
26 - Read error. Various reading problems.
27 - Out of memory. A memory allocation request failed.
28 - Operation timeout. The specified time-out period was reached according to the conditions.
30 - FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!
31 - FTP couldn't use REST. The REST command failed. This command is used for resumed FTP transfers.
33 - HTTP range error. The range "command" didn't work.
34 - HTTP post error. Internal post-request generation error.
35 - SSL connect error. The SSL handshaking failed.
36 - FTP bad download resume. Couldn't continue an earlier aborted download.
37 - FILE couldn't read file. Failed to open the file. Permissions?
38 - LDAP cannot bind. LDAP bind operation failed.
39 - LDAP search failed.
41 - Function not found. A required LDAP function was not found.
42 - Aborted by callback. An application told curl to abort the operation.
43 - Internal error. A function was called with a bad parameter.
45 - Interface error. A specified outgoing interface could not be used.
47 - Too many redirects. When following redirects, curl hit the maximum amount.
48 - Unknown TELNET option specified.
49 - Malformed telnet option.
51 - The peer's SSL certificate or SSH MD5 fingerprint was not ok
에러 메시지) SSL: certificate subject name 'www.test.co.kr' does not match target host name 'test.co.kr'
해결1) 인증서 발급받은 주소로 호출하거나
해결2) 설정으로 제어
$soapClient->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);
52 - The server didn't reply anything, which here is considered an error.
53 - SSL crypto engine not found
54 - Cannot set SSL crypto engine as default
55 - Failed sending network data
56 - Failure in receiving network data
58 - Problem with the local certificate
59 - Couldn't use specified SSL cipher
60 - Peer certificate cannot be authenticated with known CA certificates
인증서 신뢰 검증에 실패한 경우다. (통합인증서, 번들과 관련 있는 듯)
에러 메시지) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
해결) 신뢰 검증을 하지 않도록 설정.
상호 서버가 신뢰된다면 굳이 신뢰성을 검증하지 않아도 된다.
$soapClient->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
61 - Unrecognized transfer encoding
62 - Invalid LDAP URL
63 - Maximum file size exceeded
64 - Requested FTP SSL level failed
65 - Sending the data requires a rewind that failed
66 - Failed to initialise SSL Engine
67 - User, password or similar was not accepted and curl failed to login
68 - File not found on TFTP server
69 - Permission problem on TFTP server
70 - Out of disk space on TFTP server
71 - Illegal TFTP operation
72 - Unknown TFTP transfer ID
73 - File already exists (TFTP)
74 - No such user (TFTP)
75 - Character conversion failed
76 - Character conversion functions required
77 - Problem with reading the SSL CA cert (path? access rights?)
78 - The resource referenced in the URL does not exist
79 - An unspecified error occurred during the SSH session
80 - Failed to shut down the SSL connection
XX - There will appear more error codes here in future releases. The existing ones are meant to never change
 
curl_error
기능 : 그 현재의 세션에 대한 마지막 에러 메시지를 되돌려 준다.
구문 : curl_error(resource ch)
만일 cURL 연산 후 에러를 발생하면 에러메시지를 되돌려 주며, 에러가 발생하지 않으면 빈문자열을 되돌려 준다.
 
 
curl_init
기능 : 세션을 초기화하고 curl_setopt(), curl_exec() 그리고 curl_close 함수들과 함께 사용하기 위해 CURL 핸들값을 리턴해준다.
구문 : resource curl_init([string $url])
옵션 Url 매개변수가 포함되어 있다면 CURLOPT_URL 옵션은 매개변수의 값을 셋팅할 것이다.
curl_setopt()를 이용하여 셋팅할 수 있다.
리턴 : 핸들값 or False
예제 : 새로운 curl세션을 초기화하고 웹페이지를 페칭한다.
< ?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
 
curl_exec
기능 : 세션을 싱행한다.
구문 : curl_exec(resource ch)
이 함수는 cURL 세션을 초기화하고 세션의 옵션들을 셋팅한 후에 불려져야만 한다.
본 함수의 목적은 단순히 미리 정의된 cURL 세션을 실행하기 위한 것이기 때문이다.
 
 
curl_getinfo
기능 : 특정 전송에 대한 정보를 받는다.
구문 : crul_getinfo(resource ch [, int opt])
 
 
 
curl_setopt
CURLOPT_FOLLOWLOCATION
TRUE to follow any "Location: " header that the server sends as part of the HTTP header (note this is recursive, PHP will follow as many "Location: " headers that it is sent, unless CURLOPT_MAXREDIRS is set).
FOLLOWLOCATION 옵션 설정. 위치 헤더가 존재하면 따라간다.
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, tru
 
CURLOPT_HEADER
TRUE to include the header in the output.
헤더 정보를 받기 원한다면 이 옵션을 추가한다.
VALUE : 1 OR true
curl_setopt($ch, CURLOPT_HEADER, false);
 
CURLOPT_NOBODY
TRUE to exclude the body from the output.
본문의 정보를 받기 원하지 않는다면 이 옵션을 추가한다.
CURLOPT_POST
TRUE to do a regular HTTP POST. This POST is the normal application/x-www-form-urlencoded kind, most commonly used by HTML forms.
전송 메소드를 설정한다.
VALUE : 1-POST, 0-GET
curl_setopt($ch, CURLOPT_POST,1);
CURLOPT_RETURNTRANSFER
TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
REQUEST 에 대한 결과값을 받을 건지 체크
(WRITERUNCTION 콜백을 사용하는 대신, curl_exec 함수을 위한 반환 값으로 원격지 내용을 받는다.)
#Resource ID 형태로 넘어옴 :: 내장 함수 curl_errno 로 체크
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2).
인증서 체크같은데 true 시 안되는 경우가 많다.
default 값이 true 이기때문에 이 부분을 조심 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
CURLOPT_PORT
An alternative port number to connect to.
CURLOPT_SSLVERSION
The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually.
SSL 버젼 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_SSLVERSION,3);
 
CURLOPT_TIMEOUT
The maximum number of seconds to allow cURL functions to execute.
REQUEST 에 대한 결과값을 받는 시간타임 설정한다.
curl_setopt($ch, CURLOPT_TIMEOUT,100);
CURLOPT_POSTFIELDS
The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path.
POST 메소드라면 파라미터 값들을 이 옵션에 정의하면 된다.
curl_setopt($cu, CURLOPT_POSTFIELDS,$vars); // 보낼 데이타 형식은 GET 방식으로 설정
ex) $vars = "arg=$arg1&arg2=$arg2&arg3=$arg3";
CURLOPT_REFERER
The contents of the "Referer: " header to be used in a HTTP request.
리퍼러 정보를 설정
CURLOPT_URL
The URL to fetch. This can also be set when initializing a session with curl_init().
접속할 url정보를 설정
curl_init()에서 url를 설정하면 별도 설정이 필요없다.
curl_setopt($ch, CURLOPT_URL, 'http://www.exsample.com');
CURLOPT_USERAGENT
The contents of the "User-Agent: " header to be used in a HTTP request.
에이전트 정보를 설정
curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
2019/04/12 12:01 2019/04/12 12:01
// 선택 옵션에서 숫자만
$use_io_days =  preg_replace("/[^0-9]*/s", "", $row[io_id]);
 
​// 해당일만큼 증가 후 종료일로 지정 - 현재일과 차이
$use_date =  (strtotime(date('Y-m-d', strtotime("+".$use_io_days."day", strtotime($row['pay_datetime'])))) - strtotime(G5_TIME_YMD)) / 86400;  //  G5_TIME_YMD​
2019/04/12 12:00 2019/04/12 12:00
# vi /etc/php.ini
1. short_open_tag = On 
<? 
echo "사용가능";
 ?> 
 
2. short_open_tag = Off
<?php
echo "사용가능";
 ?> 
 
2번 흐름 - 보안상 이점
2019/04/12 11:59 2019/04/12 11:59
<script type="text/javascript">
  var result = Math.floor(Math.random() * 8) + 1;
if(result == '1'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '2'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '3'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '4'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '5'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '6'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else  {
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
</script>
2019/04/01 11:34 2019/04/01 11:34
변수 $sam를 is_numeric() 함수를 이용해 숫자형 데이터인 경우 true를 아닌 경우에는 false를 반환

<?php
  $sam="12345";
  // 숫자 타입의 데이터를 선언
  if (is_number($sam)) {
    echo '숫자 입니다.';
  }
  else {
    echo '문자 입니다.';
  }
?>
결과는 (숫자 입니다)
2019/04/01 11:33 2019/04/01 11:33
<?php
if (!$_COOKIE['reload']) {
 setcookie("reload",time()+60*60*24); // 하루동안만..
 echo "<meta http-equiv='Refresh' CONTENT='0'; URL=".$_SERVER['PHP_SELF']." />";
 }
?>
페이지 접속시 자동으로 한번만 새로고침 리로드 하기
2019/04/01 11:29 2019/04/01 11:29
카카오팟 영상 정규식
 
https?:\/\/|www\.)play-tv.kakao.com\/channel\/[0-9]+\/(livelink|cliplink)\/([A-Za-z0-9]+
 
트위터 정규식
 
http(s)?:\/\/(.*\.)?twitter\.com\/(\w+)\/?status\/(\w+)
 
비메오 정규식
 
https?:\/\/|www\.)vimeo.com\/([A-Za-z0-9]+
 
데일리모션 정규식
 
https?:\/\/www\.)dailymotion.com\/video\/([A-Za-z0-9]+
 
유튜브 정규식
 
https?:\/\/www.youtube.com\/watch\?v=([a-zA-Z0-9\-_]+
 
인스타그램 정규식
 
https?:\/\/www\.)?instagram\.com(\/p\/\w+\/?
 
2019/04/01 11:27 2019/04/01 11:27
PageSpeed Tools > Insights 

웹페이지를 자동으로 분석해서 이미지, 자바스크립트, CSS 등 최적화된 파일을 제공합니다.
https://developers.google.com/speed/pagespeed/insights/?hl=ko

DevTools 에서 사용하면 편합니다. 
Online JavaScript/CSS/HTML Compressor 
JavaScript, CSS, HTML 압축
http://refresh-sf.com
http://gnustudy.com/bbs/board.php?bo_table=sitelink&wr_id=26
2019/03/25 09:43 2019/03/25 09:43
http://phpcodechecker.com/

2019/03/22 11:35 2019/03/22 11:35
소용없다! 필요있다 라는 주제로 인터넷에서 돌고 돌아지만 지금은 인정할수 밖에 없는 메타태그 인것 같습니다
검색엔진최적화 seo에 첫걸음인것 같습니다

기본적으로 많이 사용되는 메타태그

1 <meta name="robots" content="index, follow"> 
: 검색 로봇이 문서와 링크를 모두 긁어 가라는 뜻
2 <meta name="description" content="사이트 설명글"> 
: 내 사이트 콘텐츠 설명글!
3 <meta name="keywords" content="태그">  
: 내 사이트에 주요 콘텐츠! 예) 맛집,게임
4 <meta name="Author" content="작성자">
: 사이트 운영자 이름,명칭
5 <meta name="title" content=""> 
: 사이트 타이틀 이름
2019/03/22 11:34 2019/03/22 11:34
if (isset($sql)) {
    // $sql가 있을 경우
    $sql1 = $sql;
} else {
    // $sql가 없을 경우
    $sql1 = "no";
}

 소스가 일반적입니다. 이렇게 사용하면 대략 5줄을 작성하게되는데

$sql1 = isset($sql) ? $sql : "no";

이런 식으로 5줄을 1줄로 줄일 수 있습니다.
2019/03/22 11:30 2019/03/22 11:30