Search Results for '프로그래밍'


1206 posts related to '프로그래밍'

  1. 2018/08/03 정규식으로 유투브 주소에서 아이디 값만 추출
  2. 2018/08/03 PHP ucfirst - 문자열의 첫 번째 문자를 대문자로 만듭니다.
  3. 2018/08/03 도메인 변경 및 http 를 https 로 이동하는 방법
  4. 2018/08/03 네이버 클로버 tts
  5. 2018/08/03 jQuery 폼의 첫번째 입력가능한 필드에 FOCUS 주기
  6. 2018/08/03 리눅스에서 <?php 는 작동하는데 <? 로 시작하면 파일 깨질때
  7. 2018/08/03 PHP 배열 내장함수 - array_change_key_case
  8. 2018/07/30 우분투에 sendmail 설치 설정
  9. 2018/07/29 멀티 도메인 멀티 루트의 Letsencrypt 인증서 만들기
  10. 2018/07/25 마리아DB(RDBMS)에서 NoSQL처럼 유동적인 필드만들기
  11. 2018/07/25 PHP session expires 헤더의 비밀!
  12. 2018/07/25 브라우저 Agent 정보
  13. 2018/07/25 시군 구 동 DB 자료
  14. 2018/07/25 css 도형샘플 사이트
  15. 2018/07/25 이름 마지막 한자리 별표 처리
  16. 2018/07/25 랜덤 이름 생성기
  17. 2018/07/25 아이프레임(iframe) 높이(height:세로) 자동조절
  18. 2018/07/25 다음 실시간 검색어 10개 추출
  19. 2018/07/25 네이버 실시간 검색어 20개 추출
  20. 2018/07/25 그누보드에서 자주사용하는 php함수모음
  21. 2018/07/25 지정된 숫자까지 카운트업하는 숫자 애니메이션
  22. 2018/07/25 SSL 보안서버 적용시 fa아이콘 사용자 깨짐현상 해결 방법
  23. 2018/07/25 전화번호 형식 입력 jquery 플러그인
  24. 2018/07/25 letsencrypt 추가 및 갱신 방법 - 우분투
  25. 2017/12/01 Mysql .frm 과 .idb파일만 남았을때 테이블 구조 및 데이터 복구
  26. 2017/07/05 Python 배포용 실행파일 만들기(PyInstaller)
  27. 2017/05/21 How to Install PHP 7 on Ubuntu 15.10, 15.04 & 14.04 using PPA
  28. 2017/05/21 How to Install PHP 5.4 or PHP 5.5 or PHP 5.6 on Ubuntu 16.04, 14.04 or…
  29. 2017/05/21 Ubuntu 16.04 : Nginx, PHP 7, MySQL 5.7 설치
  30. 2017/04/18 [DBMS] mysql 접속자 많아서 버벅일때 팁입니다.
사용자 삽입 이미지


보통 사이트맵 제작을 위해 웹서비스를 이용하시는데요
설치형으로 간단하게 filter 기능 및 spider 기능이 사용가능한 프로그램 소개합니다.
http://g-mapper.co.uk/sitemap-generator.aspx 
 
에서 설치받아 사용하시면 됩니다.
2018/08/03 11:20 2018/08/03 11:20
<script>
function youtubeId(url) {
    var tag = "";
    if(url)  {
        var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
        var matchs = url.match(regExp);
        if (matchs) {
            tag += "유튜브 아이디 : "+matchs[7];
        }
        return tag;
    }
}
    var s1 = "https://www.youtube.com/watch?v=pAWk-yh2ysc";
    var s2 = "http://youtu.be/WUzwkGmnAaw";
    document.write(youtubeId(s1));
    document.write("<br />");
    document.write(youtubeId(s2));
</script>
2018/08/03 11:11 2018/08/03 11:11
ucfirst - 문자열의 첫 번째 문자를 대문자로 만듭니다.
설명 ¶
문자열 ucfirst ( 문자열 $str )
str문자가 영문자이면 대문자 가 된 첫 문자를 포함한 문자열을 반환합니다 .
'알파벳'은 현재 로켈에 의해 결정됩니다. 예를 들어, 기본 "C"로케일에서 umlaut-a (ä)와 같은 문자는 변환되지 않습니다.
매개 변수 ¶
str
입력 문자열.
반환 값 ¶
결과 문자열을 반환합니다.
예 ¶
Example # 1 ucfirst () 예제
<?php
$foo = 'hello world!';
$foo = ucfirst($foo);             // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar);             // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
2018/08/03 11:09 2018/08/03 11:09
header 를 이용하는 방식과 javascript 를 이용하는 방법을 안내합니다.
방식은 PHP 페이지 최상단에서 위치해야 정상 작동하며, 강력하게 작동합니다.
javascript는 페이지 상단이 아니어도 작동하지만, javascript를 제한한 경우에 작동하지 않습니다.
1. header location 이용
<?php
if($_SERVER['HTTPS'] != "on"){
    $ssl_port = "";  //  443 포트를 사용하지 않는경우에 이용할 포트번호 입력
    if ($ssl_port == "") { 
        $redirect_URL = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $redirect_URL = "https://".$_SERVER['HTTP_HOST'].":".$ssl_port.$_SERVER['REQUEST_URI'];
    }
    header("Location: ".$redirect_URL);
}
?>
2. javascript 이용
<?php
if($_SERVER['HTTPS'] != "on"){
    $ssl_port = "";  //  443 포트를 사용하지 않는경우에 이용할 포트번호 입력
    if ($ssl_port == "") { 
        $redirect_URL = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $redirect_URL = "https://".$_SERVER['HTTP_HOST'].":".$ssl_port.$_SERVER['REQUEST_URI'];
    }
    echo "<script type=\"text/javascript\">\n";
    echo "<!--\n";
    //echo "location.href = '". $redirect_URL ."';\n";  // 현재창으로 전송
    echo "parent.location.href='". $redirect_URL ."';\n";  // 부모창으로 전송
    echo "//-->\n";
    echo "</script>\n";
}
?>
2018/08/03 11:08 2018/08/03 11:08
<?php
$client_id = "";
$client_secret = "";
$txt = $_GET['txt'];
if(!$txt) $txt = '텍스트 파라미터를 입력 바랍니다.';
$encText = urlencode($txt);
$postvars = "speaker=mijin&speed=0&text=".$encText;
$url = "https://openapi.naver.com/v1/voice/tts.bin";
$is_post = true;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $postvars);
$headers = array();
$headers[] = "X-Naver-Client-Id: ".$client_id;
$headers[] = "X-Naver-Client-Secret: ".$client_secret;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if($status_code == 200) {
  header("Content-type: audio/mpeg");
  header("Content-Transfer-Encoding: binary");
  header('Pragma: no-cache');
  header('Expires: 0');
  echo $response;
} else {
  echo "Error 내용:".$response;
}



