IP Reg is a IPAM tool to keep track of assets, nodes (IP addresses, MAC addresses, DNS aliases) within different subnets, over different locations or even VLAN's. Written in PHP, used with a MySQL-database to have a unique insight in your local network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
ipreg/login.php

91 lines
2.2 KiB

<?php
session_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, user_displayname, user_mac, user_lang 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");
$_SESSION['suser_displayname'] = mysql_result($result, 0, "user_displayname");
$_SESSION['suser_mac'] = mysql_result($result, 0, "user_mac");
$_SESSION['suser_lang'] = mysql_result($result, 0, "user_lang");
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="tpl/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>