Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <?php
  2.  
  3. include("./inc/config.php");
  4. include("./inc/functions.php");
  5.  
  6. define( _DEBUG, true );
  7. session_start();
  8. if(!isset( $_SESSION['szUser'] ) )
  9. {
  10.  
  11. if(!isset( $_POST['login'] ) || !isset( $_POST['pwd'] ) )
  12. {
  13. echo <<< HTML
  14. Please log in <br />
  15. <form action="" method="POST">
  16. Username: <input type="text" name="login" /><br />
  17. Password: <input type="password" name="pwd" /><br />
  18. <input type="submit" value="Log in!" />
  19. </form>
  20. HTML;
  21. }
  22.  
  23. else
  24. {
  25. // Check for passes
  26. MsSQLConnection();
  27.  
  28. $szQuery = "SELECT * from [PROJECT_DBF].[dbo].[ACCT_TBL] where account = 'login' AND password = 'pwd'";
  29.  
  30. $nRes = mssql_num_rows( mssql_query( $szQuery ) );
  31. if( $nRes == 1 )
  32. {
  33. $_SESSION['szUser'] = $_POST['login'];
  34. $_SESSION['szPassword'] = $_POST['pwd'];
  35. echo "You have been sucessfully logged in";
  36. }
  37. else
  38. echo "The credidentials you have provided are incorrect.";
  39. }
  40. }
  41. elseif( isset( $_POST['logOut'] ) )
  42. {
  43. session_destroy();
  44. echo "You have been successfully logged out.";
  45. }
  46. else
  47. {
  48. echo "You are already logged in.";
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement