PHP : mysql_real_escape_string()

munilive
munilive

mysql_real_escape_string() PHP에서 SQL Injection 공격 등을 방어하기 위하여 특수 문자열을 이스케이프 하기 위한 함수이다.
mysql_real_escape_string() 함수를 호출하면 \x00, \n, \r, \, ', ", \x1a와 같은 문자 앞에 \(역슬레시)를 붙여서 해당 문자가 실제 작동하지 않도록 이스케이프 해준다.
이 함수는 쿼리를 MySQL로 보내기 전에 항상 테이터를 안전하게 만드는 데 사용 되어야 한다.

PHP 매뉴얼 참고: https://www.php.net/manual/en/function.mysql-real-escape-string

PHP 5.5.5버전부터 해당 함수는 deprecated 되었다.
PHP 7.0.0버전부터는 삭제되어 더는 사용할 수 없다.
대체 함수로 mysqli_real_escape_string(), PDO::quote()가 있다.

munilive

munilive

Backend Application Developer

Share

Comments

Related Posts

Image Mime Type for PHP

Image Mime Type for PHP

PHP에서 사용되는 Image Mime Type을 표로 정리 하였다. PHP에서는 Image의 Mime Type을 Index로 구분 한다.

munilive munilive ·
PHP Geo IP Location : 확장설치

PHP Geo IP Location : 확장설치

PHP에서 IP주소로 접속자의 위치를 알아내기 위해서는 Geo IP Location 모듈 설치가 필요하다. 해당 모듈에 대한 간략한 설명과 모듈이 제공하는 함수에 대한 설명이다.

munilive munilive ·
`strtotime`에선 `-1 months` 또는 `1 month ago`는 30일 이전이 아니다.

`strtotime`에선 `-1 months` 또는 `1 month ago`는 30일 이전이 아니다.

PHP 5.x버전의 strtotime 함수에서 한달전의 계산에 오류가 있는 내용에 대한 설명과 그 해결 방법에 관한 글이다.

munilive munilive ·