Forum Moderators: coopster

Message Too Old, No Replies

Disabling Sessions?

         

Aleister

11:21 pm on Nov 29, 2004 (gmt 0)

10+ Year Member



I have a couple of php scripts on my web sites. Everything works fine, but when I use a program such as Xenu's link sleuth (which just goes through your site and tells you all the page links etc..) I see strange things like this:

sitename.com/news.htm?id=324247237732
sitename.com/nextpage.htm?id=324247237732
sitename.com/anotherpage.htm?id=324247237732

news.htm uses php.. so it is generating the session id.. but it is getting transfered to the other pages.

The only page that needs the id is news.htm itself.. is there a way to keep this from getting passed on?

I tried a method which requires adding this to htaccess:

php_flag session.use_trans_sid off

and this to the script (before session_start):

ini_set('session.use_trans_sid', false);

And it seems to work.. the link checker program does not transfer the id to other pages, but it does show several instances of news.htm with diff. ids.

Is there a better method? Or is this method ok?

Thanks.. btw, I have my server set to execute php code in files with the htm extension.

coopster

11:43 pm on Nov 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I can think of a couple things...

  1. Move the
    news.htm
    php session-related files to their own directory and set the php_flag value in a per-directory override (
    .htaccess
    ) file:
    php_flag session.use_trans_sid off
  2. Modify the sleuth script; find out where it is locating the link, if the link is not
    news.htm
    , use ini_set() [php.net] to change the directive
    if ($linked_file <> 'news.htm') { 
    ini_set(session.use_trans_sid, 0)
    }

Aleister

12:33 am on Dec 1, 2004 (gmt 0)

10+ Year Member



The code is in the news.htm file itself..

As far as the second option, wouldn't modifying the sleuth program (which is windows - not web - based) just make the problem go away in that particular program? It would still be there confusing search engine robots and such :)

Or am I mistaken that it will even hurt anything?

coopster

12:59 am on Dec 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




The code is in the news.htm file itself..

I must be tired, that first suggestion I made doesn't even make sense to me right now. Skip that option.


As far as the second option, wouldn't modifying the sleuth program (which is windows - not web - based) just make the problem go away in that particular program? It would still be there confusing search engine robots and such

Or am I mistaken that it will even hurt anything?

Another mistake. Two-for-two in the same response.

I didn't realize that the sleuth program wasn't a script. I just assumed it was a PHP script. Neither did I realize that you were concerned with SE bots. From the original post it seemed as though you were merely trying to build a site map or something.

Well, you could always modify the news.htm script and build the SID into the links [php.net] yourself as opposed to letting PHP handle it for you. Also, you may be able to use the "non-relative links" note to your advantage.

Outside of that, I'm stumped. Anyone else have any ideas?

Aleister

2:26 am on Dec 1, 2004 (gmt 0)

10+ Year Member



No problem! Thanks for trying to help anyway!

Any other takers? :)

ergophobe

6:53 pm on Dec 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wold you consider doing some client sniffing and if the client is identified as Xenu, you would simply not start the session?

How does Xenu ID itself?

Tom

Aleister

12:55 am on Dec 2, 2004 (gmt 0)

10+ Year Member



How would that fix my problem?

That would only keep me from seeing it, which is not a good method of fixing :)

ergophobe

9:29 am on Dec 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Since you're checking links, I was assuming that you don't want a unique session. On rereading your post, I see that you require a session for news.php so you don't want to turnt he session off for Xenu.

It appears that Xenu does not accept cookies. So when you refuse to let the ID be passed via a GET parameter, the script has no way of tracking the session. Therefore, you will always get a new session every time you start it unless you can get Xenu to accept and then use the session cookie.

Just curious, but why do you need sessions for the link checker?