문제는 1일 1만자 입니다.
2018/08/03 11:06 2018/08/03 11:06
<form id='form'> 
<input type='hidden' name='hide'> 
<input type='text' name='subject'> 
</form> 
$(document).ready(function() { 
    $("#form :input:visible:enabled:first").focus(); 
});
2018/08/03 10:57 2018/08/03 10:57
php.ini 를 수정
php --ini | grep php.ini 를 쳐보면 됩니다.
/etc/php.ini 에 있을수도 있고 /usr/bin/php.ini 에 있을 수도 있습니다.
파일을 열어서 short_open_tag 찾아서 on 으로 바꿔주세요.
서버 재부팅 또는 아파치 재부팅 하셔야합니다.
2018/08/03 10:56 2018/08/03 10:56
array_change_key_case
array array_change_key_case ( array $array [, int $case = CASE_LOWER ] )
input에서 모든 키를 소문자나 대문자로 바꾼 배열을 반환
다차원 배열일때 1차의 키만 변환
주의) 변환 후 동일한 키가 존재할때는 뒤에 값이 앞에 값을 덮어씌움
input - 작업할 배열
case - CASE_UPPER나 CASE_LOWER, 기본값은 CASE_LOWER
```php
// 기본 사용법
$input_array = array("FirSt" => 1, "SecOnd" => 4);
print_r(array_change_key_case($input_array, CASE_UPPER));
/*
Array
(
    [FIRST] => 1
    [SECOND] => 4
)
*/
```
```php
// 변환후 중복키 발생
$input_array = array("FirSt" => 1, "SecOnd" => 4, "First" => 5, "SecONd" => 6);
print_r(array_change_key_case($input_array, CASE_UPPER));
/*
Array
(
    [FIRST] => 5
    [SECOND] => 6
)
*/
```
```php
// 다차원 배열, 1차의 키만 변경
$input_array = array(
    'a' => array("FirSt" => 1, "SecOnd" => 4), 
    'b' => array("Third" => 1, "foUrth" => 8)
);
print_r(array_change_key_case($input_array, CASE_UPPER));
/*
Array
(
    [A] => Array
        (
            [FirSt] => 1
            [SecOnd] => 4
        )
    [B] => Array
        (
            [Third] => 1
            [foUrth] => 8
        )
)
*/
```
2018/08/03 10:54 2018/08/03 10:54
우분투에서 sendmail과 dovecot, saslauthd를 설치하기는 쉽다.
설치는 전부 root권한으로 진행하였다.
 
#apt-get install sendmail
#apt-get install libsasl2-2 libsasl2-modules sasl2-bin
#apt-get install dovecot-pop3d
 
위와같이 하면 설치는 완료다.
 
문제는 설정!!!
일단 smtp인증을 받기 위해서 sendmail.cf 과 sendmail.mc 를 수정한다.
먼저 sendmail.mc 수정
dnl # These are the allowed auth mechanisms. To allow relaying for a user
dnl # that uses one of them, you must set TRUST_AUTH_MECH.
define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
dnl # These are the SMTP auth mechanisms which, if used,
dnl # Sendmail will allow relaying for. 
TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
 
위 문장을 없으면 추가하고 있으면 위 문장과 같이 만든다.
그리고 Addr=127.0.0.1 이라고 나와있는 부분이 있을 텐데 이걸 전부 지워주거나 0.0.0.0으로 변경해준다.
그래야지만 다른 곳에서 아웃룩 등을 이용하여 메일 사용이 가능해진다.
저장 후 콘솔에서 m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 입력
그 다음은 sendmail.cf 확인
O AuthMechanisms=LOGIN PLAIN DIGEST-MD5 CRAM-MD5  <-주석 되어 있는지 확인 후 주석있으면 제거
그 다음은 local-host-names 수정
/etc/mail/local-host-names 파일을 메일을 받을 도메인으로 수정해준다.
xxxx.co.kr처럼
마지막으로 Sendmail.conf 수정(없으면 생성)
/usr/lib/sasl2/Sendmail.conf 파일을 수정 및 생성하여 아래 내용을 기입한다.
pwcheck_method: saslauthd
 
이상으로 설정이 끝났다.
센드메일과 sasl을 재시작(시작)한다.
/etc/init.d/sendmail start(또는 restart)
/etc/init.d/saslauthd start(또는 restart)
2018/07/30 16:24 2018/07/30 16:24
1. 1개의 도메인, 1개의 루트
 
letsencrypt certonly -a webroot --webroot-path=/var/sitea/ -d sitea.site.com
위와 같습니다. web root가 /var/sitea 이고, 도메인이 sitea.site.com 이라는 말이죠. 
 
2. 2개의 도메인, 1개의 루트
letsencrypt certonly -a webroot --webroot-path=/var/siteb/ -d siteb.com -d www.siteb.com 
위와 같습니다. web root가 /var/siteb 이고, 도메인이 siteb.com, www.siteb.com 2개일 경우입니다.
 
