View sourcecode

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

bannlys.php

26 lines UTF-8 Unix (LF)
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
<?php
session_start
();
require_once(
'check_login.php');
require_once(
'database_connection.php');

$userId trim($_GET['userId']);

#Om knappen på admin sidan trycks sätter sig locked i tabellen till 0 (inte banlyst) eller 1 (banlyst)

$sql "SELECT * FROM user WHERE userId = :userId;";
$stm $pdo->prepare($sql);
$stm->execute(array('userId' => $userId));
$res $stm->fetch(PDO::FETCH_ASSOC);

if(
$res['locked'] == 1){
    
$sql "UPDATE user SET locked = 0 WHERE userId = :userId";
} else{
    
$sql "UPDATE user SET locked = 1 WHERE userId = :userId";
}


$stm $pdo->prepare($sql);
$stm->execute(array('userId' => $userId));

header("location:admin.php?mess=Kontot låst!");
?>