View difference between Paste ID: bBzxDgTs and 78pfzSs9
SHOW: | | - or go back to the newest paste.
1
<?php
2
session_start();
3
include('../incl/db_connect.php');
4
$user = $_POST['bruger'];
5
$pass = $_POST['password'];
6
7
8
$sql = "SELECT username, password, user_id, status FROM users WHERE username = '$user' AND password = '$pass'";
9
10
$res = $connect->query($sql);
11
$row = $res->fetch_assoc();
12
13
14
if($row['username'] <> "" && $row['password'] <> "" && $row['status'] == 1){
15
	$_SESSION['bruger'] = $row['user_id'];
16
	header('location:../profil.php');
17
}elseif ($row['username'] <> "" && $row['password'] <> "" && $row['status'] == 2){
18
	$_SESSION['bruger'] = $row['user_id'];
19
	$_SESSION['admin'] = 1;
20
	header('location:../admin.php');
21
}else {
22
	header('location:../login.php');
23
}
24
25
26
27
28
29
30
31
32
33
?>