3. 멀티 도메인, 멀티 루트
letsencrypt certonly -a webroot --webroot-path=/var/sitea/ -d sitea.site.com --webroot-path=/var/siteb/ -d siteb.com -d www.siteb.com --webroot-path=/var/sitec/ -d sitec.site.com --webroot-path=/var/sited/ -d sited.site.com --webroot-path=/var/sitee/ -d sitee.site.com --webroot-path=/var/sitef/ -d sitef.site.com --webroot-path=/var/siteg/ -d siteg.site.com 
위와 같습니다. 1번, 2번 짬뽕이죠. 기본적으로 --webroot-path 뒤에 웹루트, 그 뒤에 -d 사이트 -d 사이트2 이런 규칙으로 보시면 됩니다.
여러 사이트를 운영해도 1개의 인증서로 관리할 수 있어 매우 편리한 방법입니다.
2018/07/29 13:07 2018/07/29 13:07
마리아DB(RDBMS)에서 NoSQL처럼 유동적인 필드만들기... 
(더블린 코어같은 옵션이 다양한 자료에 쓸만할 듯 싶네요.) 
주테이블 
seq(auto_increament), uid, title, content, list 
부테이블 
부테이블uid, key, var, 주테이블uid 
제목, 내용, 그밖에 리스트에서 많이 뿌려줘야 되는 것들은 주테이블에 넣고... 
그밖에 메타데이터나 유동적으로 추가되고 빠지고 하는 값들은 메타테이블을 만들어서 넣어두는 것도 방법일 듯 싶습니다. 
(NoSQL의 장점을 마리아DB에서 구현해보려고 만들어봤습니다.) 
주테이블 
ABCD12345, 우연근, 21살/똑똑함/거짓말못함^^; 
부테이블 
KDJF31AKW, Key:문화적특성향, Var:보수, ABCD12345 
KDJF31AKB, Key:특징, Var:수꼴싫어함, ABCD12345 
이런식으로요.
2018/07/25 21:37 2018/07/25 21:37
PHP 세션에선 다음과 같은 상황을 방지하기 위해, 웹페이지의 캐시 설정을 제어할 수 있는데요. 
1. 회원정보 수정 페이지에서 로그아웃. 
2. 뒤로가기시 로그아웃된 상태임에도 불구하고 브라우저의 캐시된 회원정보 수정 페이지가 보여지는 문제. 
이를 해결 하기 위해 세션 페이지는 캐시를 남기지 않도록, `session_cache_limiter('nocache');` 형태의 설정을 사용하죠. 
이때 브라우저의 HTTP header 에는 다음 헤더가 추가됩니다. 
``` 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
``` 
만료일 헤더 값은 현재 날짜보다 이전 날짜로만 지정하면 되는데... 왜 1981년일까요? 
그 비밀은 해당 코드를 작성한 개발자인 Sascha Schumann 의 생일이 1981년 11월 19일 이라고 하네요.  
PHP 에도 이런 재밌는 사실이 숨겨져 있네요. :) 
--- 
# 참고 
http://stackoverflow.com/questions/8194481/why-is-expires-1981 
https://github.com/php/php-src/blob/df845a9155f0dbe7041f66e00f6625fa77c6521d/ext/session/session.c#L1140 
http://php.net/manual/en/function.session-cache-limiter.php 
--- 
# 추가 팁 - Laravel 에서 웹페이지 캐시를 비활성화하는 코드 
https://gist.github.com/ibin79/fe46acfd29571d3b627322430cb2e830
2018/07/25 21:33 2018/07/25 21:33
브라우저 매칭순서
1. Firefox
2. IE 11
3. IE 10~6
4. Edge
5. inapp : Kakaotalk , Naver , Facebook
6. Chrome
7. Safari
OS 매칭 순서
1. Windows
2. Android
3. iPhone , iPad , iPod
4. Machintosh
Android
Mozilla/5.0 (Linux; Android 4.4.2; ko-kr; IM-A880S Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
Android  Chrome
Mozilla/5.0 (Linux; Android 4.4.2; ko-kr; IM-A880S Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
Android  Naver App
Mozilla/5.0 (Linux; Android 6.0.1; SM-G930S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36 NAVER(inapp; search; 510; 7.6.2)
Adroid  KakaoTalk
Mozilla/5.0 (Linux; Android 6.0.1; SM-G930S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36;KAKAOTALK 1400258
iPhone  Safari
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B100 Safari/602.1
iPhone  Chrome
Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/55.0.2883.79 Mobile/14C92 Safari/602.1
iPhone  KakaoTalk App
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Mobile/14B100 KAKAOTALK 5.8.5
iPhone  Naver App
Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C92 NAVER(inapp; search; 550; 7.6.4; 7PLUS)
iPhone  Facebook App
Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C92 [FBAN/FBIOS;FBAV/75.0.0.48.61;FBBV/45926345;FBRV/0;FBDV/iPhone9,4;FBMD/iPhone;FBSN/iOS;FBSV/10.2;FBSS/3;FBCR/SKTelecom;FBID/phone;FBLC/ko_KR;FBOP/5] 
iPad  Safari
Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1 
iPod
BalckBerry
Nokia
SonyEricsson
webOS
PalmOS
Macintosh  Safari
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12 
Macintosh  Chrome
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
PC  FireFox
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0
PC  Chrome
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36
PC  Safari
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
PC  Edge
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586
PC  Internet Explorer 11
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
PC  Internet Explorer 10
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)
PC  Internet Explorer 9
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
PC  Internet Explorer 8
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
PC  Internet Explorer 7
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
PC  Internet Explorer 6
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)

https://youngsam.net/BrowserAgentInfo.php
2018/07/25 21:20 2018/07/25 21:20
2013년 2월 1일 우편번호 자료로 
시군 - 구군 - 읍동면 형식으로 3단계로 나뉘었구요. 
시군은 코드 2자리 
구군은 코드 4자리 
읍동면은 코드 6자리 
각 지역코드 값 형식은 아래 예와 같습니다. 
서울 - 01 
강남구 - 0101 
대치동 - 010101 
특이사항 - 세종시는 1단계고 세종시의 2단계는 동입니다. 세종시는 3단계가 없음 
우편번호 자료로 만든것이다 보니 3단계에 "서울강남우체국사서함" 이런것들이 있습니다. 

2018/07/25 21:14 2018/07/25 21:14
https://css-tricks.com/examples/ShapesOfCSS/
2018/07/25 21:12 2018/07/25 21:12
$mb_name = "김카누";
mb_substr($mb_name, 0, mb_strlen($mb_name)-1, 'utf-8')."*";
2018/07/25 21:01 2018/07/25 21:01
홈페이지 오픈하면 글이 하나도 없죠 . 이럴때 이름 생각하기 힘들어요 그래서 ..

$One = array("강", "조", "전", "송", "최", "박", "김", "한", "정", "유", "이", "백", "편", "위", "피", "구", "승", "홍", "민", "성", "인", "차", "윤", "옥", "안", "양", "육", "변", "공", "원", "연", "우", "당", "주", "문", "현", "견", "신", "나", "노", "임", "온", "배", "추", "국", "오", "손", "팽", "좌", "상", "빈", "예", "방", "어", "선", "진", "화", "장", "감", "호", "도", "천", "소", "석", "태", "마", "기", "서", "봉", "음", "탁", "권", "목", "제", "왕", "엄", "부", "채", "형", "단", "맹", "함", "고", "모", "계", "두", "곽", "허", "설", "반", "류", "지", "명", "복", "황", "사", "시", "심", "창", "간", "여", "순", "경", "남", "범", "갈", "하", "길");
$Two = array("도", "규", "연", "백", "하", "태", "경", "민", "주", "윤", "예", "운", "성", "호", "동", "덕", "대", "노", "다", "보", "시", "선", "상", "솔", "범", "귀", "서", "형", "희", "재", "순", "수", "필", "채", "장", "기", "인", "이", "두", "진", "무", "유", "송", "청", "나", "은", "정", "항", "지", "해", "아", "영", "남", "창", "슬", "임", "일", "가", "자", "석", "신", "명", "단", "국", "한", "율", "부", "우", "차", "옥", "병", "소", "효", "감", "판", "사", "문", "내", "세", "의", "원", "손", "봉", "초", "리", "란", "혜", "중", "방", "건", "강", "종", "준", "철", "헌", "현", "낙", "제", "미", "달", "금", "래", "애", "춘", "로", "표", "양", "비", "본", "충", "찬", "라", "군", "배", "향", "고", "훈", "승", "추", "숙", "화", "조", "천", "어", "교", "산", "길", "근", "포");
$Three = array("윤", "광", "중", "준", "일", "희", "미", "채", "용", "석", "빈", "오", "훈", "운", "원", "우", "호", "규", "수", "진", "람", "화", "이", "온", "길", "연", "영", "란", "철", "완", "환", "범", "성", "혁", "옥", "하", "림", "경", "정", "형", "해", "현", "은", "숙", "지", "선", "만", "기", "서", "천", "탁", "배", "라", "인", "린", "엽", "로", "임", "심", "찬", "혜", "홍", "순", "섭", "겸", "율", "백", "민", "주", "솔", "열", "두", "거", "상", "리", "태", "령", "아", "효", "학", "재", "헌", "랑", "신", "모", "의", "승", "실", "률", "구", "도", "예", "래", "애", "복", "식", "나", "남", "익", "균", "융", "창", "필", "근", "님", "조", "언", "룡", "웅", "문", "권", "건", "월", "협", "택", "명", "금", "걸", "삼", "유", "한", "욱", "교");
echo $One[rand(0, count($One)-1)];
echo $Two[rand(0, count($Two)-1)];
echo $Three[rand(0, count($Three)-1)];


단.. 이상한 이름이 나올 수도 있습니다.
예로 만두만, 함주라, 황산길 등등..
 
유령 유저 만들기 위해 간단하게 만들었습니다.
2018/07/25 20:54 2018/07/25 20:54
요즘 아이프레임을 쓸 일이 별로 없지만 프로그래밍을 하다가 보면 꼭 필요한 때가 있죠.
간단한 예제 올려봅니다.
--------------------------------------
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<title>아이프레임(iframe) 높이(height:세로) 자동조절</title>
<style type="text/css">
*{margin: 0 auto;} 
body {} 
#my-iframe {display:block;border:none;height:100vh;width:100vw}
</style>
<head>
<body>
<iframe id="my-iframe" src="대상 url 기입" crolling="no" frameborder="none"></iframe>
</body>
</html>
--------------------------------------
뷰포트 (Viewport units: vw, vh, vmin, vmax) 단위 호환성은 아래 링크와 같습니다.
https://caniuse.com/#feat=viewport-units
--------------------------------------
2018/07/25 20:52 2018/07/25 20:52
 
function DaumKeyWord(){
    $Curl = curl_init();
    curl_setopt($Curl, CURLOPT_URL, "https://www.daum.net/");
    curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($Curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    $Result = curl_exec($Curl);
    $Rand[0] = explode("<span class=\"txt_issue\">", $Result);
    for($i=1; $i < count($Rand[0]); $i++){
    $Rand[1] = explode("</span>", $Rand[0][$i]);
        $ReturnData = trim(strip_tags($Rand[1][0]));
        if($ReturnData){
            $ReturnArray[] = $ReturnData;
        }
    }
    $ReturnArray = array_unique($ReturnArray);
    foreach($ReturnArray as $ReturnArray) $Return[] = $ReturnArray;
    return $Return;
}
$DaumKeyWord = DaumKeyWord();
print_r($DaumKeyWord);
 
2018/07/25 20:49 2018/07/25 20:49
 
function NaverKeyWord(){
    $Curl = curl_init();
    curl_setopt($Curl, CURLOPT_URL, "https://datalab.naver.com/keyword/realtimeList.naver?where=main");
    curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($Curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    $Result = curl_exec($Curl);
    $RandList = explode("<ul class=\"rank_list\">", $Result);
    $RandList = explode("</ul>", $RandList[1]);
    $Rand[0] = explode("<span class=\"title\">", $RandList[0]);
    for($i=1; $i < count($Rand[0]); $i++){
    $Rand[1] = explode("</span>", $Rand[0][$i]);
        $ReturnData = trim(strip_tags($Rand[1][0]));
        if($ReturnData){
            $Return[] = $ReturnData;
        }
    }
    return $Return;
}
$NaverKeyWord = NaverKeyWord();
print_r($NaverKeyWord);
 
2018/07/25 20:48 2018/07/25 20:48
# PHP 함수: 그누보드5 파일을 보다가 나오는 함수를 php.net 등에서 메모한 것입니다.
 
* abs(): Reterns absolute value of number.
 
* @: 오류메세지를 표시하지 않겠다는 의미이다.
 
* addslashes(): Quote string with a C style. Returns a string backslashes before characters that are listed in Charleston Parameter. 
각 문자앞에 \ 를 넣는다.
 
* array_merge(): Merge one or more arrays.
 
* array_map(): Applies the callback to the elements of the given arrays.
 
*array_unique(): Remove duplicate values from an array.
 
* array_count_values(): Count all the values of an array.
 
* array_key_exists( $key, $array ): Checks if the given key or index exists in the array.
 
* array_push(): 전달된 배열의 끝에 하나의 배열요소를 추가하는 기능을 한다.
즉 array_push()로 전달된 배열의 길이는 1 만큼 늘어난다.
ᆞ$topicIDs= array() ; 
ᆞarray_push($topicIDs, $row[ 'topic_id' ] ) ;
ᆞ하나 이상의 element를 array의 마지막에 삽입한다 
ᆞ문법 :
array_push( array, value1, value2 . . . ) ;
-예 :
<body>
<?php
$a= array("red", "green") ;
array_push($a, "blue", "yellow") ;
print_r($a) ;
?>
</body>@
* basename(): Returns trailing name component of path.
파일이름과 확장자만 추출한다.
* base64_decode(): Decodes a base64 encoded data.
*줄뛰울때  echo "<br>" ; 을 넣는다.
* ceil(): Round fractions up. Returns the next highest integer value by rounding up value if necessary.
* current(): Return the current element in an array.
* count(): Count all elements in an array, or something in object.
* chmod(): Change file mode.
* chr(): Return a specific character
* crypt($str, $salt): with return a hashed string using the standard Unix DES-based algorithm
* date(): Format a local time/date.
ᆞY-m-d
ᆞY: 1999 or 2000
ᆞm: 01 to 12
ᆞd: 01 to 31
* date_default_timezone_set(): 표준 시간대를 정한다.
* define(name, value) ; 런타임 동안 named constant(상수)를 정의한다.
* dirname(): Returns the directory name from a path.
* echo "\$this is not defined.\n" ; 과
echo "\$this is not defined.<br>" ; 은 동일하게 줄을 바꾼다.
* error_reporting(): Set which PHP errors are reported.
* ereg(): Regular expression match. preg_match로 대체됨..
* eval(): Evaluates and excutes a argument.
If the argument is an expression, eval() evaluates the expressiㄷon. 
If the argument is one or more js statement, eval() excutes the statement.:(자바스크립트함수임)
* explode(): Split a string by string.
ㆍexplode( $delimiter, $string )
ㆍ예
$pizza="piece1 piece2  piece3 piece4 piece6 piece6" ;
$pieces= explode (" " ,  $pizza);
* extract($row): import variables from an array into the current symbol table 
* filesize($filename): 주어진 파일의 사이즈를 가져온다. 사이즈를 byte로 제출한다.
* file_exists(): file or directory가 있는지 여부를 체크한다.
* floor(): Round fractions down. Returns the next lowest integer value(as float) by rounding down value
 if necessary.
* filemtime(): Gets file modification time. 파일의 내용이 변화된 시간을 반환한다.
*function_exists(): Return true if the function has been defined.
* filter_var(): 이메일이 형식에맞는지 체크하는 함수이다.
* getenv(): Gets the value of an environment variable.
* get_magic_quotes_gpc(): Gets current configuration setting of magic_quotes_gpc.
* glob(): Find pathnames matching a pattern.
* headers_sent(): Checks if or where headers have been sent.
* htmlspecialchars(): 특수문자를 html실체로 바꿔준다. 예를들면 < and > 를 < 그리고 > 로바꾼다.
* hexdec(): 16진수를 10진수로 바꾸어 출력한다.
ᆞhexdec( $hex_string) 
: hex_string 인수(변환할 문자열)에 표현된 16진수와 동일한 10진수를 반환한다.
* 참고
ᆞdechex(): 10진수를 16진수로
ᆞbindec(): 2진수를 10진수로
ᆞoctadec(): 8진수를 10진수로
ᆞbase_convert(): 수를 임의의 진법으로 변환한다.
* bin2hex( ) : 바이너리 data를 16진 표현으로 변환한다.
ᆞ문법
bin2hex($str) ;
: str의 16진 표현을 갖는 아스키 문자열을 반환한다.
* implode( $glue , $pieces ): Join array elements with a string.  $glue값으로 합친다.
ᆞ$glue: 디폴트값은 공백.
ᆞ$pieces: 임플로드될 array.
* is_file( $filename ): 주어진 파일이 regular file인지를 알려주며, 파일네임이 존재하고 regular file 이면 참이고 그렇지않으면 거짓이다
ᆞ$filename : 파일의 경로이다.
* isset(): 변수가 설정되었는지 검사한다. 변수가 정해져 세팅되고 null이 되지않아야 true이다.
* include_once(): 한번만 인클루드 된다.
* in_array(): Checks if a value exists in an array.
ᆞ$os=array ("mac", "window", "irix", "linux") ;
if (in_array ( 'linux' , $os )) { 
echo "Got Linux" ; }
출력: Got Linux
 
* intval(): Get the integer value of a variable
-예: 
<?php
echo intval(42);                      // 42
echo intval(4.2);                     // 4
echo intval('42');                    // 42
echo intval('+42');                   // 42
echo intval('-42');                   // -42
?>
* json_encode(): Returns the JSON representation of value.
* list(): 리스트변수에 value값을 할당 하는 방법이다. array처럼 할당한다.
ᆞ예 :
<?php
$my_array = array( "dog", "cat", "horse" ) ;
list($a, $b, $c)= $my_array ;
echo "I have several animals a $a , a $b and a $c." ;
?>
ᆞ결과:
I have several animals a dog, a cat, and a horse.
*max(): Find highest value.
* mb_substr(문자열, 시작위치, 길이, 인코딩): 문자열에서 정해진 길이만큼 가져온다.
* move_uploaded_file(): Moves an uploaded file to an new location.
* microtime(): return current Unix timestamp with microseconds.
* mb_strtolower(): make a string lowercase.
* mkdir(): Makes directory.
* md5(): Calculate the md5 hash of a string.
* mysql_errno(): Returns the numerical value of the error message from previous mysql operation.
* mkdir(): Makes directory 
ᆞ예
mkdir( "/parh/to/dir" , 0700 )
* mt_rand(): Generate a random value via the Mersenne Twister Random Number Generator.
* mb_substr: Get part of string.
* mt_rand(): Generate a random value via the Mersenne Twister Random Number Generator.
* @mysql_query(): 해당함수가 에러가 발생해도 에러메세지를 출력하지 말라는 의미이다.
* mysql_data_seek(): Moves internal result pointer.
* myaql_affected_rows(): Get number of affected rows in previous Mysql operation.
* mysqli_connect(): mysql 서버에 연결한다.
* mysql_error(): 에러메세지를 표시한다.
* mysql_query(): 쿼리 문자열을 mysql db에 전달해 테이블에 데이타를 저장하거나 검색한다.
* mysql_select_db(): mysql db를 선택한다.
* 출력할때 echo $variables ; 이렇게한다.
* mysql_real_escape_string(): 쿼리에 영향을 줄수 있는 문자를 제거 한다.
* nl2br(): Inserts HTML line breaks before all newlines in a string.
* now(): 현재 날짜와 시간을 알려주는 함수이다.
* number_format(): Format a number with grouped thousands. 천단위로 콤마넣는다.
ᆞ문법
number_format($number, $decimals= 0, $deci_point= " . ", $thousand_sep= " , " )
ᆞ예
$number = 1234.567
number_format( $number ) : 1,234
number_format( $number , 2 ) : 1,234.56
number_format( $number , 3 , ' . '  , ' , ' )  : 1,234.567
* ob_get_level(): Return the nesting level of the output buffer mechanism.
* ob_start (): Turn on output buffering.
* ob_start(): Turn on output buffering.
* ob_get_contents(): Return the contents of the output buffer.
* ob_end_clean(): Clean(erase) the output buffer and turn off output buffering.
* ob_get_contents(): Return the contents of the output buffer.
* ob_end_clean(): Clean(erase) the output buffer and turn off output buffering.
* ord(): Return ASCII value of character.
* password_hash(): creates a new password hash and is compatible with crypt(). 따라서 password hashes created by crypt() can be used with password_hash( ).
ᆞpassword_hash($password, $algo)
* pathinfo(): 파일패쓰에 관한정보를 내보낸다.
ᆞpathinfo(path, options)
* print_r(): 변수에 대하여 사람이 읽을 수 있게 정보를 출력하라
* parse_url(): Parse a URL and return it's components.
* parse_url(): Parse a URL and return it's components.
* PHP_EOD: 줄바꿈.
* preg_match($pattern, $subject, $matches): subject가 pattern에 앚는지 검사한다. 즉, 직접 작성한 하나의 정규표현식($pattern)과 하나의 문자열($subject)을 파라메터로 제공받아 문자열이 정규식과 일치하면 true, 그렇지않으면 false 를 반환한다.
ᆞ$pattern: 검색할 패턴
ᆞ$subject: the input string.
-예-: 정규식에서 $string이 소문자로 시작하면(/^[a-z]/) 파란색으로 출력하고 아니면 붉은색으로 출력하라는 의미이다.
<?php
$string = 'this is flower';
if (preg_match('/^[a-z]/', $string)) {
    echo '<font color="blue">' . $string . ' is little capital string.</font><br />' . PHP_EOL;
}
else {
    echo '<font color="red">' . $string . 'is not little capital string.</font><br />' . PHP_EOL;
}
?>
출력: this is flower is little capital string.
* preg_replace(): 문자열의 유효한 패턴을 확인하고 다른 문자열로 대체한다(perform a regular expression search and replace.)
ᆞ문법: preg_replace($pattern, $replacement, $subject ): subject를 pattern에 맞는지 검사하여 replacement로 대체한다.
ᆞpattern: 검색할 패턴으로 string이나 string을 가진 array가 될수있다.(대체해야할 원하지 않는 문자를 지정한다)
ᆞreplacement: 대체할 string이나 string을 가진 array. 이 문자열로 바뀜(원하지 않는 문자를 이 문자로 대체한다.)
ᆞsubject: 바뀌게 될 문자열(유효성검사 및 대체작업을 할 문자열을 지정한다)
- 예: 2000에서 2009를 2010으로 바꾼다.
$new_year = preg_replace( ' / 200 [ 0-9 ] / ' , ' 2010 ' , ' The year is 2009. ' ) ;
출력: The year is 2010.
* preg_split(): Split the given string by a regular expression.
* print_r(): Prints human readable information about a variable.
* rand($min , $max): 정수 난수를 생성. Generate a random integer. min, max값이 없으면 0과 getrandmax()값 즉 10자리수 값 사이의 임의의 수를 반환한다.
* reset(): Set the internal pointer of an array to its first element.
* rand(): Generate a random integer.
* round(): Rounds a float.(소수 반올림)
* $row= $stmt -> fetch(PDO : : FETCH_ASSOC): read row
* $REMOTE_ADDR(): PHP 전역변수로서 접속자의 IP정보를 저장하고있다.
* session(): 여러 페이지에 걸쳐 사용되는 변수에 정보를 저장하는 방법이다.
ᆞ세션변수는 하나의 유저에 대한 정보를 가진다.
ᆞ session_start(): <html>태그에 앞서 맨앞에 넣는다.
* session_destroy(): Destroys all data registered to a session.
* session_register():  Register one or more global variables with the current session
* setcookie(): Send a cookie.
ㆍsetcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and<head> tags as well as any whitespace.
*set_time_limit(): Limits the maximum execution time.
* session_register(): Register one or more global variables with the current session.
  
* strval(): Get string value of a variable.
* strlen(): Get string length. 주어진 string의 길이를 반환한다. 공백도 한개의 자리를 차지한다.
예:
<?php
$str = 'abcdef';
echo strlen($str); 
echo '<br>';
$str = ' ab cd ';
echo strlen($str); 
?>
출력: 
6
7
* session_register(): Register one or more global variables with the current session.
# SHA(): 사용자의 암호를 40개의 문자로 암호화해서 db에 저장한다.
php함수가 아닌 mysql함수이기 때문에 쿼리안에서 호출한다.
ᆞ예 :
INSERT INTO mismatch_user 
(username, password, join_date)
VALUES( 'nettles' , 'SHA('tatlover')' , NOW() ) ;
SELECT * FROM mismatch_user WHERE 
password= SHA('tatlover') ;
* SHA(), MD5()는 mysql에서 제공하는 암호로 SHA()가 더 안전하다.
* php에서도 같은 기능의 sha1(), md5() 암호를 제공하는데 쿼리가 아니고 php코드에서 사용한다
* sha1(): calculates the SHA-1 hash of a string.
ᆞ예:
<?php
$str= "Hello" ; 
echo sha1($str) ;
?>
ᆞ결과
f7ff9e ~ abf0: 디폴트값으로 40자리가 반환된다.
 
 
* sprintf(): Return a formatted string
-영카트예: 주소출력
            <div class="my_info_wr ov_addr">
                <strong>주소</strong>
                <span><?php echo sprintf("(%s%s)", $member['mb_zip1'], $member['mb_zip2']).' '.print_address($member['mb_addr1'], $member['mb_addr2'], $member['mb_addr3'], $member['mb_addr_jibeon']); ?></span>
            </div>
 
* str_replace(A, B, C): C안에 있는 문자중에서 A를 B로 바꾼다.
* substr_count(): Count the number of substring occurrence.
ᆞ문법
substr_count( $haystack, $needle ): 부분 문자열이 몇번사용된 .지 검사한다.
ᆞ예
$text=' this is a test and that is ' ;
echo substr_count( $test, 'is' ) ;
출력: 3
* strlen(): Get string length. returns the length of string. 공백도 문자와 같이 취급한다.
* strpos(): Find the position of the first occurrence of "php" inside the string.
* substr( string , start , length ): 전체문자열 중에서 일부만 선택 
ᆞstring: 추출하려는 문자열이 포함되어 있는 원본 문자열을 지정한다.
ᆞstart: 추출하려는 문자열의 시작 지점을 지정한다.
ᆞlength: 추출하려는 문자열의 길이를 지정한다.
ᆞ공백도 문자하나를 차지한다.
 예:
ᆞ$job_desc = 'Are you a practioner of the lost art of cat juggling?' ;
ᆞsubstr( $job_desc, 4, 3 ) ;  출력: you
ᆞsubstr( $job_desc, 49 ) ; -- 마지막파라메타를 생략함으로서 49부터 모두출력한다.
* sizeof(): This function of alias of count().
* substr(): Returns part of a string. returns the portion of string specified by the start and length parameters.
ᆞsubstr( 'abcdef' , 1 , 3 ):  bcd
ᆞsubstr( 'abcdef' , 0 , 4 ):  abed
ᆞsubstr( 'abcdef' , -1 , 1 ):  file
ᆞsubstr( 'abcdef' , 1 , 3 ):   bcd
ᆞsubstr( 'abcdef' , -4 , -1 ):  cde
ᆞsubstr( 'abcdef' , 0 , 3 ):   abc
* strstr(): Find the first occurrence of a string.
$email= '*** 개인정보보호를 위한 이메일주소 노출방지 ***' ;
$domain= strstr( $email , '@' ) ;
echo $domain ;   
echo '<br>';
$name= strstr( $email , '@' , true ) ;
echo $name ; 
출력: @gmail.com
chulyong
* set_time_limit(): limits maximum execution time.
* trim(): 앞뒤의 빈 문자열 제거한다
ᆞ$name= trim($_POST['name']) ;
ᆞ$score= trim($_POST['score']) ;
ᆞ$screenshot= trim($_FILES[' screenshot'] ['name']) ;
* unset(): destroys the specified variable.
* unlink(): Deletes a file.
* uniqid(): Generate a unique ID.
* var_dump(): type과 value값을 가지는 하나 또는 여러개의 변수를 한꺼번에 타입, 밸류를 디스플레이 한다.
2018/07/25 20:45 2018/07/25 20:45
1. 다음의 script를 예를들면 index.php에 넣어주고...해당 페이지에서는 script는 한 번만 들어가면 됩니다. 
첨부한 waypoints.min.js와 jquery.counterup.min.js는 js 폴더에 넣어주시면 됩니다. 
  
<!-- 지정된 숫자까지 카운트업하는 숫자 애니메이션 --> 
<script> 
        jQuery(document).ready(function($) { 
            $('.counter').counterUp({ 
                delay: 10, // 숫자당 돌아가는 속도를 지연시켜주는 요소이며  숫자가 높으면 높을 수록 숫자가 돌아가는 속도가 느려집니다.   
                time: 1000 // 카운트업 해주는 애니메이션의 전체 지속시간으로 1000일 경우, 1초를 의미합니다.  
            }); 
        }); 
</script> 
<script src="<?php echo G5_JS_URL; ?>/waypoints.min.js"></script> 
<script src="<?php echo G5_JS_URL; ?>/jquery.counterup.min.js"></script> 
<!-- 지정된 숫자까지 카운트업하는 숫자 애니메이션 --> 
  
2. 그리고, 이렇게 사용하시면 됩니다. 글씨 크기와 색상은 적당히 조정하시구요 
  
○ 123,456 을 표시할 때 : <span class="counter">123,456</span> 
  
○ Copyright 를 표시할 때 : © <span class="counter">2010</span> ~ <span class="counter">2018</span> 
○ free_board(자유게시판)의 게시물 합계를 나타내고자 할 때 
<?php 
$total = sql_fetch("select count(*) as cnt from g5_write_free_board where wr_is_comment = 0"); //댓글 제외 시 사용 
$total = sql_fetch("select count(*) as cnt from g5_write_free_board");  // 댓글 포함 시 사용 
echo "<span class='counter'>".number_format($total[cnt])."</span>";  
?> 
2018/07/25 20:41 2018/07/25 20:41
안녕하세요. (FA 아이콘 사용자 중)
이번에 서버를 업그레이드 하면서 SSL 보안서버를 적용하던중,
크로스도메인 미지원으로 인한 www 를 입력한 도메인으로 접속시 아이콘이 깨지는 현상을
보았습니다.
 
루트에 존재하는 .htaccess 파일을 편집합니다. 
(저는 에디트플러스를 사용합니다)
 
<IfModule mod_headers.c> 
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|css)$"> 
          Header set Access-Control-Allow-Origin "*" 
    </FilesMatch> 
</IfModule> 
 
위의 소스내에서는 ifModule 의 mod_headers.c 모듈을 사용합니다.
말그대로 mod_headers.c 모듈을 사용을 하는 아파치(Apach) 여야 위 구문을 읽고,
정상적으로 표출합니다.
 
그러므로,
 
- Autoset 사용자 기준으로 설명
 
- /server/conf/httpd.conf 파일 (#117 라인)
 
- #LoadModule headers_module modules/mod_headers.so << 같은 구문을 찾아주시고,
 
- 앞의 주석 "#" 을 제거한뒤 LoadModule headers_module modules/mod_headers.so 와 같이 만들어 줍니다.
 
위와 같이 하였다면 간단하게 아파치(웹서버) 를 중단 후 시작 해주시면 간단하게 해결됩니다.
 
 
//========== 올바른 예 =======================// 
<IfModule mod_headers.c> 
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|css)$"> 
          Header set Access-Control-Allow-Origin "*" 
    </FilesMatch> 
</IfModule> 
//========== 이것으로 사용 =======================// 
 
ps. 간혹 모르시는 분들을 위해.. .htaccess 파일이 없는경우 /root/data/.htaccess 파일이 존재합니다.
없는 분들은 저걸 이용하시면 됩니다.
2018/07/25 20:35 2018/07/25 20:35
숫자만 입력가능하고
입력한 숫자가 아래처럼 전화번호 형식으로 자동 변환되는 간단한 jquery 플러그인입니다.
000-000-0000
000-0000-0000
 
필요해서 만들어 봤어요.
 
<<사용법>>
 
<input type="text" id="phone">
<script>
$('#phone').phoneInput();
2018/07/25 20:33 2018/07/25 20:33
certbot certonly --standalone --email naver@naver.com -d youngsam.net -d www.youngsam.net
letsencrypt certonly --standalone --email naver@naver.com -d youngsam.net -d www.youngsam.net
갱신  letsencrypt renew 명령어 끝


2018/07/25 15:19 2018/07/25 15:19

미리 mysql의 데이터를 백업시켜놓지 않고 db가 터져서 접속이 불가능한 상태이기 때문에 .frm파일과 .idb파일만 남아서 이것을 이용해서 복구해야 했기에

재가 썻던 방법을 남깁니다.

 

 

.frm에는 테이블 스키마가 남겨져 있는데

 

shell>mysqlfrm --diagnostic <복구하고 싶은 frm이 담겨있는 mysql database의 경로> 

여기서 shell이란 linux terminal과 windows powershell 다 포함됩니다.

 

또한 ibd는 

frm에서 나온 테이블을 추가해준 후에

 

1. alter table <table.name> discard tablespace

2. 복구하고 싶은 idb파일을 해당 db가 있는 폴더에 넣어준다.

3. alter table <table.name> import tablespace

4. .cfg오류는 무시해도 좋습니다.

2017/12/01 12:59 2017/12/01 12:59

주제: Python 으로 만들 어플을 배포용 실행 파일로 만들자.

 

1. 프로그램 선택 시행 착오.

 

 . 기존에 TkInter 을 사용했을때는..  Py2Exe 를 이용해서 실행 파일을 만들었다.

   근데... 이게 PyQt 를 이용했을때는 어떤때는 잘 되다가 어떤때는 에러가 난다.

  그래서 실행 파일을 만드는 다른 툴을 찿기로 했다.

   Py2Exe , cx_Freeze ...  두개를 구글링 하면서 이것 저것 다 해 보았다. 안된다....

 

2. 프로그램 선택과 테스트결과

 

  . pyInstaller ... 검색중에 PyInstaller 이란 프로그램이 있단디.

   일단.. 다운 받고 설치하고 테스트..... 와우 끝내 준다.... 1개의 파일로 만들고... Win7 winXp

   다 돌아 간다.

 

3. 설치 과정.

 

   A. pywin32 설치.

    . pyinstaller 는 PyWin32 나 pypiwin32 가 설치되어 있어야 한다.

    . 만약에 설치되어 있지 않다면 pip로 pyinstaller 설치하면  pypiwin32 가 자동으로 설치된다.

     .pip 에서 pywin 이 자동설치가 안되는 경우 먼저 다음 사이트에서 pywin32 를 다운 받는다.

     http://sourceforge.net/projects/pywin32/files/pywin32/

     에서 Build 219 를 선택.

     난 os를 Win7 64bit 를 쓰지만 호환성때문에 Python3.4 32Bit 를 쓴다.

     그래서 pywin32-219.win32-py3.4.exe 를 다운로드 해서 설치 했다.(설치은 그냥 된다.)

 

 B. pyinstaller 설치

 

  . 기존에 설치했던 버전은 실행파일이 한글로 된폴더에 있으면 에러가 난다.

  . 그래서 새버전을 설치하기로 했다.

 

   방법1

  . pyinstaller 가 업그레이드 되어서 이제는

   pip install pyinstaller  또는

   pip install -U pyinstaller

   로 설치하면 이상없이 설치된다.

 

   방법2

   . 아래사이트에 접속해서

    http://www.pyinstaller.org/

    PyInstaller 3.0 (zip) 을 다운받아 압축을 푼다.

 

    . 다시  CMD 창을 열어서 pyinstaller 압축을 푼 폴더로 들어간뒤.

       python setup.py install

 

추가 : pyinstaller 3.2 로 업그레이 하려고 했더니   unicode cp949 코덱 관련 오류가 난다

        그래서 아예 개발자 버전  3.3 으로 설치했다.

       PyInstaller-3.3.dev0+483c819 future-0.16.0

       설치 방법은 아래/

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

 

 A. 시행착오

 .  pip install -U pyinstaller 요걸로는 잘 안된다.

    중간에 에러가 난다.( PyWin32 가 설치 안되어서 일수도)

 

  .  http://www.pyinstaller.org 에서 자신의 파이썬 버전과 맞는 것을 다운 받는다.

    내 경우 Python3.4 이므로 하단의 Py3.zip 파일을 다운 받아 압축을 풀었다.

 

   .CMD 창을 열어서 pyinstaller 압축을 푼 폴더로 들어간뒤.

     python setup.py install

 ... 헉.... 에러가 난다... console 창의 에러 메세지를 보니... PyWin32 가 설치 되어 있어야한단다.

 

    PyInstaller 를 설치 하기 위해서는 PyWin2가 받드시 설치 되어 있어야 한다.

    ( 아마 , Py2exe 나 cx_Freeze 가 에러난 이유도 이것 PyInw32가 설치 안되어서 인듯.)

 

 B. 설치 성공

 

    . 다시  CMD 창을 열어서 pyinstaller 압축을 푼 폴더로 들어간뒤.

       python setup.py install

     와 에러 없이 잘 설치 된다. 굿......

     다 설치하고 나서야 PyInstaller 설명서 를 찿았다.

 

        http://pythonhosted.org/PyInstaller/#installing-using-pip

 

 

4. 실행 파일 만들기.

   cmd 창을 열어서 내가 만든 소스가 있는 폴더로 이동.

   다음과 같이 입력.

 

pyinstaller --onefile --noconsole --icon=아이콘파일이름.ico 소스파일(내파일이름)

 

내경우 배치파일을 만들었다 (make_exe.bat 내용은 별거 없다 아랫줄. )

 

pyinstaller --noconsole --icon="main.ico" "SvrCheckPs.py"

 

위의 명령처럼 실행하면 소스가 있는 폴더 아래이 build 와 dist 폴더가 생성된다.

 

dist 폴더안에 파일을 배포하면 된다.

 

5. Pyinstaller 옵션.

 

 --vsrsion :현재 설치된 pyinstaller 버젼.

--onefile :한개의 파일로 만듬. 초기로딩 여러개의 파일일때보다 약간 느림.

   1개의 파일로 만들경우 win7/xp는 실행되나

   winows 8.1/10 은 압축을 풀지못한다는 에러 메세지 나오며 실행안됨.

--noconsole : 윈 gui 어플이므로  console 창을 열지 않는다.

--icon=아이콘파일이름:  실행파일의 아이콘이름.

2017/07/05 10:01 2017/07/05 10:01

Install PHP 7

Use the following set of commands to add PPA for PHP 7 in your Ubuntu system and install it.

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.0

Check PHP Version

Now use the following command to check installed php version on your system.

$ 

PHP 7.0.1-4+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

Install PHP 7 Modules

You may also need to install modules based on your application requirements. Use the following command to find our available php 7 modules.

$ php7.0-common - Common files for packages built from the PHP source
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.0-dev - Files for PHP7.0 module development
php7.0-dbg - Debug symbols for PHP7.0
php7.0-curl - CURL module for PHP
php7.0-gd - GD module for PHP
php7.0-imap - IMAP module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-tidy - tidy module for PHP
php7.0-json - JSON module for PHP
php-all-dev - package depending on all supported PHP development packages
php7.0-sybase - Sybase module for PHP
php7.0-modules-source - PHP 7.0 modules source package
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-opcache - Zend OpCache module for PHP

Now install modules which is required for you.

$ sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi
2017/05/21 12:12 2017/05/21 12:12

Install PHP 5.4

Use the following set of command to add PPA for PHP 5.4 in your Ubuntu system and install PHP 5.4.

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php5-oldstable
$ sudo apt-get update
$ sudo apt-get install -y php5

Check Installed PHP Version:

# php -v

PHP 5.4.35-1+deb.sury.org~precise+1 (cli) (built: Nov 19 2014 19:34:07)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Install PHP 5.5

Use the following set of command to add PPA for PHP 5.5 in your Ubuntu system and install PHP 5.5.

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.5

Check Installed PHP Version:

# php -v

PHP 5.5.19-1+deb.sury.org~precise+1 (cli) (built: Nov 19 2014 19:32:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

Install PHP 5.6

Use the following set of command to add PPA for PHP 5.6 in your Ubuntu system and install PHP 5.6.

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.6

Check Installed PHP Version:

# php -v

PHP 5.6.3-1+deb.sury.org~precise+1 (cli) (built: Nov 19 2014 19:34:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
2017/05/21 12:12 2017/05/21 12:12

Installing Nginx with PHP 7 and MySQL 5.7 (LEMP) on Ubuntu 16.04 LTS

Nginx(발음 “engine x”)는 무료이며 오픈소스이고 높은 성능의 HTTP 서버이다. Nginx는 매우 적은 자원을 사용하면서 안정적이고 풍부한 기능들을 가지고 있다. 또한 설정도 매우 간단하다. 본 지침서는 우분투 16.04 서버에서 PHP 7(PHP-FPM), MySQL 5.7을 지원하는 Nginx 설치를 설명하고 있다. LEMP = Linux + nginx(engine x) + MySQL + Linux

1. 준비 단계

이 지침서에 호스트 이름은 server1.example.com, 아이피 주소는 192.168.1.100을 사용한다. 이 설정은 사용자마다 다르므로 적절하게 수정 후 사용해야 한다. 이 지침서의 모든 단계는 루트 권한으로 진행하였다. 다음과 같이 루트(root)로 :

sudo -s

2. MySQL 5.7 설치

MySQL을 설치하기 위해서 다음과 같이 실행한다. [root@server1 ~]#은 터미널의 프롬프트이다. 타이핑하는 것은 아니다.

[root@server1 ~]# apt-get -y install mysql-server mysql-client

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

데이터베이스의 보안을 위해 익명사용자와 테스트 데이터베이스를 제거하기 위해 다음을 실행한다.

[root@server1 ~]# mysql_secure_installation

위의 명령을 실행 후 다음의 몇 가지 질문에 답을 하자.

Enter password for user root: <-- Enter the MySQL root password
...
Press y|Y for Yes, any other key for No: <-- Press y if you want this function or press Enter otherwise.
...
Change the password for root ? ((Press y|Y for Yes, any other key for No) : <-- Press enter
...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : <-- y
...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : <-- y
...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : <-- y
...
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : <-- y

3. Nginx 설치

Apache2가 이미 설치되어 있다면 Nginx를 설치하기 전에 Apache2를 제거한다.

[root@server1 ~]# service apache2 stop
[root@server1 ~]# update-rc.d -f apache2 remove
[root@server1 ~]# apt-get remove apache2

이제 Nginx를 설치한다.

[root@server1 ~]# apt-get -y install nginx
// 시작은 다음과 같이
[root@server1 ~]# service nginx start

제대로 설치되었는지 확인하기 위해 웹 브라우저에서 주소를 입력해 본다 (예, http://192.168.1.100). 기본 페이지가 보이면 설치 성공이다. 그리고 Nginx의 웹 문서의 기본 디렉터리는 /var/www/html 이다.

4. PHP 7 설치

PHP-FPM(FastCGI Process Manager)를 이용한다1. FastCGI 데몬 소켓은 /run/php/php7.0-fpm.sock 에서 확인할 수 있다.

[root@server1 ~]# apt-get -y install php7.0-fpm

5. Nginx 설정

vi(또는 nano)편집기를 이용하여 다음의 설정파일을 편집한다2.

[root@server1 ~]# vi /etc/nginx/nginx.conf
[root@server1 ~]# vi /etc/nginx/sites-available/default

예를들면 기본 디렉터리는 설정은 root /var/www/html;이다. 그리고 php 연동을 위해 다음과 같이:

[root@server1 ~]# vi /etc/php/7.0/fpm/php.ini
// 다음과 같이 설정한다.
cgi.fix_pathinfo=0:
[root@server1 ~]# service nginx reload
[root@server1 ~]# service php7.0-fpm reload

이제 /var/www/html/에 info.php 파일을 하나 만들고 웹에서 확인 : <?php phpinfo(); ?>

6. PHP에서 MySQL 지원 및 기타 주요기능 설치

[root@server1 ~]# apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache  php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext

[root@server1 ~]# service php7.0-fpm reload

7. 기타 설정 (옵션)

TCP Connection

[root@server1 ~]# vi /etc/php/7.0/fpm/pool.d/www.conf
...
;listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9000
...
[root@server1 ~]# php7.0-fpm reload
[root@server1 ~]# vi /etc/nginx/sites-available/default
...
fastcgi_pass 127.0.0.1:9000;
...
[root@server1 ~]# service nginx reload
  1. PHP-FPM의 자세한 내용은 https://php-fpm.org/를 참고하자. ↩︎
  2. 설정파일 예제, https://www.nginx.com/resources/wiki/start/topics/examples/full/ ↩︎
2017/05/21 12:11 2017/05/21 12:11