Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sessions & Firefox

    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.

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    377
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nope, the domain stays the same throughout. thanx anyway.

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Got code?

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>";
    ?>

  • #6
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Where's the part that checks for a login and redirects if it's not there?

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #7
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>
    ";}
    }}
    ?>

  • #8
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    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.
    Code:
     $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.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •