Jump to content

Recommended Posts

I cleared all cookies in Firefox and now my log in page doesn't work. It works in IE, but not in firefox. I don't know if this is a php (my) problem or if it is something to do with the browser. Any ideas?

 

posting my code in case it helps

<?php require_once('Connections/conn_org.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=$_POST['Password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "userlogin/Index_.php";
  $MM_redirectLoginFailed = "userlogin/login.php";
  $MM_redirecttoReferrer = true;


  mysql_select_db($database_conn_org, $conn_org);
  $LoginRS__query=sprintf("SELECT UserName, Password FROM users WHERE UserName='%s' AND Password='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
   
  $LoginRS = mysql_query($LoginRS__query, $conn_org) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

//set some more cookies
	mysql_select_db($database_conn_org, $conn_org);
	$query_rsLoginDetails = ("SELECT users.UserName, users.Password, users.EmpID, tblemployees.GroupID, tblgroups.DivisionID, Managers.EmpID AS MgrID, concat(tblEmployees.EmpFName,' ',tblEmployees.EmpLName ) AS Name FROM tblemployees Inner Join tblgroups ON tblemployees.GroupID = tblgroups.GroupID Inner Join users ON tblemployees.EmpID = users.EmpID Inner Join tblemployees AS Managers ON tblemployees.TeamID = Managers.EmpID WHERE users.UserName= '$loginUsername' AND users.Password= '$password'");
	$rsLoginDetails = mysql_query($query_rsLoginDetails, $conn_org) or die(mysql_error());
	$row_rsLoginDetails = mysql_fetch_assoc($rsLoginDetails);
	$totalRows_rsLoginDetails = mysql_num_rows($rsLoginDetails);

	  setcookie("empid", "".$row_rsLoginDetails['EmpID']  ."", time()+(60*60*24*10), "/", "", 0);


	  setcookie("divisionid", "".$row_rsLoginDetails['DivisionID']  ."", time()+(60*60*24*10), "/", "", 0);


	  setcookie("mgrid", "".$row_rsLoginDetails['MgrID']  ."", time()+(60*60*24*10), "/", "", 0);
//end custom code, go back to dw standard login
    if (isset($_SESSION['PrevUrl']) && true) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="login" name="login" method="POST" action="<?php echo $loginFormAction; ?>">
  <table width="100%" border="0" cellspacing="0" cellpadding="6">
    <tr>
      <td width="25"> </td>
      <td colspan="2" class="smallText"> </td>
    </tr>
    <tr>
      <td width="25"> </td>
      <td >USER NAME</td>
      <td ><input name="UserName" type="text" id="UserName" size="40"></td>
    </tr>
    <tr>
      <td width="25"> </td>
      <td >PASSWORD</td>
      <td ><input name="Password" type="password" id="Password" size="40"></td>
    </tr>
    <tr>
      <td width="25"> </td>
      <td > </td>
      <td ><input name="Login" type="submit" id="Login" value="Login"></td>
    </tr>
</table>
</form>
</body>
</html>

 

Thanks in advance

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.