CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 How to stop Session ID being passed in links

Print topic Send  topic

Author Message
catalyse
Posted: 01/30/2002, 1:06 AM

I am trying to get CC to generate some static HTML pages from a database (I have my reasons...). This works fine (using file("page.php") to get the HTML) but any relative links within those pages have "?PHPSESSID=9f18..." appended. I specifically do NOT want these to be absolute links (complete with http://) as this makes it non-portable. The only way I can fix it is by editing the generated PHP and removing the session_start(), making it very prone to accidental overwriting the next time I generate it. Is there some cleaner way of doing this within CC? I can't see it in any of the Event "Get Generated Code" that would allow me to override it. Or can you suggest a better approach?

Thanks.
Nicole
Posted: 01/30/2002, 1:57 AM

Hello,
it's not CC issue, it's related to PHP settings. The PHP session vars can be passed through URL (as in your case) or through cookies. To pass session through cookies find in php.ini file the line
session.use_cookies = 0

and replace "0" with "1".
catalyse
Posted: 01/30/2002, 2:00 AM

Well I've just found a cludged way round it. Basically I leave the links as CC+PHP inserts them and then search each line of the HTML and strip out any session id strings. Not very elegant, but it works.

$html_line=ereg_replace(".PHPSESSID=.{32}","",$html_line);

For those who are not aware (I had to dig about a bit), in the regular expression, the ".{32}" means "any single character repeated 32 times". This is used as the actual session id is different as it opened by file() as a new session, so it just strips out anything.
catalyse
Posted: 01/30/2002, 2:21 AM

Nicole, thanks but session.use_cookies is already set to 1 (and phpinfo() shows it as "On"): could this be overridden by "session.use_trans_sid=1"?

The problem in any case is that I have no control over the live server php.ini settings, so unless I can override it within the PHP script, I'm stuffed.

I think I'll just stick to my cludge for now!

Neil.
kangus@acats.com
Posted: 02/02/2003, 11:12 PM

In .htaccess:
php_flag session.use_trans_sid off
--- NOTE: Do not forget to add php_flag, apache blows up if you don't

In your PHP code:
ini_set('session.use_trans_sid', false);
--- I added this to my common.php file ----

Make sure that the session DIRECTORY is writable, you can use phpinfo to see if;
session.use_cookies = 1 or On
session.use_trans_sid = 1 or On
If they are both = 1 that may mean your session directory is not reachable or writable

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.