Advertisement
Guest User

Untitled

a guest
Apr 9th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
  2. $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
  3. /*
  4. $ID = $_POST['username'];
  5. $Password = $_POST['password'];
  6. */
  7. function SignIn()
  8. {
  9. session_start(); //starting the session for user profile page
  10. if(!empty($_POST['username'])) //checking the 'user' name which is from Sign-In.html, is it empty or have some text
  11. {
  12. $query = mysql_query("SELECT * FROM UserName where userName = '$_POST[username]' AND pass = '$_POST[password]'"); #or die(mysql_error());
  13. $row = mysql_fetch_array($query) or die(mysql_error());
  14. if(!empty($row['userName']) AND !empty($row['pass']))
  15. {
  16. $_SESSION['userName'] = $row['pass'];
  17. echo "Successful Login";
  18. header('Location: control.html');
  19. die();
  20. }
  21. else
  22. {
  23. $_SESSION['userName'] != $row['pass'];
  24. echo "Incorrect Password";
  25. header('Location: index2.html');
  26. die();
  27. }
  28. }
  29. }
  30. if(isset($_POST['login']))
  31. {
  32. SignIn();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement