Advertisement
Guest User

Untitled

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