Hi,
I am trying to register a variable in session but when i try to retrieve the session value on next page. It gives me empty string. The code worked once but now it is not working. Can any one tell me where i am worng.
<?php
error_reporting(0);
session_start();
$server = "localhost";
$dbuser = "root";
$dbpass = "abcd";
$dbname = "abcd";
$pass = $_REQUEST['txtPwd'];
$login = $_REQUEST['txtEmail'];
if($login != "" and $pass != "")
{
$pass = md5($pass);
mysql_connect($server,$dbuser,$dbpass) or die ("Could not establish connection");
mysql_select_db($dbname);
$query_rsLogin = "SELECT email, pwd, fname, lname FROM customer WHERE pwd='".$pass."' AND email='".$login."'";
$rsLogin = mysql_query($query_rsLogin) or die(mysql_error());
if(mysql_num_rows($rsLogin))
{
while($r=mysql_fetch_array($rsLogin))
$username = $r[fname]." ".$r[lname];
session_register("username");
header('Location: search.php');
}
}
Regards,
Ghazala
Problem in Session
Moderator: General Moderators
It doesn't matter... I have Zone Alarm too, and this would block sessions from moving from one page to another on my local server. If I want sessions to move from one page to another on my local server, I have to turn the cookie control off and also to turn the ad blocking off.ghfazil wrote:Yes I have firewall that is zonealarm but i didn't put any restriction on apache.
P.S On a real server I can set both to the highest level and the sessions would pass. Kinda odd
Glad to hear that now it works for you