Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createNav() {
- echo '<p align="right">'. $fullName .'|<a href="add.php">Add Property</a>|<a href="logout.php">Logout</a></p>';
- }
- function setName($name) {
- return mysql_result(mysql_query("SELECT fullName FROM JPLM.Users WHERE userName='" . $name . "'"));
- }
- ---------------------------------------------------------------------
- // Include database connection settings
- include('config.php');
- // Retrieve username and password from database according to user's input
- $login = mysql_query("SELECT * FROM JPLM.Users WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')");
- // Check username and password match
- if (mysql_num_rows($login) == 1) {
- // Set username and fullname session variables
- $_SESSION['username'] = $_POST['username'];
- while ($row = mysql_fetch_assoc($login)) {
- $GLOBALS['fullName'] = $row['fullName'];
- }
- // Jump to secured page
- header('Location: securedpage.php');
- }
- else {
- // Jump to login page
- header('Location: index.php');
- }
- ----------------------------------------------------------------------
- setName($_POST['username']);
Add Comment
Please, Sign In to add comment