0

Hi,
I having problem to fix this problem. Already search for related thread, but cannot find a solution. The case is like this. I have 2 system that intergrate each other. Let assume as system A and B. User need to login from system A and can use system B if user have authority.

For the session, on 1st page of system B, the value can be display successfully, but having problem when jump to other page. I already declare session_start() on every page. But still not work.

Here the code:
check.php (assign session)

<?
session_start();
$_SESSION['nama']= "";
$_SESSION['id']= "";
$login=$_GET["login"];//value pass from system A
$pwd=$_GET["pwd"];//value pass from system A

$query1="SELECT * FROM login WHERE password='".$login."'";

$result = mysql_query($query1);

while ($row = mysql_fetch_assoc($result)) {
	$_SESSION['nama']= $row['nama'];
	$_SESSION['id']= $row['userid'];
	$_SESSION['cms']= $row['groupcms'];
	header("location:index.php");
	exit;
}

header("location:salah.php");
exit;

mysql_free_result($result);

?>

Having problem when call from sub page that have another sub page. The sub page i had put below code to automatically return to previous page.

print  "<meta http-equiv=\"refresh\" content=\"5;URL=foto_cawangan_cms.php\">";

When return the session value totally blank.Any idea?


Really appreciate your respond and idea. Thanks.

Edited by nav33n: Please use [code] [/code] tags (and not [quote] [/quote] tags) to wrap your code for easy readability.

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Manuz
0

Hey,
1. Get the session ID in a variable.
2. Pass it along with the url used in headers

header("Location: url?sess=".$sessId)

3. In the header page assign the previous session Id

$sessionID = @$_GET['sess'];
if($sessionID)
session_id($sessionID);

Note: This must be placed before session_start().

0

pzuurveen and Manuz. thanks for the reply. I will try both suggestion.Thanks again

0

hi,
i manage to fix this problem by changing

$_SESSION['[B]id[/B]']= $row['userid'];

to other name like this

$_SESSION['[B]ido[/B]']= $row['userid'];

.looks like id word cannot be use.thanks to both pzuurveen and Manuz.

Edited by red_ruewei: n/a

0

Hey,
You have fixed the issue rit? anyways for ur line ".looks like id word cannot be use."
This indicated that you have used the variable "$_SESSION" in some other related pages.
Mark as Solved if fixed.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.