SunQuest
 
           General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old March 9th, 2003, 10:24 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Question How to hide SessionId in address bar?

I was wondering that how the vBulletin' Forum Developers can do these things such as hiding or showing the SessionId in the address bar on the browser. It would be terrific if I know how to do it


Please help me if anyone know the methods to do this.

Thanks.

Reply With Quote
  #2  
Old March 9th, 2003, 11:07 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
I dunno how vBull does it,...but I know IBF stores that setting in a cookie,.... and if you notice there is always a

Code:
page.php?s=&


basically the code is saying,..

PHP Code:
if(the user wants to see the sessID)
{
   
$s $sessId;
}
else
{
   
$s '';
}

page.php?s=$session


Whether you choose to see the session id or not,..keep in mind that the session is still there

get the idea?
__________________
-- Jason

Last edited by Taelo : March 10th, 2003 at 01:40 PM.

Reply With Quote
  #3  
Old March 9th, 2003, 11:31 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Thank you very much. Taelo! But how am I gonna to set it up? Do you have any ideas?

Reply With Quote
  #4  
Old March 10th, 2003, 12:25 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
well you can store the value in the database, or you can set a client side cookie. If you set a cookie,...just retrieve the value from the cookie, and possibly load it into a session var.

PHP Code:
if(isset($_COOKIE['show_session']) && $_COOKIE['show_session'] == "1")
{
   
$_SESSION['s'] = session_id();
}
else
   
$_SESSION['s'] = ''


Now,...in your href's....simply echo out $_SESSION['s'];

PHP Code:
<a href="page.php?s=<?php echo $_SESSION['s']; ?>" 


make sense?

Reply With Quote
  #5  
Old March 10th, 2003, 10:14 AM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Thumbs up Thanks, Taelo!

Wow! I love it. Thanks Taelo. I will try it later but I have to take a look at my code in order where I should start it. I will let you know something going to turnout. Greatly appreciative.

Regards,

Reply With Quote
  #6  
Old March 10th, 2003, 11:03 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
I think IBF forums use "hide_sess" as the session var,....so if you wanted to,...you could use your forums to control the switching on and off of the showing of the session,....ad just use 2 or 3 lines of code to do some checking on that cookie

Reply With Quote
  #7  
Old March 10th, 2003, 12:00 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
To make the session_id() visible in the address bar you set php to force appending of the session_id() to the url as so ->
PHP Code:
 ini_set'session.use_cookies', ( int ));
ini_set'session.use_trans_sid', ( int )); 

The above will not use client cookies to track session_id()'s and will auto append the session_id() to your links.
PHP Code:
 ini_set'session.use_cookies', ( int ));
ini_set'session.use_trans_sid', ( int )); 

The above will attempt to use client cookies to track the session, if a cookie was set succesfully, it will not append the session_id() to the links and thus will hide the sesseion_id() from the url get string, if it was not succesfull in setting a cookie, it will track it through links by auto appending the session_id()...
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #8  
Old March 10th, 2003, 12:30 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
or you could do that

Reply With Quote
  #9  
Old March 10th, 2003, 06:40 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Question

How about I just want the SessionId to be hidden all the time. How can I set up the cookie? Please help me!

Thanks,

Reply With Quote
  #10  
Old March 14th, 2003, 03:13 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Please!

Please some body help me! I am trying but still being stuck...

Reply With Quote
  #11  
Old March 14th, 2003, 05:39 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
Quote:
How about I just want the SessionId to be hidden all the time


You can't unless you create a custom session handler.

Short and simple - sessions will not work unless the sess id is in a cookie on the clients machine, or attached to the url's or in hidden fields for post on your site. So, if a user comes to your site with cookies disabled - either YOU HAVE TO APPEND the session id to the links or the sessions WILL NOT WORK.

In theory, a custom session handler can help on this - but in actuality, it will not work as not everyone that comes to your site will keep the same ip address for the duration of the time they are on your site (AOL Users) - so you have no way of keeping track of these users either...

Reply With Quote
  #12  
Old March 15th, 2003, 05:21 AM
akadido akadido is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 akadido User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
u can use a simple frame

Reply With Quote
  #13  
Old March 15th, 2003, 03:11 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
Quote:
u can use a simple frame


This won't work. Reason being is if I start tab browsing through a site built like that with no passing of a session_id() in the link - it will be lost on every single page that I load. Same with popping or right clicking on a link and opening in new window - breaks the session_id(). There is absolutely (through PHP) NO way of doing this...

EDIT:: Let me rephrase the above - there is absolutely (through PHP) NO way of doing this and creating a fully functional web site...

Reply With Quote
  #14  
Old March 15th, 2003, 03:48 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Thanks for all of yours responds, espcially to JPENN. Now I realize many things from your post. So the only way that I can have a perfect code is creating a custom session. Unfortunately, every books that I bought they never taught me how to create a custom session. If you have any books or tutorials reference which specific to this issue please let me know. Greatly appreciative.

Regards,

Reply With Quote
  #15  
Old March 15th, 2003, 04:17 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 233 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 50 m 19 sec
Reputation Power: 6
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
there is a tutorial here on Custome Sessions. it's can be found here Developing Custom PHP Sessions
__________________
CHornJr
"One day I'll know what I am doing"
My Blog
Suanhacky Lodge #49
Rebel Squadrons

Reply With Quote
  #16  
Old March 16th, 2003, 11:00 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
You are absolutely right. It never worked while I was inside the members area and clicked on popup window link, then I went back to the main window I logged me out.

Quote:
This won't work. Reason being is if I start tab browsing through a site built like that with no passing of a session_id() in the link - it will be lost on every single page that I load. Same with popping or right clicking on a link and opening in new window - breaks the session_id(). There is absolutely (through PHP) NO way of doing this...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > How to hide SessionId in address bar?


Thread Tools  Search this Thread 
Search this Thread: