Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- Arrays
- UTF-8
- 웹하드순위
- function
- JavaScript
- variables
- HTML
- Apache
- file-upload
- Forms
- 무료다운로드쿠폰
- OOP
- php
- 웹하드추천
- Linux
- 경영
- Regex
- JSON
- curl
- Laravel
- post
- Session
- string
- Ajax
- jquery
- date
- composer-php
- MySQL
- 전략
Archives
- Today
- Total
개발! 딱 깔끔하고 센스있게!
PDO PHP 의 mysqluescapeu 문자열 본문
안녕하세요, 새로운 PDO 입니다.
그래서 당혹과 오류;) my sqlu realu escapeu 문자열....
누가 도와 줄 수 있습니까, 이것은 내 비밀번호입니다
if(!empty($_POST) && isset($_POST)) { include ('connection_pdo.php'); $dbh = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass); $source_url= mysql_real_escape_string($_POST['source_url']); $class = mysql_real_escape_string($_POST['class']); $year = mysql_real_escape_string($_POST['year']); $date = time(); $ip = $_SERVER['REMOTE_ADDR']; $insert = $dbh->prepare(" INSERT IGNORE INTO school_students_images ( folder_name, image_url, source_url, class, year , date , ip ) VALUES (:folder_name, :image_url, :source_url, :class, :year, :date, :ip) "); $a=0; while ($a<1000){ $a++; $insert->execute(array( 'folder_name'=> $name->content, //** geting from other source 'image_url' => $link[$a], //** geting from other source 'source_url' => $source_url, 'class' => $class , 'year' => $year , 'date' => $date, 'ip' => $ip )); }
잘못은 작용하지 않지만, 만약 내가 그것을 사용한다면
$source_url= ($_POST['source_url']); $class = ($_POST['class']); $year = ($_POST['year']); $date = time(); $ip = $_SERVER['REMOTE_ADDR'];
일하고 있습니다.
그래서 나는 데이터베이스에서 mysql-real-escape-string 을 사용하지 않는 것이 매우 곤혹스럽다.
(PDO 는 기본적으로 어떤 안전성을 제공할 것인가?)내가 이 방면에서 잘못한 것은...도와 주세요.
대답
네, PDO 가 자동으로 데이터를 바꾸기 때문에 mysql-real-escape-string 을 사용할 필요가 없습니다.
예, 여기 보세요.
'개발 스크랩 메모 > PHP' 카테고리의 다른 글
php: 성명 함수의 인자 형식 (0) | 2020.12.24 |
---|---|
PHP MySQL$u gethhack prevention[사본] (0) | 2020.12.24 |
Highchart Php 과 MySQL 사용하기 (0) | 2020.12.24 |
어떻게 PHP 에서 집성 테스트를 합니까? (0) | 2020.12.24 |
XAMPP for linux 에서 PHP 업그레이드? (0) | 2020.12.24 |
Comments