flitcher
09-21-2002, 01:04 PM
How would I go about doing this? My current code to generate the ID is:
<?php
session_start();
if (isset($_SESSION['count'])) {
$_SESSION['count']++;
}
else {
$_SESSION['count'] = 0;
}
?>
I know it just goes up by one each time, but thats what im using while I test it for now. What I want to know is how I would do this:
http://www.domain.com?PHPSESSID=1
So basically, how do I load the sessionid into the address bar? Thanks.
ho247
09-21-2002, 01:18 PM
Using the session_start function does not require you to generate your own ID. An ID is automatically generated for you.
<?php
session_start();
$sessionID = session_id ();
print "http://www.domain.com/index.php?PHPSESSID=$sessionID";
?>When you load the page, the variable $sessionID can be placed on any of the URLs. But if you don't want to do this, the session ID is always passed on to the next page automatically anyway. If this is not what you're looking for, could you add slightly more detail to your post please?
Alan
flitcher
09-21-2002, 01:30 PM
http://www.versehost.com/work/?view=webhosting&PHPSESSID=c4f6c5e5ec983930b8307caa5df515d1
Id like to do it like that.
ho247
09-21-2002, 01:38 PM
I see... take a look at http://www.php.net/manual/en/ref.session.php. Look at details about session.use_trans_sid in the config file. If this is enabled, it'll add the PHPSESSID at the end of all links.
Alan
flitcher
09-21-2002, 08:00 PM
Is there anyway to force the PHPSESSID at the end of all links with enabling session.use_trans_sid? Most hosts won't enable that since it would effect all other websites on the server.
ho247
09-22-2002, 04:19 AM
It's possible to enable that setting for your site only if using Apache. Ask your host if they can add a line into their httpd.conf to enable it. I've not tried that here myself, but I'm sure it can be done.
Alan
flitcher
09-22-2002, 11:52 AM
Alan,
Do you by any chance know what or where I need to look in the httpd.conf file? I have Apache installed on my Windows as I like to test my scripts before I upload them. So, what line would I need to add (I'm not extremely familiar with Apache)
ho247
09-22-2002, 12:07 PM
Actually... I've just had a look and your host has to have it enabled when PHP was compiled. You're best to choose a host and then ask them if they will support it or not.
Alan
peachtreewebworks
09-23-2002, 06:18 AM
You can also try adding config lines into a php.ini file and place that in your root directory.