stephanes Posted April 14, 2013 Share Posted April 14, 2013 Hi, I have a live chat widget. To have the widget to work in SSL pages, I had to change in all .php this: if(!strstr($hostdomain,"http")){ $hostdomain="http://".$hostdomain; } to if(!strstr($hostdomain,"https")){ $hostdomain="https://".$hostdomain; }. The problem is when I change the http to https in the code above, now the widget don't appear in non-ssl pages. So my question is how can I modify the code below to have it to work with both http and https ? Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/ Share on other sites More sharing options...
DavidAM Posted April 14, 2013 Share Posted April 14, 2013 Have a look at the $_SERVER super-global array. There are a couple of entries there that can tell you if the user requested through HTTP or HTTPS. Then build your domain variable appropriately. Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/#findComment-1424734 Share on other sites More sharing options...
stephanes Posted April 14, 2013 Author Share Posted April 14, 2013 Thank you for your answer but to be honest I don't understand. Just giving me a link to the php manual is no help in my case. Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/#findComment-1424740 Share on other sites More sharing options...
requinix Posted April 14, 2013 Share Posted April 14, 2013 Then you best start learning to read manual pages. 'HTTPS' Set to a non-empty value if the script was queried through the HTTPS protocol. Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/#findComment-1424748 Share on other sites More sharing options...
stephanes Posted April 14, 2013 Author Share Posted April 14, 2013 Probably I'm just a the wrong place. I was just asking for help. I don't understand the purpose to register here if the only help I can get is to tell me to read the php manual. Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/#findComment-1424750 Share on other sites More sharing options...
Jessica Posted April 15, 2013 Share Posted April 15, 2013 We expect people to do some work and ask decent questions. Even without that you were given the relevant information already. Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/#findComment-1424761 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.