File "no_resubmit.php"

Full Path: /home/analogde/www/Bookmarks/CHESS_ON/no_resubmit.php
File size: 2.07 KB
MIME-type: text/x-php
Charset: utf-8

<?php

session_start();
 
if(!empty($_POST) )
{
    $_SESSION['sauvegarde_formulaire'] = $_POST ;
     
    $page_actuelle = $_SERVER['PHP_SELF'] ;
    if(!empty($_SERVER['QUERY_STRING']))
    {
        $page_actuelle .= '?' . $_SERVER['QUERY_STRING'] ;
    }
     
    header('Location: ' . $page_actuelle);
    exit;
}
// } Fin - Première partie
 
// { Début - Seconde partie
if(isset($_SESSION['sauvegarde']))
{
    $_POST = $_SESSION['sauvegarde_formulaire'] ;
   
   $champ_pseudo = "";
	$champ_message = "";
	
	
	if(!empty($_POST["pseudo"]))
	{	$champ_pseudo = $_POST["pseudo"];
	}
	if(!empty($_POST["message"]))
	{	$champ_message = $_POST["message"];
	}
        
    
				$headers = "";
				$headers = "MIME-Version: 1.0" . "\n";
				$headers .= "Content-type:text/html;charset=utf-8" . "\n";
				$headers .='Content-Transfer-Encoding: 8bit' . "\n";
				$headers .='From: admin@analog-design.net' . "\n";
				$headers .='Reply-To: admin@analog-design.net';
				
				//$headers .= 'Content-Type: multipart/mixed;boundary=' .$boundary . "\n";

				$to = "patrice.delpy@neuf.fr";	
				$champ_sujet = "petit message";
				$contenu = "blblblblblblb";
				
				mail($to, $champ_sujet, $contenu, $headers);
				echo '<script language="Javascript">
				alert ("Email envoyé" )
				</script>';
				
				unset($_SESSION['sauvegarde_formulaire']);
				
				$page_actuelle .= '?' . $_SERVER['QUERY_STRING'] ;
				header('Location: ' . $page_actuelle);
				exit;

	
    
}
// } Fin - Seconde partie 
 
 
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Formulaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
 
<body>
 
<?php

 
?>
 
<form action="no_resubmit.php" method="post">
<p>
Pseudo : <input type="text" name="pseudo" value = "<?php echo $champ_pseudo ?>" /><br />
Message : <input type="text" name="message" value = "<?php echo $champ_message; ?>" /><br />
<input type="submit" value="Envoyer" />
</p>
</form>
 
 
</body>
</html>