-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_data.php
More file actions
95 lines (82 loc) · 2.94 KB
/
Copy pathclient_data.php
File metadata and controls
95 lines (82 loc) · 2.94 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
*{
text-align:center;
font-size:medium;
font-family : 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
a{
width:200px;
background-color:#00A2E8;
border:1px solid #00A2E8;;
border-radius:5px;
color:white;
text-decoration:none;
padding:2px;
}
</style>
</head>
<body>
<?php
//Essayer de se connecter à la base de données
require_once("connect.inc.php");
//recuperation des données
$nom = $_POST['nom'];
$prenoms = $_POST['prenoms'];
$adresse = $_POST['adresse'];
$type_c = $_POST['type'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$password_c = '{'.$_POST['password'].'}';
if(isset($_FILES['image'])){
$file = $_FILES['image'];
$nom_fichier = $_FILES['image']['name'];
$chemin_temporaire = $_FILES['image']['tmp_name'];
$image_type = $_FILES['image']['type'];
// Chemin de destination où vous souhaitez enregistrer le fichier
$chemin_destination = "images/" . $nom_fichier;
// Déplacez le fichier téléchargé vers le chemin de destination
if(move_uploaded_file($chemin_temporaire, $chemin_destination)) {
echo "L'image a été téléchargée avec succès.";
$data_image = file_get_contents($chemin_destination);
$data_image_hex = bin2hex($data_image);
} else {
echo "Une erreur s'est produite lors du téléchargement de l'image.";
}
}else{
echo "Une erreur s'est produite lors du téléchargement de l'image.";
}
try{
//preparation de la requête
$req = $bd->prepare("INSERT INTO Client(num_assure,noms,prenoms,adresse,type,contact,email,password,image,image_type) VALUES (DEFAULT,:nom,:prenoms,:adresse, :type_c, :contact, :email, :password_c, decode(:image, 'hex'),:image_type);");
//Execution de la requête
$req->execute(array(
'nom'=> $nom,
'prenoms'=> $prenoms,
'adresse' => $adresse,
'type_c'=> $type_c,
'contact'=> $contact,
'email' => $email,
'password_c' => $password_c,
'image' => $data_image_hex,
'image_type' => $image_type
));
?>
<p>Vous êtes enrégistrer, vous pouvez essayer de vous connecter</p>
<a href="acceuil.php">Acceuil</a>
<?php
}catch(Exception $e){
echo "<h2>Le mot de passe et l'email sont dèja utilisé par un autre utilisateur</h2>";
echo "$e";
?>
<a href="client_data_saisie.php">Retour au formulaire</a>
<?php
}
?>
</body>
</html>