Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts

    Integration session question

    Hi, i have integrated a php script into my current script, it is working fine with one exception. The new script has its own login for admin and when i log off it logs me off the whole site.

    I have been told to use ob_start() but i am concerned about running a buffer not only because im on a shared server but also for security reason.

    My question is can i set the session id for the new script as a seperate id and when i log off the new script can i just do a sesson destroy on that particular id so that i do not kill my main site session.

    The only login is for admin on the new script, there are no users so it does not effect them, i guess i could live with the inconvienence but i would like to fix it if i could.

    Any ideas on way to approach this? Even a link to some documentation that talks about this is fine. thanks

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I can't see how output buffering would actually help you in this situation.
    I believe that the session_name() can be used to override the default name of PHPSESSID. When this occurs, it should not terminate a previously named cookie, so if you restate a different session_name, methinks you can use that to construct and destroy an alternate session, and when returned to a previous script using the default session name that it will retrieve the information per normal. The only downside is that in the meantime the standard session is idling so it will not be updated. That means that the gc may run through it and terminate it before the user returns.
    Unfortunately, its been years since I've used PHP's built in sessions, so I cannot be sure that will work.

  • Users who have thanked Fou-Lu for this post:

    durangod (05-27-2011)

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts
    Thanks Fou-lu really appreciate that, its just one of those things that drives you nuts. I first integrated this into my first social software with no issues, so i installed the same social software over on another drive and pulled the integration files over to it and i have issues, and its the same dang software, one has issues and one does not and it drives me crazy.

    On thing i do wish is that there was a way to find out what exactly is trying to be output before the header. I know when you get a header error that it has already been sent it means some text even a space is trying to be sent before the header, but i wish there was a way to display on the screen exactly what the text is so i could find it.

    my work around is as a temp fix is using

    Code:
                   if (!headers_sent()) {
                             send the output
                                 }
    but its kind of a hack and i just wish i could see with my eyes what it is that is trying to be sent, (i know it gives you error lines but im really starting to think its coming from someplace else not there) then i could find it and fix it, because i am finding nothing not even a space that is being sent before header.

    thanks so much.
    Last edited by durangod; 05-27-2011 at 10:41 PM.

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by durangod View Post
    I know when you get a header error that it has already been sent it means some text even a space is trying to be sent before the header, but i wish there was a way to display on the screen exactly what the text is so i could find it.
    Nope. You are trying to send a header after page output to the client has started. That is why someone will have suggested you use output buffering. Assign all output to a var then dump it to the client at script end, if you want to avoid using the ob_ functions.

  • #5
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts
    thanks matt you are quite right i typed that bass ackwards lol sorry about that, my brain was correct but my fingers didnt listen lmao.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I see, that's probably what people were talking about. The header you would be sending is to request the client accept a cookie than. Sessions will send it by default. This of course can be resolved by having the session stated before any output.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •