Page 1 of 1

Session problems with FireFox, not IE

Posted: Thu Mar 16, 2006 11:40 pm
by Citizen
On the login page, I have this code at the top of the page:

Code: Select all

<?php session_start(); ?>
Followed by this code for the login:

Code: Select all

$sql="SELECT * FROM `accounts` WHERE name = '$username' AND passworddb = '$password'";
$result=mysql_query($sql) or die(mysql_error());
$number = mysql_num_rows($result);
if ($number == "1") {
session_register("password");
session_register("username");
The user logs in fine.

But.... once I load up my next page, the user isnt logged in anymore. The next page has this code at the top:

Code: Select all

<?php session_start(); ?>
Followed by this code:

Code: Select all

<?php
$sql="SELECT * FROM `accounts` WHERE name = '$username' AND passworddb = '$password'";
$result=mysql_query($sql);
$number = mysql_num_rows($result);
if ($number == "1") {
Do I need to do something different with the session varibles? It works in IE but I have to login again in FireFox.

Posted: Fri Mar 17, 2006 8:24 am
by jmut

Code: Select all

session_register("password");
session_register("username");
try using

Code: Select all

$_SESSION['password'] = 'pass';
$_SESSION['username'] = 'username';


//on next page
$pass = $_SESSION['password'];