Monday, 12 August 2013

How to redirect users to their own profile page?

How to redirect users to their own profile page?

All users have their own profile page:
www.mysite.com/profile.php?id=13
What I am trying to do now is redirect them to their own profile page in
case they only type:
www.mysite.com/profile.php
I've tried this but I keep on getting a redirect loop:
if ((preg_match("{(?:profile)\.php$}", $_SERVER["PHP_SELF"])) &&
(!empty($_SESSION["id"])) )
{
redirect ("profile.php?id=$id");
}
Am I missing a step?

No comments:

Post a Comment