...

View Full Version : sessions & Firefox



davehaz
06-16-2005, 08:23 PM
I have a peculiar problem with firefox, I have a login page that makes the login name a session variable, you then go to a menu page and select your function I do have session_start() on the menu page, after you select what you want to do, the session variable is used to pull some data out of a db. This works fine in IE, however in firefox, you have to login twice to get the data out of the db. any ideas, would it help to post the code?
tia.

schleppel
06-16-2005, 08:50 PM
Just a stab in the dark here but does the subdomain change (eg. www. gets added/left off)? If so the firefox may only read the cookie holding the session data for the www/not www subdomain until the second login.

And code would probably be very helpful, and a link if there is one. :)

davehaz
06-16-2005, 09:01 PM
nope, the domain stays the same throughout. thanx anyway.

nikkiH
06-16-2005, 09:13 PM
Got code?

davehaz
06-16-2005, 09:32 PM
got code---

<? session_start(); ?> first line of page


<?php
require_once('connectdavehazhomes.php');
$_SESSION['trec'] = $trecnum;
$sql="SELECT * FROM listings WHERE license = '$trecnum'";
$result = mysql_query($sql);
$rows = mysql_num_rows();
echo "<table>";
while ($line = mysql_fetch_array($result)){
$mls = $line['mls'];
$stnum = $line['stnum'];
$stname = $line['stname'];
$city = $line['city'];
echo "<tr>"."<td>"."<a href='feedback.php?Item=$mls&Submit=Search'>".$stnum." ".$stname.", ".$city." ".$mls."</a>"."</td>"."</tr>";
echo "<tr><td><hr></td></tr>";
}
echo "</table>";
?>

nikkiH
06-16-2005, 09:45 PM
Where's the part that checks for a login and redirects if it's not there?

davehaz
06-16-2005, 10:10 PM
login script -

<? session_start();
require_once('connectdavehazhomes.php');
?>

this is the login part I am using the bottom is a different login but on the same page.

<?php
$_SESSION['trec'] = $trecnum;

$submit = $_POST['submit'];
$license = $_POST['license'];
$passwrd = $_POST['pwd'];
if(isset($submit)){
$passwrd = md5($passwrd);
if(empty($license)){die("License # is a required Field");}
if(empty($passwrd)){die("Password is a required Field");}
$sql = "SELECT * from agents WHERE trec=$license";
$result=mysql_query($sql);
$num = mysql_num_rows($result);
if ($num != 0){
while($line = mysql_fetch_assoc($result)){
$tpwd = $line['pword'];
$name = $line['name'];
$trecnum = $line['trec'];
}
if ($trecnum == $license && $tpwd ==$passwrd) {echo"<SCRIPT LANGUAGE=\"JavaScript\">
window.location=\"http://www.myfreeshowings.com/selectfunction.html\";
</script>
";} else {echo"<SCRIPT LANGUAGE=\"JavaScript\">
window.location=\"http://www.myfreeshowings.com/newuser.html\";
</script>
";}
}}
?>

homesellers login - goes to a different place - working correctly.
<?php
$sellersubmit = $_POST['sellersubmit'];
$sellersmls = $_POST['sellermls'];
$sellerpwd = $_POST['sellerpwd'];
if(isset($sellersubmit)){
//$sellerpasswrd = md5($sellerpasswrd);
if(empty($sellermls)){die("MLS # is a required Field");}
if(empty($sellerpwd)){die("Password is a required Field");}
$sql = "SELECT * from sellers WHERE mls = '$sellermls'";
$result=mysql_query($sql);
$num = mysql_num_rows($result);
if ($num != 0){
while($line = mysql_fetch_assoc($result)){
//$tpwd = $line['pword'];
$pwd = $line['sellerpwd'];
$mls = $line['mls'];
//$name = $line['name'];
$trecnum = $line['trec'];
$_SESSION['trecnum'] = $trecnum;
}
$_SESSION['mls'] = $mls;
if ($_POST['sellermls'] == $mls && $_POST['sellerpwd'] ==$pwd) {echo"<SCRIPT LANGUAGE=\"JavaScript\">
window.location=\"http://www.myfreeshowings.com/getsellerfeedback.html\";
</script>
";} else {echo"<SCRIPT LANGUAGE=\"JavaScript\">
window.location=\"http://www.myfreeshowings.com/noentry.html\";
</script>
";}
}}
?>

nikkiH
06-17-2005, 03:07 AM
Two things.
One, what exactly happens in Firefox? Does it redirect to the wrong page or does it reload the same page...?
Two, I notice the following line is commented out in the one that works and is NOT commented out in the one that is broken. Dunno if that's the problem or not, though.

$passwrd = md5($passwrd);

Oh, and your code would be a LOT easier to read if you used a code block. That's the little button up there ^^^ that is a #. Or put the word "code" in brackets (bbCode syntax) and then your code and then end brackets.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum