stephanes Posted April 14, 2013 Share Posted April 14, 2013 (edited) 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 ? Edited April 14, 2013 by stephanes Quote 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. Quote 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 (edited) 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. Edited April 14, 2013 by stephanes Quote 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. Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/276948-ssl-vs-non-ssl/#findComment-1424761 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.