Guest User

Untitled

a guest
Jun 26th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  1. function createNav() {
  2. echo '<p align="right">'. $fullName .'|<a href="add.php">Add Property</a>|<a href="logout.php">Logout</a></p>';
  3. }
  4. function setName($name) {
  5.     return mysql_result(mysql_query("SELECT fullName FROM JPLM.Users WHERE userName='" . $name . "'"));
  6. }
  7.  
  8. ---------------------------------------------------------------------
  9.  
  10. // Include database connection settings
  11. include('config.php');
  12.  
  13. // Retrieve username and password from database according to user's input
  14. $login = mysql_query("SELECT * FROM JPLM.Users WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')");
  15.  
  16. // Check username and password match
  17. if (mysql_num_rows($login) == 1) {
  18. // Set username and fullname session variables
  19. $_SESSION['username'] = $_POST['username'];
  20. while ($row = mysql_fetch_assoc($login)) {
  21.     $GLOBALS['fullName'] = $row['fullName'];
  22. }
  23. // Jump to secured page
  24. header('Location: securedpage.php');
  25. }
  26. else {
  27. // Jump to login page
  28. header('Location: index.php');
  29. }
  30. ----------------------------------------------------------------------
  31. setName($_POST['username']);
Add Comment
Please, Sign In to add comment