diff --git a/html/compte.php b/html/compte.php index 90da78f3..f564790c 100644 --- a/html/compte.php +++ b/html/compte.php @@ -2,6 +2,19 @@ require "../include/variables.php"; require "../include/functions.php"; +if(isset($_POST['delete_account'])) { + $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); + + $req = $bdd->prepare("DELETE FROM users WHERE ID = :id"); + $req->bindParam(':id', $_SESSION['userid']); + if($req->execute()) { + header("Location: logout.php"); + exit(); + } else { + die("Erreur SQL"); + } +} + ?> @@ -43,6 +56,7 @@ require "../include/functions.php"; foreach($_SESSION as $name => $value) { echo "
" . $name . " : " . $value . "
";} ?> +
diff --git a/html/login.php b/html/login.php index 17773688..cb937e1a 100644 --- a/html/login.php +++ b/html/login.php @@ -71,7 +71,7 @@ if(isset($_POST['username']) && isset($_POST['password'])) {
-
+
Créer un compte
diff --git a/html/register.php b/html/register.php new file mode 100644 index 00000000..0f740ac5 --- /dev/null +++ b/html/register.php @@ -0,0 +1,90 @@ +prepare("INSERT INTO users (username, password, email, display_name, role) VALUES (:username, :password, :email, :display_name, 0)"); + $req->bindParam(':username', htmlspecialchars($_POST['username'])); + $req->bindParam(':password', md5($_POST['password'])); + if ($req->execute()) { + header("Location: login.php"); + exit(); + } else { + $status = "Erreur SQL"; + } + } else { + $status = "Les mots de passe ne correspondent pas."; + } + } +} + +?> + + + + + + + + <?=$title?> + + +
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/html/upload.php b/html/upload.php index c8d5be71..dcda8a98 100644 --- a/html/upload.php +++ b/html/upload.php @@ -79,7 +79,7 @@ if(isset($_POST['page-content'])) {
- $nom) { echo ''; }?>