If you have the condition like that you want same session id in the http and HTTPS prtocal the simple one line solution:-
Just make it one .htaccess file and upload in your server top root directory
and write the .htaccess like this -
php_value session.cookie_domain ".domain_name.com"
so now save the .htaccess file and upload on the server and check the cookie of your web browser , when you redirect from http to https or vicecersa your session id remain same.
Or any question regarding this feel free comment here.....