반응형

Simply put, you need to rewrite all of your database connections and queries.

You are using mysql_* functions which are now deprecated and will be removed from PHP in the future. So you need to start using MySQLi or PDO instead, just as the error notice warned you.

A basic example of using PDO (without error handling):

<?php
$db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password');
$result = $db->exec("INSERT INTO table(firstname, lastname) VAULES('John', 'Doe')");
$insertId = $db->lastInsertId();
?>

A basic example of using MySQLi (without error handling):

$db = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
$result = $db->query("INSERT INTO table(firstname, lastname) VAULES('John', 'Doe')");

Here's a handy little PDO tutorial to get you started. There are plenty of others, and ones about the PDO alternative, MySQLi.

 

반응형
반응형

I know this is an old thread, but the selected answer isn't clear enough for me.

The point is the delete operator removes a property from an object. It cannot remove a variable. So the answer to the question depends on how the global variable or property is defined.

(1) If it is created with var, it cannot be deleted.

For example:

var g_a = 1; //create with var, g_a is a variable 
delete g_a; //return false
console.log(g_a); //g_a is still 1

(2) If it is created without var, it can be deleted.

g_b = 1; //create without var, g_b is a property 
delete g_b; //return true
console.log(g_b); //error, g_b is not defined

Technical Explanation

1. Using var

In this case the reference g_a is created in what the ECMAScript spec calls "VariableEnvironment" that is attached to the current scope - this may be the a function execution context in the case of using var inside a function (though it may be get a little more complicated when you consider let) or in the case of "global" code the VariableEnvironment is attached to the global object (often window).

References in the VariableEnvironment are not normally deletable - the process detailed in ECMAScript 10.5 explains this in detail, but suffice it to say that unless your code is executed in an eval context (which most browser-based development consoles use), then variables declared with var cannot be deleted.

2. Without Using var

When trying to assign a value to a name without using the var keyword, Javascript tries to locate the named reference in what the ECMAScript spec calls "LexicalEnvironment", and the main difference is that LexicalEvironments are nested - that is a LexicalEnvironment has a parent (what the ECMAScript spec calls "outer environment reference") and when Javscript fails to locate the reference in a LexicalEenvironment, it looks in the parent LexicalEnvironment (as detailed in 10.3.1 and 10.2.2.1). The top level LexicalEnvironment is the "global environment", and that is bound to the global object in that its references are the global object's properties. So if you try to access a name that was not declared using a var keyword in the current scope or any outer scopes, Javascript will eventually fetch a property of the window object to serve as that reference. As we've learned before, properties on objects can be deleted.

Notes

  1. It is important to remember that var declarations are "hoisted" - i.e. they are always considered to have happened in the beginning of the scope that they are in - though not the value initialization that may be done in a var statement - that is left where it is. So in the following code, a is a reference from the VariableEnvironment and not the window property and its value will be 10 at the end of the code:

    function test() { a = 5; var a = 10; }

  2. The above discussion is when "strict mode" is not enabled. Lookup rules are a bit different when using "strict mode" and lexical references that would have resolved to window properties without "strict mode" will raise "undeclared variable" errors under "strict mode". I didn't really understand where this is specified, but its how browsers behave.

 

반응형
반응형

리눅스를 사용하다 보면, tar 혹은 tar.gz로 압축을 하거나 압축을 풀어야 할 경우가 자주 생긴다.


이를 처리하기 위해 리눅스에서는 tar 라는 명령어를 사용하게 되는데,


tar 명령어도 여러가지 옵션이 있지만 각 옵션에 대해서 알아보기 보단, 자주 사용하는 명령어 패턴만 정리한다.



1. tar로 압축하기

> tar -cvf [파일명.tar] [폴더명]


ex) abc라는 폴더를 aaa.tar로 압축하고자 한다면

     > tar -cvf aaa.tar abc



2. tar 압축 풀기

> tar -xvf [파일명.tar]


ex) aaa.tar라는 tar파일 압축을 풀고자 한다면

     > tar -xvf aaa.tar



3. tar.gz로 압축하기

> tar -zcvf [파일명.tar.gz] [폴더명]


ex) abc라는 폴더를 aaa.tar.gz로 압축하고자 한다면

     > tar -zcvf aaa.tar.gz abc



