Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.sanimoderne.fr_1511970463
/
htdocs
/
old
/
functions
/
/srv/data/trash/vhost_www.sanimoderne.fr_1511970463/htdocs/old/functions/comment.php
<?php // Pas besoin de id_company car si on charge la fonction comment, le test id_company a déjà été effectué $stmt=$db_client->prepare("SELECT * FROM news_comment WHERE news=? AND state=1"); $stmt->execute(array($news->id)); $comments = $stmt->fetchAll(); $commentName = $commentEmail = $commentComment = $returnAdd = null; if(isset($_POST['add'])){ if(!isset($_POST['interested'])){//Si un robot à cocher cette case alors qu'elle est masquée $commentName = trim($_POST['name']); $commentEmail = trim($_POST['email']); $commentComment = strip_tags($_POST['comment']); $news_id = $_POST['news']; if(!empty($commentName) && !empty($commentEmail) && !empty($commentComment) ){ if(!preg_match('/www|http|https|\[link\]|\[url\]/i',$commentComment)){ //Requete pour tester si rafraichissement de la page $stmt=$db_client->prepare("SELECT * FROM news_comment WHERE name=? AND email=? AND comment=? AND news=?"); $stmt->execute(array($commentName,$commentEmail,$commentComment,$news_id)); $checkRefresh = $stmt->fetchAll(); if(empty($checkRefresh)){ $stmt=$db_client->prepare("INSERT INTO news_comment(name,email,comment,news,created_at) VALUES (?,?,?,?,NOW())"); $stmt->execute(array($commentName,$commentEmail,$commentComment,$news_id)); $commentName = $commentEmail = $commentComment = null; $returnAdd = 1; }else $returnAdd = 4; }else $returnAdd = 3; }else $returnAdd = 2; } } ?>