SHARE
TWEET

Untitled

a guest Jun 7th, 2017 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. include ("config.inc.php");
  2.  
  3. mysql_select_db($database_nfconx, $nfconx);
  4.  
  5. // *** Validate request to login to this site.
  6. session_start();
  7.  
  8. $loginFormAction = $_SERVER['PHP_SELF'];
  9. if ((isset($_POST['accesscheck'])) && ($_POST['accesscheck'] <> "")) {
  10.   $_SESSION['PrevUrl'] = $_POST['accesscheck'];
  11. }
  12.  
  13. if (isset($_POST['username'])) {
  14.   $loginUsername=strtoupper($_POST['username']);
  15.   $password=$_POST['pwd'];
  16.   $NF_fldUserAuthorization = "";
  17.   $NF_redirectLoginSuccess = "index.php";
  18.   $NF_redirectLoginFailed = "login.php?case=relogin";
  19.   $NF_redirecttoReferrer = false;
  20.   mysql_select_db($database_nfconx, $nfconx);
  21.   $passpwd = $_POST['pwd'];
  22.   $password = md5($passpwd);
  23.   $LoginRS__query=sprintf("SELECT userid, password FROM users WHERE userid='%s' AND password='$password' AND status = 1",
  24.     get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
  25.    
  26.   $LoginRS = mysql_query($LoginRS__query, $nfconx) or die(mysql_error());
  27.   $loginFoundUser = mysql_num_rows($LoginRS);
  28.   if ($loginFoundUser) {
  29.   $login_datetime = current_datetime();
  30.   $session_id = session_id();
  31.   // Add to User Login History
  32.   $insertSQL = "INSERT INTO user_login_history (userid, login_datetime, session_id, ip_address, browser, os, screen_resolution, screen_size) VALUES ('$loginUsername', '$login_datetime',  '$session_id', '$_POST[ip_address]', '$_POST[browser]', '$_POST[os]', '$_POST[screen_resolution]', '$_POST[screen_size]')";
  33. //echo $insertSQL;
  34.  
  35. mysql_select_db($database_nfconx, $nfconx);
  36. $Result1 = mysql_query($insertSQL, $nfconx);
  37.  
  38.      $loginStrGroup = "";
  39.    
  40.     //declare two session variables and assign them
  41.     $GLOBALS['NF_Username'] = $loginUsername;
  42.  
  43. //register the session variables
  44.     $_SESSION['NF_Username'] = $loginUsername;
  45.  
  46.     if ((isset($_SESSION['PrevUrl']) && ($_SESSION['PrevUrl'] <> ""))) {
  47.       $NF_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  48.     }
  49.     header("Location: " . $NF_redirectLoginSuccess );
  50.   }
  51.   else {
  52.     header("Location: ". $NF_redirectLoginFailed );
  53.   }
  54. } else {
  55.  header("Location: ". $NF_redirectLoginFailed );   
  56. }
  57. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top