Guest User

Untitled

a guest
Jul 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2. // *** Validate request to login to this site.
  3. if (!isset($_SESSION)) {
  4. session_start();
  5. }
  6.  
  7. $loginFormAction = $_SERVER['PHP_SELF'];
  8. if (isset($_GET['accesscheck'])) {
  9. $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  10. }
  11.  
  12. if (isset($_POST['userid'])) {
  13. $loginUsername=$_POST['userid'];
  14. $password=$_POST['password'];
  15. $MM_fldUserAuthorization = "";
  16. $MM_redirectLoginSuccess = "index2.php";
  17. $MM_redirectLoginFailed = "../invalidlogin.php";
  18. $MM_redirecttoReferrer = false;
  19. mysql_select_db($database_mysql, $mysql);
  20.  
  21. $LoginRS__query=sprintf("SELECT user_id, user_pw FROM `user` WHERE user_id=%s AND user_pw=%s",
  22. GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  23.  
  24. $LoginRS = mysql_query($LoginRS__query, $mysql) or die(mysql_error());
  25. $loginFoundUser = mysql_num_rows($LoginRS);
  26. if ($loginFoundUser) {
  27. $loginStrGroup = "";
  28.  
  29. //declare two session variables and assign them
  30. $_SESSION['MM_Username'] = $loginUsername;
  31. $_SESSION['MM_UserGroup'] = $loginStrGroup;
  32.  
  33. if (isset($_SESSION['PrevUrl']) && false) {
  34. $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
  35. }
  36. header("Location: " . $MM_redirectLoginSuccess );
  37. }
  38. else {
  39. header("Location: ". $MM_redirectLoginFailed );
  40. }
  41. }
  42. ?>
Add Comment
Please, Sign In to add comment