4. tar.gz 압축 풀기

> tar -zxvf [파일명.tar.gz]


ex) aaa.tar.gz라는 tar.gz파일 압축을 풀고자 한다면

     > tar -zxvf aaa.tar.gz




참고로, 위의 옵션들을 포함한 그나마 자주 사용되는 tar 명령어의 옵션들은 아래와 같다.



 옵션

 설명

 -c

 파일을 tar로 묶음

 -p

 파일 권한을 저장

 -v

 묶거나 파일을 풀 때 과정을 화면으로 출력

 -f

 파일 이름을 지정

 -C

 경로를 지정

 -x

 tar 압축을 풂

 -z

 gzip으로 압축하거나 해제함

 

 

출처 : http://nota.tistory.com/53

반응형
반응형

local file을 크롬 브라우저로 보는 상황에서

A 문서에서 B 문서를 띄우고 (Parent Window - Child Window) 

B 문서에서 A 문서의 DOM으로 접속하여 데이터를 보내려는 경우 아래와 같은 에러 메세지를 개발자콘솔창에서 볼 수 있다. 


Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match. 

 


실제 웹서버로 올려서 실행하는 경우에는 발생하지 않는 문제이나 개발자 테스트 중에 발생 될 수 있는 문제이며, 

파이어폭스에서는 정상적으로 수행이 된다. 

이는 크롬의 보안 정책이 특정 버전 이후로 강화되어서 라고 한다. 


대처 방법으로는 크롬실행시 아래와 같은 옵션을 추가하면 된다. 


--disable-web-security 

 


혹은 


크롬 웹스토어에서 확장프로그램으로 아래 기능을 추가하면 된다. 


 Allow-Control-Allow-Origin: *

 


링크는 아래와 같다. 


https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi


위 방법은 Ajax 로 다른 도메인(cross domain)에 접근하면 문제가 발생한다고 하며 동일하게 해결 할 수도 있다. 


reference : http://www.chromium.org/developers/how-tos/run-chromium-with-flags

reference : http://jongkwang.com/?p=852

 

출처 : http://redcarrot.tistory.com/155

반응형
반응형
포트 TCP UDP 설명 상태
0 UDP 예약됨; 사용하지 않음 공식
1 TCP TCPMUX (TCP 포트 서비스 멀티플렉서) 공식
7 TCP UDP ECHO 프로토콜 공식
9 TCP UDP DISCARD 프로토콜 공식
13 TCP UDP DAYTIME 프로토콜 공식
17 TCP QOTD (Quote of the Day) 프로토콜 공식
19 TCP UDP CHARGEN (Character Generator) 프로토콜 - 원격 오류 수정 공식
20 TCP FTP (파일 전송 프로토콜) - 데이터 포트 공식
21 TCP FTP - 제어 포트 공식
22 TCP SSH (Secure Shell) - ssh scp, sftp같은 프로토콜 및 포트 포워딩 공식
23 TCP 텔넷 프로토콜 - 암호화되지 않은 텍스트 통신 공식
24 TCP 개인메일 시스템 공식
25 TCP SMTP (Simple Mail Transfer Protocol) - 이메일 전송에 사용 공식
37 TCP UDP TIME 프로토콜 공식
49 UDP TACACS 프로토콜 공식
53 TCP UDP DNS (Domain Name Syetem) 공식
67 UDP BOOTP (부트스트랩 프로토콜) 서버. DHCP로도 사용 공식
68 UDP BOOTP (부트스트랩 프로토콜) 서버. DHCP로도 사용 공식
69 UDP TFTP 공식
70 TCP 고퍼 프로토콜 공식
79 TCP Finger 프로토콜 공식
80 TCP UDP HTTP (HyperText Transfer Protocol) - 웹 페이지 전송 공식
88 TCP 커베로스 - 인증 에이전트 공식
109 TCP POP2 (Post Office Protocol version 2) - 전자우편 가져오기에 사용 공식
110 TCP POP3 (Post Office Protocol version 3) - 전자우편 가져오기에 사용 공식
113 TCP ident - 예전 서버 인증 시스템, 현재는 IRC 서버에서 사용자 인증에 사용 공식
119 TCP NNTP (Network News Transfer Protocol) - 뉴스 그룹 메시지 가져오기에 사용 공식
123 UDP NTP (Network Time Protocol) - 시간 동기화 공식
139 TCP 넷바이오스 공식
143 TCP IMAP4 (인터넷 메시지 접근 프로토콜 4) - 이메일 가져오기에 사용 공식
161 UDP SNMP (Simple Network Management Protocol) - Agent 포트 공식
162 UDP SNMP - Manager 포트 공식
179 TCP BGP (Border Gateway Protocol) 공식
194 TCP IRC (Internet Relay Chat) 공식
389 TCP LDAP (Lightweight Directory Access Protocol) 공식
443 TCP HTTPS - HTTP over SSL (암호화 전송) 공식
445 TCP Microsoft-DS (액티브 디렉터리, 윈도 공유, Sasser-worm, Agobot, Zobotworm) 공식
445 UDP Microsoft-DS SMB 파일 공유 공식
465 TCP SSL 위의 SMTP - Cisco 프로토콜과 충돌 비공식, 충돌
514 UDP syslog 프로토콜 - 시스템 로그 작성 공식
515 TCP LPD 프로토콜 - 라인 프린터 데몬 서비스 공식
540 TCP UUCP (Unix-to-Unix Copy Protocol) 공식
542 TCP UDP 상용 (Commerce Applications) (RFC maintained by: Randy Epstein [repstein at host.net]) 공식
587 TCP email message submission (SMTP) (RFC 2476) 공식
591 TCP 파일메이커 6.0 Web Sharing (HTTP Alternate, see port 80) 공식
636 TCP SSL 위의 LDAP (암호화된 전송) 공식
666 TCP id 소프트웨어 멀티플레이어 게임 공식
873 TCP rsync 파일 동기화 프로토콜 공식
981 TCP SofaWare Technologies Checkpoint Firewall-1 소프트웨어 내장 방화벽의 원격 HTTPS 관리 비공식
993 TCP SSL 위의 IMAP4 (암호화 전송) 공식
995 TCP SSL 위의 POP3 (암호화 전송) 공식
25565 TCP Minecraft의 기본 포트 비공식

 

