-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteprofile.php
37 lines (27 loc) · 928 Bytes
/
deleteprofile.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
<?php
session_start();
if (!isset($_SESSION["pseudo"])) {
header("Location: connexion.php");
exit();
}
require("DB/connexion.php");
$co = connexionBdd();
$query = $co->prepare("DELETE FROM likes WHERE question_id=:question_id");
$query->bindParam(":question_id", $_GET["question_id"]);
$query->execute();
$query = $co->prepare("DELETE FROM repondre WHERE questions_id=:question_id");
$query->bindParam(":question_id", $_GET["question_id"]);
$query->execute();
$query = $co->prepare("DELETE FROM questions WHERE id=:question_id");
$query->bindParam(":question_id", $_GET["question_id"]);
$query->execute();
$userid = $_SESSION["pseudo"];
$userid2 = $_SESSION["pseudo_id"];
$query = $co->prepare("DELETE FROM utilisateurs WHERE id=$userid2");
$query->bindParam(":id", $_SESSION["pseudo_id"]);
$query->execute();
if ($query) {
header("Location: accueil.php");
} else {
echo "Error";
}