I am using login concept in android in that login one username login on one time only the same username can't login on second time. It is working fine. now i want to use session time out conept in server side but it is not working the value is storing into session but it is not able to getting on another php file.
my login php code
session_start();
$_SESSION['user'] =1;
second php code
session_start();
if(isset($_SESSION['user']))
{
//my action
}
My android code
DefaultHttpClient httpClient = new DefaultHttpClient();
httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux " +
"i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)");
httpPost.setHeader("Accept", "text/html,application/xml," +
"application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
httpPost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
is this your code you use for the first and second request ?
if so, the problem is that you always create a new client, which results in new session on serverside, because the sessionid wich is stored in a cookie is not available.
so create your httpClient once, and use the same instance for both requests. should solve the problem
like this: