$_SESSION and .htaccess

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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

$_SESSION and .htaccess

Post by Gen-ik »

Hi guys.


Does anyone know if it's possible to access $_SESSION variables in a .htacess file?


Si ++
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

I think it's not :!:
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

I didn't think so either because .htaccess files are run before any PHP files, I just wanted to make sure though... just in case :)
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

more so, because .htaccess is Apache's thing and $_SESSION is PHP's one. both are widely different thngs. :!:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what information are you trying to access in the session data?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

feyd wrote:what information are you trying to access in the session data?
It would be custom stuff really... $_SESSION["foobar"] and so on... although as far as I know it's not going to be possible.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yeah, it would seem not exactly, or directly possible. come to think of it, there may be a chance to do some fiddling (depending on what you want to do with the information) using the rewrite engine. I remember being able to call an external script for rewrite controls.. :?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

feyd wrote:yeah, it would seem not exactly, or directly possible. come to think of it, there may be a chance to do some fiddling (depending on what you want to do with the information) using the rewrite engine. I remember being able to call an external script for rewrite controls.. :?
Hmm, that's actually quite interesting. I also remember the Apache docs mentioning something about loading external files into a .htaccess file... so, the question is can that file be generated by PHP (even if it involves PHP spitting out a plain/txt header or something).

I might do a bit of experimenting with it tonight :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I know I could call a php script through the rewrite engine.. although I never tried using the superglobals during that experiment..
Post Reply