...

View Full Version : Integration session question



durangod
05-27-2011, 05:43 PM
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

Fou-Lu
05-27-2011, 06:36 PM
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.

durangod
05-27-2011, 10:35 PM
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



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.

MattF
05-28-2011, 12:11 AM
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.

durangod
05-28-2011, 01:46 AM
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.

Fou-Lu
05-28-2011, 03:29 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum