Handleing Session Information From Url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smcgilvray
Forum Newbie
Posts: 3
Joined: Tue Oct 12, 2010 5:00 pm

Handleing Session Information From Url

Post by smcgilvray »

Hello everyone,
This is the first time that I have attempted this and was wanting to know if you could help me. I want to take the following url http://www.onlinecareeroptions.net/profile/username and set a session variable based on the user name and use the index file from the folder /profile.

Thanks for any help you can provide.

Sean
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Handleing Session Information From Url

Post by requinix »

Use URL rewriting to turn /profile/username into /profile/index.php?username=username. In your script use $_GET["username"] if it exists. If someone goes to just /profile then it will not.

When you say "session variable" I think you mean a regular variable, not a session variable.
jankidudel
Forum Commoner
Posts: 91
Joined: Sat Oct 16, 2010 4:30 pm
Location: Lithuania, Vilnius

Re: Handleing Session Information From Url

Post by jankidudel »

$_SESSION['profile'] = $_GET['username'] ????
smcgilvray
Forum Newbie
Posts: 3
Joined: Tue Oct 12, 2010 5:00 pm

Re: Handleing Session Information From Url

Post by smcgilvray »

Thank you tasairis for you replay how would the .htaccess rewrite rule look like.

Thanks again

Sean
smcgilvray
Forum Newbie
Posts: 3
Joined: Tue Oct 12, 2010 5:00 pm

Re: Handleing Session Information From Url

Post by smcgilvray »

Thanks everyone got it figured out.

Sean
Post Reply