-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata-processing.php
More file actions
48 lines (38 loc) · 1.62 KB
/
Copy pathdata-processing.php
File metadata and controls
48 lines (38 loc) · 1.62 KB
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
<?php
$action = $_POST['action'];
$id = $_POST['id'];
$sexe = $_POST['sexe'];
$email = $_POST['email'];
$password = $_POST['mdp'];
$tel = $_POST['tel'];
$pays = $_POST['pays'];
$condition = $_POST['condition'];
$today = date('Y-m-d');
$dbLink = mysqli_connect('mysql-projetphp45.alwaysdata.net', '252875', 'Projetphp@2021')
or die('Erreur de connexion au serveur :' .mysqli_connect_error());
mysqli_select_db($dbLink, 'projetphp45_bd')
or die('Erreur de sélection de la base :' .mysqli_error($dbLink));
$query = 'INSERT INTO user (nbconnexion, username, sexe, email, password, tel, pays , dates, cg, permission)
VALUES( 0 ,\'' . $id . '\', \'' . $sexe . '\', \'' . $email . '\', \'' . $password . '\',\'' . $tel . '\', \'' . $pays . '\',
\'' . $today . '\', \'' . $condition . '\', 1)';
if (isset($_POST['action'])){
if ($action == 'Valider'){
mail($email,
$subject = 'Inscription',
$message = 'Voici vos identifiants d\'inscription :'. PHP_EOL,
$message .= 'Email : ' . $email . PHP_EOL,
$message .= 'Mot de passe : ' . PHP_EOL . $password);
if(!($dbResult = mysqli_query($dbLink, $query))){
echo 'Erreur : ' . mysqli_error($dbLink) . '<br/>';
echo 'Requête : ' . $query . '<br/>';
exit();
}
else{
header("Location: index.html");
}
}
else{
echo '<br/><strong>Bouton non géré !</strong><br/>';
}
}
?>