SHARE
TWEET

Untitled

a guest May 22nd, 2017 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3. include("login.php");
  4.  
  5. $host="localhost";
  6. $username ="root";
  7. $password="";
  8. $db_name="users";
  9. $tbl_name="users_info";
  10.  
  11. $mysql_connect($host, $username,$password)or die(mysql_error());
  12. $mysql_select_db()or die(mysql_error());
  13.  
  14. $myusername = mysql_real_escape_strings($_GET['username']);
  15. $mylastname = mysql_real_escape_strings($_GET['password']);
  16.  
  17. $sql="Select * FROM $tbl_name WHERE username='$username' and password='$password'";
  18. $result=mysql_query($sql);
  19.  
  20. if(mysql_num_rows($result) = 1)
  21. {
  22.     $_SESSION['logged_in'] = true;
  23. }
  24. else
  25. {
  26.     $_SESSION_['logged_in'] = false;
  27. }
  28. ?>
  29. <html>
  30. <head>
  31. <body>
  32. <?php if($_SESSION['logged_in'] === true){
  33. echo "
  34. <input type="text" name="username" />
  35. <br />
  36. <input type="password" name="password" />
  37. <input type="submit" value="submit" />
  38. </form>
  39. ";
  40. }
  41. else
  42. {
  43. echo "You are already logged in";
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top