[php]f(isset($_POST[‘submit’])){
$stmt = $connection->prepare("INSERT INTO advert (title, email, phone, place, options, name, lastname, message, kod , image, rodzaj, cena, ip) VALUES (?, ?, ?,?, ?, ?,?, ?, ?,?, ?, ?,?)");
$stmt->bind_param(“sssssssssbsss”, $title, $email, $phone, $place, $options, $name, $lastname, $message, $randomString, $file, $rodzaj, $cena, $ip);
$title=filter_var($_POST[‘title’], FILTER_SANITIZE_STRING);
$email=filter_var($_POST[‘email’], FILTER_SANITIZE_STRING);
$phone=filter_var($_POST[‘phone’], FILTER_SANITIZE_STRING);
$place=filter_var($_POST[‘place’], FILTER_SANITIZE_STRING);
$options=filter_var($_POST[‘options’], FILTER_SANITIZE_STRING);
$name=filter_var($_POST[‘name’], FILTER_SANITIZE_STRING);
$lastname=filter_var($_POST[‘lastname’], FILTER_SANITIZE_STRING);
$message=filter_var($_POST[‘message’], FILTER_SANITIZE_STRING);
$rodzaj=filter_var($_POST[‘optradio’], FILTER_SANITIZE_STRING);
$cena=filter_var($_POST[‘cena’], FILTER_SANITIZE_STRING);
$length = 10;
$randomString = substr(str_shuffle(“0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”), 0, $length);
$ip=$_SERVER[“REMOTE_ADDR”];
$file = addslashes(file_get_contents($_FILES[“image”][“tmp_name”]));
$stmt->execute();
$stmt->close();
$connection->close();
}
} ?>[/php]