Hi,
I need help on Sessions in PHP.
while using sessions in my login script in localhost it works great. But the same when i upload in the webhost its not working. I cant figure out why, Please help me on this…
securedpage:
[php]<?php
session_start();
if (!empty($_SESSION[“user”])
{echo “welcome user”;
echo “Logout”;
}
else
{
echo “Welcome Guest !”;
echo " | ";
echo “Login”;
echo " | ";
echo “Register”;
}
?>[/php]
and login action page :
[php]$checklogin = mysql_query(“SELECT * FROM users WHERE Username = '”.$username."’ AND Password = ‘".$password."’");
//echo $checklogin;
if(mysql_num_rows($checklogin) == 1)
{
echo “Login Success”;
$_SESSION[“user”]= $username;
$_SESSION[“snicyloggedin”] = 1;
header(“location: posts/index.php”);
}
else
{
header("location: login1.php?err=Username or Password is Incorrect");
}[/php]