passing session details to https//

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
garyfear
Forum Newbie
Posts: 2
Joined: Wed Nov 26, 2003 10:05 am

passing session details to https//

Post by garyfear »

Good day everybody

I have a site hosted with an ISP that has a general SSL server but it is a different domain to the site I'm working on. To give you an example using dummy names.......

the site is at http://www.mynewphpsite.co.uk

when I have to use the secure server, I have to pass the user to:

https://sslusers.com/mynewphpsite/index.php

The site I have prepared uses session cookies only and is there a way I can pass this cookie to the https section even though it is under a different domain.

I hope someone may be able to help and if so, thanks for taking the time to read this.

Gary Fear
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

I'd suggest the following hack:

Code: Select all

<?php
  list($sess_name,$sess_id)=explode("=",SID);
 //closing php tag here

<a href="https://sslusers.com/mynewphpsite/index.php?session_transfer=<?=$sess_id; їand here] ">Click here to go to secure server</a>
index.php:

Code: Select all

if(isset($_GET["session_transfer"]))
  session_id($_GET["session_transfer"]);
session_start();
[edit]
Forum drops closing php tags for some reason.
[/edit]
[one more edit]
It's simplest solution, but it isn't only one possible, I guess...
[/one more edit]
Last edited by Weirdan on Thu Nov 27, 2003 6:37 am, edited 2 times in total.
garyfear
Forum Newbie
Posts: 2
Joined: Wed Nov 26, 2003 10:05 am

Thanks

Post by garyfear »

Thanks ever so much...I'll try this and see how I go.

I appreciate your time in replying.

Gary Fear
Post Reply