-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
63 lines (57 loc) · 3.05 KB
/
index.php
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
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
require '../db_config.php';
$sql = "SELECT * FROM `preinscriptions` WHERE `eventInfo`!='Test'"; // this sql gets all rows from the db preinscriptions if the eventInfo column is different than 'Test' (the normal value is 'Gala')
$result = mysqli_query($conn, $sql);
$placesLeft = 280 - mysqli_num_rows($result);
if (isset($_POST['action'])){
// 'action' will become a very broad SESSION var : it defines the global action you want to achieve using the site
if ($_POST['action'] == 'book'){
$_SESSION['action'] = 'book';
header('Location: ./informations'); // if the user wants to book (clicked the button 'book' below), send him to ./informations
} elseif ($_POST['action'] == 'lost'){
$_SESSION['action'] = 'lost';
header('Location: ./verif-email'); // if the user wants to recover a lost ticket (clicked the button 'lost' below), send him to ./verif-email
} elseif ($_POST['action'] == 'cancel'){
$_SESSION['action'] = 'cancel'; // THIS SECTION HASN'T BEEN DONE, PLEASE BUILD CANCELLATION
header('Location: ./cancel'); // if the user wants to cancel (clicked the button 'cancel' below), send him to ./cancel
}
}
?>
<!DOCTYPE html>
<html lang="en">
<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>LRDE -- Inscription</title>
<link rel="stylesheet" href="./common.css">
<link rel="stylesheet" href="./home.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
</head>
<body>
<?php
$prefix = "./"; // this allows the below nav to access css and images easily
include('./modules/nav/nav.php'); // includes the nav
?>
<main>
<div id="welcome">
<h2>Bonjour !</h2>
<p>Cette plateforme vous permet de vous préinscrire pour le Gala du 2 juin 2023</p>
<p>Dépêchez-vous ! Il ne reste que <span id="placesLeft"><?= $placesLeft ?></span> places !</p>
<!-- shows how many places are left -->
</div>
<form action="./" method="post">
<?php if ($placesLeft > 0) : // only shows the book option if the number of places is greater than 0 ?>
<button name="action" class="gala-btn" value="book">Je réserve !</button>
<?php endif ?>
<button name="action" class="gala-btn" value="lost">J'ai perdu mon ticket</button>
<!-- <button name="action" class="gala-btn" value="cancel">Je souhaite annuler...</button> -->
<!-- Cancel button is commented because it hasn't been done -->
</form>
<p style="text-align: center;"><a href="https://ronde-de-l-espoir.fr/contact" target="_blank">Vous rencontrez un problème ?<br>Cliquez ici pour nous contacter</a></a></p>
</main>
</body>
</html>