hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Adding PHPSESSID to address bar?
Reply

Forum Jump

Adding PHPSESSID to address bar?

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-21-2002, 01:04 PM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955

Adding PHPSESSID to address bar?


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.



Sponsored Links
  #2  
Old 09-21-2002, 01:18 PM
ho247 ho247 is offline
Web Hosting Master
 
Join Date: Aug 2001
Location: United kingdom
Posts: 1,003
Using the session_start function does not require you to generate your own ID. An ID is automatically generated for you.

Quote:
<?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

__________________
Alan Ho
Former Systems Administrator

  #3  
Old 09-21-2002, 01:30 PM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955

__________________
Domain Software, LLC.


Sponsored Links
  #4  
Old 09-21-2002, 01:38 PM
ho247 ho247 is offline
Web Hosting Master
 
Join Date: Aug 2001
Location: United kingdom
Posts: 1,003
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

__________________
Alan Ho
Former Systems Administrator

  #5  
Old 09-21-2002, 08:00 PM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955
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.

__________________
Domain Software, LLC.


  #6  
Old 09-22-2002, 04:19 AM
ho247 ho247 is offline
Web Hosting Master
 
Join Date: Aug 2001
Location: United kingdom
Posts: 1,003
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

__________________
Alan Ho
Former Systems Administrator

  #7  
Old 09-22-2002, 11:52 AM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955
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)

__________________
Domain Software, LLC.


  #8  
Old 09-22-2002, 12:07 PM
ho247 ho247 is offline
Web Hosting Master
 
Join Date: Aug 2001
Location: United kingdom
Posts: 1,003
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

__________________
Alan Ho
Former Systems Administrator

  #9  
Old 09-23-2002, 06:18 AM
peachtreewebworks peachtreewebworks is offline
Web Hosting Guru
 
Join Date: Feb 2001
Location: Atlanta. Georgia
Posts: 252
You can also try adding config lines into a php.ini file and place that in your root directory.

__________________
Peachtree WebWorks, LLC
http://www.peachtreewebworks.com

Reply

Related posts from TheWhir.com
Title Type Date Posted
RemoteDesktop.com Listing 2014-04-24 09:32:09
HostingDiscussion Listing 2014-04-24 09:32:00
Licensecart Listing 2014-04-24 09:31:53
101domain, Inc. Listing 2014-04-24 09:32:21
101domain, Inc. Listing 2014-04-24 09:29:03


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?