Guest User

Untitled

a guest
Dec 6th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4.  
  5. $links = "<a href='logout.php'>click here to logout</a><br>";
  6. $u = mysql_escape_string($_POST['user']);
  7. $p = md5($_POST['pass']);
  8.  
  9.  
  10.     $link = mysql_connect('localhost','root','') or die("Server not found");
  11.     mysql_select_db('aclcsjdm');
  12.  
  13.     $result = mysql_query("SELECT * FROM users WHERE username='" .$u. "'AND password='" .$p. "'");
  14.  
  15.     if(!mysql_num_rows($result)){
  16.         print "ACCESS DENIED<br>";
  17.         print "<a href='login.php'>Click here to log in</a>";
  18.         exit;
  19.     }else{
  20.         $data = mysql_fetch_array($result);
  21.         $_SESSION["logged_in_user"] = $u;
  22.         $_SESSION["access"] = $data['role'];
  23.         print "Welcome $u <br>";
  24.         header('Location:main.php');
  25.     }
  26. ?>
Add Comment
Please, Sign In to add comment