我的PHP语句有什么问题可以防止SQL注入

时间:2015-12-06 20:38:34

标签: php mysql mysqli sql-injection

但想知道我的PHP语句有什么问题,我写它是为了防止SQL注入攻击。它存储来自上一页的变量。以下是我得到的错误,我不确定为什么?

Notice: Undefined index: name in C:\xampp\htdocs\westend\selectDate.php on line 10

Notice: Undefined index: email in C:\xampp\htdocs\westend\selectDate.php on line 11

这是我的代码,我没有收到生产错误

<?php
session_start();
$host='localhost';
$user='root';
$pass='';
$db='theatre_booking';

$con= mysqli_connect($host,$user,$pass,$db);

$name= mysqli_real_escape_string($con, $_SESSION['name']);
$email = mysqli_real_escape_string($con, $_SESSION['email']);

$title = $_POST['production'];
$_SESSION["production"]=$title;



?>

0 个答案:

没有答案