Current location: Hot Scripts Forums » Programming Languages » PHP » When moving to ssl, sessions are gone...


When moving to ssl, sessions are gone...

Reply
  #1 (permalink)  
Old 07-14-08, 05:26 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
When moving to ssl, sessions are gone...

When going from none ssl to my ssl page to session is gone because its a new url... which creates a new session id...

How do i transfer the session in a secure way? Use DB?
Note: session_regenerate_id() is used also... so the session id changes everytime the page reloads. (Stops fixation )

Thanks!
Lex
__________________
01010000 01001000 01010000
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-14-08, 05:44 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Hi phpdoctor,

Im wondering if I would have any problems with moving over some pages to SSL so I googled your question for both our information.

Seems someone solved it via;
http://forums.devshed.com/showpost.p...74&postcount=3

Let me know if this works as I havnt begun moving anything over as yet but it would be good to know.

Also have you had to change anything else ie file paths are still ie /mygraphics/myimage.jpg rather than having to address the full path https://mygraphics/myimage.jpg. Never used SSL so Im in the dark on... well everything!

Kind regards
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-14-08, 07:10 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Thanks for the link... its abit old (2002) and not sure if its what i need.
This is for a checkout button... the checkout area needs to be ssl, its a shared ssl cert also... foxbat...
When i get to the checkout area the session is gone...

If your images src is "mygraphics/myimage.jpg" then it doesnt matter if your using ssl or not... if you use the full path
then it will get it from that site. I dont use full paths because of testing on my local server... would be annoying if the images loaded from the site when your just on your local server

Thanks,
Lex
__________________
01010000 01001000 01010000
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 07-14-08, 07:14 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry that link wasnt as usefull as I intended it to be.

The Img src was just an example of something I thought might have been a problem. So I imagine nothing but the communication between client and server changes appart from your sessions going missing.


Im sure your not the only one to use SSL, forum seems quiet over the past 4 days. Oh well, hope you get your answer.

Kind regards
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 07-15-08, 07:03 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Browsers don't pass session cookies (any cookies) when going back and forth between https and http protocols. There is actually an RCF standard that specifies this behavior. This is for security purposes so that if someone is monitoring data packets (such as over a non-encrypted wireless connection) that any data (including the session id cookie or session id on the end of the URL) that is sent back and forth between the browser and the server cannot be seen, taken, or used to impersonate the visitor.

There is a way to work around this by passing the session id on the end of the URL, but this defeats the purpose of buying and using a SSL certificate. If you have any data that is important enough to be using https/SSL for, than you should use https for the duration of the whole visit.

Your first post does not mention how the URL changes when gong back and forth between http and https. If the different pages are on different servers that don't have access to the same session data file storage, then you would need to setup a shared location to use, such as a shared folder or a database.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 07-15-08, 08:44 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry didnt mean to HiJack your thread again phpdoc but based on mabs reply Im curious;

Setting your whole site in SSL, Is there any issues with that ie speed?

Thanks
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 07-15-08, 08:57 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Actually I said for the duration of the whole visit. Meaning (or what I meant was) the page(s) where you expect the transfer of information to remain secure. That does not imply a whole site.

Yes. Any page or content on that page (unless you want the warning pop-up about displaying secure and non-secure information) will take longer to transfer.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 07-15-08, 04:40 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Ok, its a shared ssl: https://foxbat.oksecure.com/~$username/checkout.php
Basicly the user clicks the checkout link and it goes to this ssl checkout page....
If i send the session id, i can get the session back by changing the session id... which is my problem (unsecure).
It goes back to the non-secure site when checkout process is complete.

Is saving the sessions in a specific folder good? (session_save_path())

Thanks,
Lex
__________________
01010000 01001000 01010000
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 07-15-08, 05:46 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
If you are on a shared server, setting the session save path to be to a private folder within your account space will insure that none of the other accounts have access to the session data files and this will prevent garbage collection that runs due to the other accounts from deleting your session data files (people often set short garbage collection lifetime values in an incorrect attempt to end sessions.)

If you can, set this to a folder that is outside of (closer to the disk root) your web document root folder. This will prevent anyone from browsing to the files. If this option is not available, then you would need to put the folder within your web document root folder, but you must add either a .htaccess file that prevents (deny) all web access or place an empty default document in it so that if anyone figures out the folder name and browses to it, they cannot access the files.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 07-15-08, 09:54 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Thanks, ye I did htaccess it cause I cant get the folder outside of the webroot.
When going to the ssl link, is there a way to send a hash and have the session in the db? maybe this can only work once to prevent fixation?

I wonder how others do this...

Lex
__________________
01010000 01001000 01010000
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Proxy Script (basictly a website proxy site) with SSL support soccerdude21490 Script Requests 0 04-25-06 04:01 PM


All times are GMT -5. The time now is 07:02 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.