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
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Concours</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<?php include("header.php"); ?>
</header>
<?php
if(!isset($_POST['pseudo'])) {
echo '<div id = "inscription">
<form action = "#" method = "post" enctype="multipart/form-data">
<p style="text-align:center" >Tu est sur le point de tinscrire au concours maillots de bain !</br>
<strong style="color:red" >ATTENTION : Tous donnés saisaie sur se formulaire ne pourrat être remodifié après la validation.</strong></p>
<p><label for = "pseudo">Pseudo : </label><input type = "text" name = "pseudo" id = "pseudo" required/></p>
<p><label for = "email">Adresse email :</label><input type = "text" name = "email" id = "email" required/></p></texterea>
<p><label for= "adresse">Saisissez votre adresse postal (qui permettera la réception des gains):</label><br />
<textarea name="adresse" id="ameliorer"></textarea required></p>
<p>Choisi la photo pour ce concours :</p>
<p><label for= "photo">
Choissisez votre photo :<br /></label>
<input type="file" name="photo" id="pseudo" /><br />
<input type="submit" value="Envoyer mon inscription" />
</p>
<p style="text-align: center; color:red" >Attention ! Une foit validez vous ne pourrez pu revenir en arrière !</p>
</form>
</div>';
}
else {
$enreg = fopen("concours_maillots.txt","a+");
fwrite($enreg, $_POST['pseudo']."|".$_POST['email']."|".$_POST['adresse']."|".$_POST['photo']."\n");
fclose($enreg);
echo '<p>Bravo ' . $_POST['pseudo'] . ' ! tu fais partie du concours !</p></a>';
}
?>
<?php
// Testons si le fichier a bien été envoyé et s'il n'y a pas d'erreur
if (isset($_FILES['monfichier']) AND $_FILES['monfichier']['error'] == 0)
{
// Testons si le fichier n'est pas trop gros
if ($_FILES['monfichier']['size'] <= 1000000)
{
// Testons si l'extension est autorisée
$infosfichier = pathinfo($_FILES['monfichier']['name']);
$extension_upload = $infosfichier['extension'];
$extensions_autorisees = array('jpg', 'jpeg','png');
if (in_array($extension_upload, $extensions_autorisees))
{
// On peut valider le fichier et le stocker définitivement
move_uploaded_file($_FILES['monfichier']['tmp_name'], 'uploads_maillots/' . uniqid().'.'.$extension_upload);
echo "L'envoi a bien été effectué !";
}
}
}
?>
</body>
</html> |
Partager