Jump to content

Session variables and header pointing to domain name (not php file)


5kyy8lu3

Recommended Posts

Hi.

 

I'll try to word this as best I can.  I'm just playing around with some layouts I've come up with especially php structure.  I decided to try to make a site that runs completely from index.php and links just goto a page that sets a session variable, then uses header to go back to index.php where php file(s) are include()'ed depending on what's in the session variable in a big switch statement.

 

why?  i just wanted to try it.  the biggest thing i wanted was for the name of the document to not be visiable (index.php, etc).

 

when i have header set to this:

 


<?php

header("Location: index.php");

?>

 

it works fine.

 

but this makes index.php show up after the domain in the address bar like this: http://www.domain.com/index.php

 

so i try this:

 


<?php

header("Location: http://domain.com");

?>

 

but when I have header direct to the domain instead of the specific index.php file, the session variable won't load.  i have the page echo the session ID and it doesn't change but the contents of the variable won't carry over for some reason.  i change header back to index.php and it works fine.

 

any ideas?

 

(keep in mind I know there isn't much risk to allowing index.php be visible, I just wanted to see if it's possible so until it's possible or not possible it's going to bug me.  must....find...out...how...)

 

thanks =)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.