www/public/contact/index.php

80 lines
2.9 KiB
PHP

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
$root = realpath($_SERVER['DOCUMENT_ROOT']);
try {
$f = fopen("how_do_u_say.txt", "r");
$content = fread($f, filesize("how_do_u_say.txt"));
$verbs = preg_split("/\n/", $content);
do {
$say = $verbs[array_rand($verbs, 1)];
} while ($say == "");
} catch (Exception $e) {
echo $e->getMessage();
$say = "caqueter";
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact | Les Cocottes Minutes</title>
<link rel="stylesheet" href="/styles/style.css">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
</head>
<body>
<div class="container">
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>
</div>
<section>
<div class="container flip reduced"></div>
<div class="container contact">
<h2>Babillons ensemble !</h2>
<?php
if (isset($_SESSION['msg']) && $_SESSION['msg'] != "")
{
?>
<div class="msg">
<?=$_SESSION['msg']?>
</div>
<?php
$_SESSION['msg'] = "";
}
?>
<form action="send.php" method="POST">
<label for="name">Nom*</label>
<input type="text" name="name" id="name" placeholder="Mister Cot" required>
<label for="email">Email*</label>
<input type="email" name="email" id="email" placeholder="cot.cot.cot@cocottes-minutes.fr" required>
<label for="website">Site Web</label>
<input type="url" name="website" id="website" placeholder="https://cocottes-minutes.fr">
<label for="subject">Sujet*</label>
<input type="text" name="subject" id="subject" placeholder="Cot cot ?" required>
<label for="message">Votre babillage*</label>
<textarea name="message" id="message" cols="30" rows="10" placeholder="Cot cot cot..." required></textarea>
<input type="submit" name="submit" value="<?=$say?>">
</form>
<p>* obligatoire</p>
<?php
if (isset($_SESSION['error_msg']) && $_SESSION['error_msg'] != "")
{
?>
<div class="error">
<?=$_SESSION['error_msg']?>
</div>
<?php
$_SESSION['error_msg'] = "";
}
?>
</div>
<div class="container flip reduced"></div>
</section>
<?php include("$root/footer.php");?>
<script src="/scripts/script.js"></script>
</body>
</html>