I'm facing a problem where my session id is keep on changing, which results in I couldn't properly save my login status and user id for a session. (The link for my page is http://epl.fanxt.com/sestest/2.php)
page 2 and 3 are simply for display purpose, while page 1 is to create user id session, page 4 is to unset the session.
the session works fine if you try this on web browser, but, my problem is, when i access this page using LWUIT application, my session id is keep on changing, so my user id will not be kept for more than 1 page (eg: i create the userid session at page 1, and when i go to page 2 or 3, my user id became blank.)
And i also tried to use cookie to store my user id, the result is same, works fine in web browser, but cannot create a single cookie within the application.
does anyone know the solution to this?
in case if you guyz want to see the code:
Page 1:
Page 2:<?php
if (session_id() == ""){
session_start();
$bbb=1;
}
else {
$bbb=0;
}
$_SESSION['user_id'] = '123';
$hhh = $_SESSION['user_id'];
$qqq = session_id();
echo "<html><head><title></title></head><body>";
echo "<br>ses start = $bbb ";
echo "<br>session id = $qqq ";
echo "<br>session user_id = $hhh ";
echo "<br><a href='4.php'>click to 4</a>";
echo "<br><a href='2.php'>click to 2</a>";
echo "<br><a href='1.php'>click to 1</a>";
echo "<br><a href='3.php'>click to 3</a>";
echo "</body></html>";
?>
Page 3:<?php
if (session_id() == ""){
session_start();
$bbb=1;
}
else {
$bbb=0;
}
$hhh = $_SESSION['user_id'];
$qqq = session_id();
echo "<html><head><title></title></head><body>";
echo "<br>ses start = $bbb ";
echo "<br>session id = $qqq ";
echo "<br>session user_id = $hhh ";
echo "<br><a href='4.php'>click to 4</a>";
echo "<br><a href='2.php'>click to 2</a>";
echo "<br><a href='1.php'>click to 1</a>";
echo "<br><a href='3.php'>click to 3</a>";
echo "</body></html>";
?>
Page 4:<?php
if (session_id() == ""){
session_start();
$bbb=1;
}
else {
$bbb=0;
}
$hhh = $_SESSION['user_id'];
$qqq = session_id();
echo "<html><head><title></title></head><body>";
echo "<br>ses start = $bbb ";
echo "<br>session id = $qqq ";
echo "<br>session user_id = $hhh ";
echo "<br><a href='4.php'>click to 4</a>";
echo "<br><a href='2.php'>click to 2</a>";
echo "<br><a href='1.php'>click to 1</a>";
echo "<br><a href='3.php'>click to 3</a>";
echo "</body></html>";
?>
<?php
if (session_id() == ""){
session_start();
$bbb=1;
}
else {
$bbb=0;
}
unset($_SESSION['user_id']);
$hhh = $_SESSION['user_id'];
$qqq = session_id();
echo "<html><head><title></title></head><body>";
echo "<br>ses start = $bbb ";
echo "<br>session id = $qqq ";
echo "<br>session user_id = $hhh ";
echo "<br><a href='4.php'>click to 4</a>";
echo "<br><a href='2.php'>click to 2</a>";
echo "<br><a href='1.php'>click to 1</a>";
echo "<br><a href='3.php'>click to 3</a>";
echo "</body></html>";
?>