Forum Moderators: coopster
I'm having a problem with passing sessions from one page to another. Basically, I'm trying to keep track of the last page the visitor was on in case he needs to log in.
Anyway, on my profile page, I have:
// PROFILE.PHP
session_start();
$userid = (int) $_GET['uid'];
$_SESSION['lastpage'] = "http://www.mydomain.com/user/$userid";
// LOGIN.PHP
session_start();
$lastpage = $_SESSION['lastpage'];
Now, I'm using mod_rewrite to rewrite to the profile page like this:
RewriteRule ^user\/(.*) profile.php?uid=$1
Let's assume I want to goto User ID #5's page.
If I use mydomain.com/profile.php?uid=5, and then goto the login page, the session passes properly.
However, if I use mydomain.com/user/5 , and then goto the login page, the lastpage variable shows up as follows:
[mydomain.com...]
I imagine this is some kind of mod_rewrite error, but have no idea how to fix it. Suggestions?