summary refs log tree commit diff stats
path: root/admin/login.php
blob: f938664b721a4642d4abc95f92baa4ae3d2623e7 (plain) (blame)
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
27
28
29
30
<?php

if (!isset($_GET['submit']))
{

?>
<FORM ACTION="/admin/login.php?submit=" METHOD="POST">
Username: <INPUT TYPE="text" NAME="user"><BR>
Password: <INPUT TYPE="password" NAME="pass"><BR>
<INPUT TYPE="submit"></FORM>
<?php

} else {
	$getconfig = "SELECT * FROM config WHERE name = \"username\" OR name = \"password\" ORDER BY name DESC";
	$getconfig2 = mysql_query($getconfig) or die($getconfig);
	$username = mysql_fetch_array($getconfig2);
	$password = mysql_fetch_array($getconfig2);

	if (($username['value'] == $_POST['user']) && ($password['value'] == md5($_POST['pass'])))
	{
		$_SESSION['username'] = $_POST['user'];

		header('Location: /admin/');
		exit;
	} else {
?><H2>Incorrect login</H2><?php
	}
}

?>