bzr branch
http://gegoxaren.bato24.eu/bzr/booka/newlayout
|
1
by Gustav Hartvigsson
initial code... |
1 |
<?php
|
2 |
session_start(); |
|
3 |
||
4 |
$USER = $_POST[LogInName]; |
|
5 |
$PASSWORD = md5($_POST[LogInPassword]); |
|
6 |
||
7 |
$passwordFile = "./cfg/adminpassword.md5"; |
|
8 |
$file = fopen($passwordFile, "r") or exit("Unable to open file!"); |
|
9 |
$passwordfromfile = fgets($file); |
|
10 |
fclose($file); |
|
11 |
||
12 |
$usernameFile = "./cfg/adminusername.u"; |
|
13 |
$file = fopen($usernameFile, "r") or exit("Unable to open file!"); |
|
14 |
$userfromfile = fgets($file); |
|
15 |
fclose($file); |
|
16 |
||
17 |
if($_POST == null){ |
|
18 |
||
19 |
echo "that is not allowd!"; |
|
20 |
||
21 |
} else { |
|
22 |
||
23 |
if($userfromfile == $USER && $passwordfromfile == $PASSWORD){ |
|
24 |
||
25 |
$_SESSION[Login] = true; |
|
26 |
||
27 |
header('Location: ./'); |
|
28 |
||
29 |
} else { |
|
30 |
||
31 |
echo "password or username is not valid, try again."; |
|
32 |
||
33 |
}
|
|
34 |
||
35 |
}
|
|
36 |
||
37 |
||
38 |
?>
|