Guest User

Untitled

a guest
Mar 6th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $USER=$_POST['txtuser'];
  4. $PWD=$_POST['txtpassword'];
  5. $con = mysql_connect("localhost","root","");
  6. if(!$con)
  7. {
  8. die('Could not connect: '.mysql_error());
  9. }
  10. mysql_select_db("cs3a", $con);
  11. $result = mysql_query("SELECT * from access WHERE Username='$USER' and Password = '$PWD'");
  12. $found = mysql_num_rows($result);
  13. if($found){
  14. $_SESSION["accessed"] = 1;
  15. echo "<center><h1>access granted.</h1></center>";
  16. }
  17. else{
  18. $_SESSION["accessed"] = 0;
  19. echo "<center><h1> Unknown User. <a href = 'login.php'> Try again? </a> </h1> </center>";
  20. die("<center><h2>access denied.</h2></center>");
  21. }
  22. mysql_close($con);
  23.  
  24. ?>
Add Comment
Please, Sign In to add comment