我的问题是,何时在我的CMS上发布包含此类字符的文章" or '
在我的新闻中,它显示为This is John\'s first post!
我该如何解决?谢谢!
Add.php
<?php
session_start();
include_once('../includes/connection.php');
include_once('../includes/infos.php');
if (isset($_SESSION['logged_in'])) {
if (isset($_POST['title'], $_POST['content'])) {
$title = $_POST['title'];
$content = nl2br($_POST['content']);
if (empty($title) or empty($content)) {
$error = '<div class="alert alert-danger"><b>Erreur</b> : Tous les champs sont requis!</div>';
} else {
$query = $pdo->prepare('INSERT INTO articles (article_title, article_content, article_timestamp) VALUES (?, ?, ?)');
$query->bindValue(1, $title);
$query->bindValue(2, $content);
$query->bindValue(3, time());
$valide = '<div class="alert alert-success">Le news a été ajouté</div>';
$query->execute();
}
}
include_once ('inc/header.php');
?>