반응형
반응형

500 OOPS: priv_sock_get_cmd or 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

500 OOPS: priv_sock_get_cmd

macbook:~ PJunior$ <strong>ftp username@example.com</strong>
Connected to <strong>example.com</strong>.
<strong>500 OOPS: priv_sock_get_cmd</strong>
ftp: Can't connect or login to host `example.com'

Open /etc/vsftpd.conf and at the end  add

seccomp_sandbox=NO

and restart the Server:

sudo service vsftpd restart

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

macbook:~ PJunior$ <strong>ftp username@example.com</strong>
Connected to <strong>example.com</strong>.
<strong>500 OOPS: vsftpd: refusing to run with writable root inside chroot()</strong>
ftp: Can't connect or login to host `example.com'

Open /etc/vsftpd.conf and at the end  add

 allow_writeable_chroot=YES

and restart the Server:

sudo service vsftpd restart

출처 : http://my.dude.kr/wp/?p=240

반응형
반응형

SSH 접속 후 로그인 정보까지 보낸 이후 Shell이 뜨는 속도가 느린 경우가 있습니다.

일반적으로 SSH에 접속을 시도할 때 SSH 데몬에서 DNS를 통해 접속하는 호스트를 확인하는 절차를 거치기 때문입니다.

이 과정을 생략하면 SSH 접속 속도를 향상시킬 수 있습니다.

텍스트 에디터로 /etc/ssh/sshd_config 파일을 열고, 다음 옵션을 수정해 줍니다.

 
/etc/ssh/sshd_config
UseDNS no

저장한 다음 SSH 데몬을 재시작해줍니다.

 
sudo service ssh restart

이렇게 하면 기본적으로 DNS 체크를 생략하게 됩니다.

특정 IP에서 접속하는 경우에만 DNS 검사를 생략하려면 /etc/hosts 파일에 접속하는 IP를 기술해주면 됩니다.

 

 

출처 : http://tuwlab.com/ece/9399

반응형
반응형

 

preg_match_all('/(\w+)=([^&]+)/', $_SERVER["QUERY_STRING"], $pairs);
  $_GET = array_combine($pairs[1], $pairs[2]);
반응형

+ Recent posts