Forum Moderators: coopster
I'm using sessions on my website because I have variables that needs to be carried accross several scripts. The language variable $language is one of them.
When the user visits the site, he gets a $language value assigned according to his browser settings. this variable is then registered in the session.
I realized that usually PHP adds the Session ID to every link on the page in order to carry it with the URL. However this seems no to be the case here. Some links contain it, others don't. Sometimes the same link does not contain the ID when you click on it for a second time.
I have put
session_start();
ini_set("session.use_cookies","0");
ini_set("session.name","ID");
On top of my script and as far as I can tell, the website ist not sending any cookies. So where did my Session ID go? Why doesn't it show?
I'm trying to figure out why Googlebot doesn't like my page. It might be because of the session id.
So does anyone have any comments on this? Similar problems?
Thanks
Dan
I'm not session or cookie expert... but if you add this line to your .htaccess on root folder. PHP will no longer append the session ID to your URL, and you still have session support throughout your site. The session ID will stay on your server hard drive until it expired at a preset time.
php_flag session.use_trans_sid off
php_value session.gc_maxlifetime 172800
I'm not sure whether or not this will help you...
the 2nd line here states how long the session will stay alive on the server. In this case, it's 48 hrs.
Somewhere along the way the Session ID gets lost. I think it's because PHP does not parse my links since they come from the database. I realised that links that I put manually (echo "<A HREF...") contain the ID.
So how can I force PHP to process the links I have in my template? Any suggestions?
thanks
Dan
I am trying to find out why PHP sometimes adds the session ID to my links and sometimes it doesn't.
I found out that it does not add the ID to links that come from my database. So why is that? Any suggestions? (I want to add the Session ID to every interal link on my website, cookies are turned off)
Dan
I presume this is how it works with cookies as I'm positive that it's how it works for session names.
About the second thing, I don't see what you mean by "links coming from a database". The concept makes no sense to me :-)
I can only think of two possibilities for what you mean...
A) Full internal urls grabbed for display from a database. I can't think of any reason for this.
B) Every single link in your site that comes as a result of information retreived from a database.
If it's B then the only possible problem is an error in your script. There is no PHP or server setting that could cause this to happen.