Last change
on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 7 days ago |
Upload new project files
|
-
Property mode
set to
100644
|
File size:
856 bytes
|
Rev | Line | |
---|
[f9c482b] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | session_start();
|
---|
| 4 |
|
---|
| 5 | if(empty($_POST['email']) || empty($_POST['password']))
|
---|
| 6 | {
|
---|
| 7 | header("Location: /Log In.php");
|
---|
| 8 | exit();
|
---|
| 9 | }
|
---|
| 10 |
|
---|
| 11 | require 'connect.php';
|
---|
| 12 |
|
---|
| 13 | $res = $conn->query('SELECT * FROM Users WHERE email="'.$_POST['email'].'";');
|
---|
| 14 |
|
---|
| 15 | if($res->num_rows <= 0)
|
---|
| 16 | {
|
---|
| 17 | header("Location: /Log In.php?error=INVALID_EMAIL");
|
---|
| 18 | exit();
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | $res = $res->fetch_assoc();
|
---|
| 22 | $pswd = $res['password'];
|
---|
| 23 |
|
---|
| 24 | if($_POST['password'] != $pswd)
|
---|
| 25 | {
|
---|
| 26 | header("Location: /Log In.php?error=INVALID_PASSWORD");
|
---|
| 27 | exit();
|
---|
| 28 |
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | $_SESSION['email'] = $_POST['email'];
|
---|
| 32 | $_SESSION['user_ID'] = $res['user_ID'];
|
---|
| 33 | $_SESSION['is_admin'] = $res['is_admin'];
|
---|
| 34 | if($res['is_admin']) {
|
---|
| 35 | header("Location: ./AdminDashboard.php");
|
---|
| 36 | }
|
---|
| 37 | else {
|
---|
| 38 | header("Location: ./Home.php");
|
---|
| 39 | }
|
---|
| 40 | ?> |
---|
Note:
See
TracBrowser
for help on using the repository browser.