First commit based on v0.1
This commit is contained in:
89
login.php
Normal file
89
login.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
session_start();
|
||||
ob_start();
|
||||
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
include("functions.php");
|
||||
|
||||
// check for submit
|
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
|
||||
if(isset($_POST['user_name']) && isset($_POST['user_pass']) && trim($_POST['user_name']) <> "" && trim($_POST['user_pass']) <> "") {
|
||||
$user_name = $_POST['user_name'];
|
||||
$result = mysql_query("SELECT user_id, user_pass, user_level FROM user WHERE user_name='$user_name'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($result) > 0) {
|
||||
if(!strcmp(md5($_POST['user_pass']), mysql_result($result, 0, "user_pass"))) {
|
||||
// all ok, user logged in
|
||||
$_SESSION['suser_id'] = mysql_result($result, 0, "user_id");
|
||||
$_SESSION['suser_level'] = mysql_result($result, 0, "user_level");
|
||||
|
||||
header("Location: index.php");
|
||||
} else {
|
||||
// not ok, break session
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
}
|
||||
// clear mysql-result
|
||||
mysql_free_result($result);
|
||||
}
|
||||
}
|
||||
echo '<b>Error!</b>';
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<header>
|
||||
<title>IP Reg</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</header>
|
||||
<body>
|
||||
<br>
|
||||
|
||||
<hr>
|
||||
|
||||
<form action="login.php" method="post">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b>IP Reg <?php echo $config_version; ?></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Username:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="user_name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Password:
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" name="user_pass">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right">
|
||||
<input type="submit" value="Submit"><input type="reset" value="Reset">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="index.php" class="label">IP Reg <?php echo $config_version; ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user