View sourcecode

The following files exists in this folder. Click to view.

deleteUser.php

18 lines UTF-8 Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require_once "check_login.php";
require_once 
"database_connection.php";

$userId = (int)($_GET["userId"] ?? 0);
if (
$userId 1) {
  
header("Location: admin.php?mess=Felaktigt id.");
  exit;
}

$sql "DELETE FROM user WHERE userId=?";
$stmt $conn->prepare($sql);
$stmt->bind_param("i"$userId);
$stmt->execute();

header("Location: admin.php?mess=Användare borttagen.");
exit;