I am using this command to post parameters to my server :
response = CustomHttpClient.executeHttpPost("http://192.168.1.102/liu/login.php", postParameters);
When I get a successful log in from the server, my Android application is set to request the members.php page in webview, but when this happens I am redirected to the log in page to log in again, this means that the session has been dropped somewhere, so how do I maintain the session between the two requests ?
Here is the code on server side login.php:
if($numrow!=0)
{
while($row = mysql_fetch_assoc($query))
{
$db_username = $row['username'];
$db_password = $row['password'];
}
if($username==$db_username&&$password==$db_password)
{
$_SESSION['username']=$db_username;
header("Location: members.php");
members area</a>";
}
and members.php:
if($_SESSION['username'])
{
echo "1";
echo "the logged in session is :". $_SESSION['username'];
echo " You are logged in as: ".$_SESSION['username'];
echo "<p><a href='logout.php'>Click here to logout</a>";
}
Now this code works when I log in from my pc browser but when I send the info from the Android application and get successful reply then request the members.php page it takes me back to the log in.