-
Notifications
You must be signed in to change notification settings - Fork 4
/
login.php
59 lines (56 loc) · 1.88 KB
/
login.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST"){
include ('functions.php');
$username = cleanString($_POST['username']);
$password = cleanString($_POST['password']);
include('./inc/php/db.php');
$sql = ("select * from users where user='$username'");
$result = mysql_query($sql) or die (mysql_error());
$dbid = mysql_result($result,"0","id");
$dbpass = mysql_result($result,"0","pass");
if (empty($username) || empty($password)){
$error = "You must enter a username and password";
}
elseif (isset($username) and $dbpass == $password){
$_SESSION['uid'] = $dbid;
$_SESSION['admin'] = 1;
$_SESSION['loggedIn'] = True;
header("location: index.php");
}
else{
$error = "Your Login Name or Password was invalid";
}
}
?>
<html>
<head>
<title>VPS Login</title>
</head>
<body>
<html>
<head>
<title>VPS Login</title>
<link href="./inc/css/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="loginVert">
<div id="loginHoz">
<form action="" method="post">
<table width="100%">
<?php
if(isset($error)){
echo "<tr><td class='loginError'>$error</td></tr>";
}
?>
<tr><td><label class="loginTxt" for="username">Username</label></td></tr>
<tr><td><input class="loginInput" type="text" name="username"</td></tr>
<tr><td><label class="loginTxt" for="password">Password</label></td></tr>
<tr><td><input class="loginInput" type="password" name="password"></td></tr>
<tr><td><input class="button red" type="submit" value="Login"></td></tr>
</table>
</form>
</div>
</div>
</body>
</html>