Session lost after 302 redirection
Posted: Tue Oct 07, 2008 1:03 am
Hi,
I have a very strange issue.
I add a rule into my htaccess, which is the following one:
Into the script "session_script.php" I have this code :
At this point if I check the value of the session variable I get the right data.
result :
Now if I uncomment the redirection. let day the page alias is test, and the template name used is test also.
http://www.mywebsite.com/test
into the template I call just one tag and that's it. the tag name is "session_test"
into this tag I have the following code:
and the result is:
I don't understand. I am loosing the data after the redirection. Maybe the CMS destroy the session ?
Have you got the same problem ? Where it comes from ?
thanks guys.
I have a very strange issue.
I add a rule into my htaccess, which is the following one:
Code: Select all
# Session rule
RewriteRule ^([0-9]+)/(.*) session_script.php?source_traffic=$1&page_name=$2 [L]
Code: Select all
<?php
if(!isset($_SESSION))session_start();
include(dirname(__FILE__).'/config.php');
if ( isset($_GET['source_yad']) && isset($_GET['page_yad']) ){
if (isset($_SESSION['s_landing_page'])) unset('s_landing_page']);
if (isset($_SESSION['i_source_id'])) unset('i_source_id']);
$_SESSION['i_source_id'] = $_GET['source_traffic'];
$_SESSION['s_landing_page'] = $_GET['page_name'];
header("Location:http://".$_SERVER['HTTP_HOST']."/".$_GET['page_name']);
}
else{
header("Location:http://".$_SERVER['HTTP_HOST']);
}
?>
Code: Select all
<?php
[...]
$_SESSION['i_source_id'] = $_GET['source_traffic'];
$_SESSION['s_landing_page'] = $_GET['page_name'];
var_dump($_SESSION['i_source_id']);
//header("Location:http://".$_SERVER['HTTP_HOST']."/".$_GET['page_name']);
[...]
?>
Code: Select all
int(2)
http://www.mywebsite.com/test
into the template I call just one tag and that's it. the tag name is "session_test"
into this tag I have the following code:
Code: Select all
sesssion_start();
var_dump($_SESSION['i_source_id']);
Code: Select all
NULL
Have you got the same problem ? Where it comes from ?
thanks guys.