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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
<?php
try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=sciencedlivror', 'root', '', $pdo_options);
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
//récupération des valeurs des champs:
$id = $_POST["id"] ;
$ip = $_POST["ip"] ;
$modere = $_POST["modere"] ;
$pseudo = $_POST["pseudo"] ;
$mail = $_POST["mail"] ;
$date_message = $_POST["date_message"] ;
$message = $_POST["message"] ;
// Si modere est à 1 cad si on accepte le message on le met à 1 pour le copier
// dans le bon fichier et l'afficher
if ($_POST['modere'] ==1)
{
$req = $bdd->prepare("UPDATE t_livreortemp SET ip = '$ip', modere = '$modere', pseudo = '$pseudo', mail = '$mail',
date_message = '$date_message', message = '$message' WHERE id = '$id' ") ;
$req->execute(array($ip,$_POST['modere'],$_POST['pseudo'],$_POST['mail'],$_POST['date_message'],$_POST['message']));
if($req)
{
'<br/>';
//Redirection sur la page guestmoderation.php
try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
//$bdd = new PDO('mysql:host=mysql51-50.perso;dbname=sciencedlivror', 'sciencedlivror', '4YwgBw7J', $pdo_options);
$bdd = new PDO('mysql:host=localhost;dbname=sciencedlivror', 'root', '', $pdo_options);
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
//Si on modifie
if ($_POST['modere'] =="1")
{
$req = $bdd->prepare('INSERT INTO t_livreor (ip, modere, pseudo, mail, date_message, message) VALUES(?, ?, ?, ?, ?, ?) ');
$req->execute(array($_POST['ip'],$_POST['modere'],$_POST['pseudo'],$_POST['mail'],$_POST['date_message'],$_POST['message']));
//header("Location: /guestbook.php");
echo("La modification à été correctement effectuée") ;
}
else
{
echo("La modification à échoué") ;
}
}
}
?>
<meta http-equiv="refresh" content="5; URL=guestbook.php"> |