Jump to content

Test for secure https connection


samsbc12

Recommended Posts

I want to display information if and only if the page is a secure connection

 

i have been trying

if(substr($_SERVER["SCRIPT_URI"],0,5)!=='https'){
echo "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\">
</script>
<script type=\"text/javascript\">
_uacct = \"UA-1\";
urchinTracker();
</script>";
}
?>

to know prevail not sure if my firewall is blocking stuff and if thats the case I need a php code that won't be blocked by firewalls

Link to comment
Share on other sites

I have no idea, but your grammar makes it very hard to understand.

 

I think you mean "to no avail".

know is something you do with knowledge. No is the opposite of yes.

prevail is something that keeps on going, avail is something of use.

Link to comment
Share on other sites

I have no idea, but your grammar makes it very hard to understand.

 

I think you mean "to no avail".

know is something you do with knowledge. No is the opposite of yes.

prevail is something that keeps on going, avail is something of use.

 

I am sorry and Thank you very much for correcting me, I mean it too. I always want to try and better myself, I do not want to sound like an idiot.

 

Basically what I want to do is see if the site is on a https connection vs http so that I can act accordingly.

Link to comment
Share on other sites

not sure if my firewall is blocking stuff

 

https is generally served through port 443 so make sure its not blocked. Not much you can do about it I'm afraid.

 

jesirose, please remember that not everyone is a native English speaker, sometimes there are reasons for a persons gramer being a little off.

Link to comment
Share on other sites

Check out this:

http://us3.php.net/manual/en/reserved.variables.php

'HTTPS'

 

    Set to a non-empty value if the script was queried through the HTTPS protocol.

 

    Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.

 

So you can use $_SERVER['HTTPS']

 

thorpe - he thanked me! If I make a mistake, I'd rather know about it than continue to make it. Obviously he speaks some english and uses it enough that he can post here, so better to know and learn than to keep using the wrong words. If a kid always says blue for red, you correct them and they learn, you don't just let them think red is blue.

 

PS: You said gramer :-P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.