Re: [PHP] how to check http:// or https:// ?
[EMAIL PROTECTED] wrote: Right. Tested and found $_SERVER['HTTPS'] has to be 'on' :) But, there is something in the code Jochem wrote that bothers me for a while: if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } Doesn't $_SERVER['HTTPS']=='on' automatically means isset($_SERVER['HTTPS']) ? indeed - I'm a bit of correctness freak like that - without the isset an E_NOTICE is generated - which you could supress: if('on' == @$_SERVER['HTTPS']) { // yes! } (others are speed freaks - and will probably go for the E_NOTICE :-) - although I have no idea whether thats even any faster than calling isset() as the E_NOTICE generation must all have _some_ overhead, and how error supression affects performance. regardless the difference if probably almost immeasurable.) I mean, if $_SERVER['HTTPS'] exists doesn't mean it's equal to 'on' but if $_SERVER['HTTPS'] == 'on' IT MEANS $_SERVER['HTTPS'] exists why then if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') -afan Jochem Maas wrote: Marco Tabini wrote: On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found? That's because it shows up only if you are under HTTPS! :-) AFAICT tell you should check whether the value is actually set to 'on' (IIRC a post by Rasmus): e.g. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDB&s=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-) Marco -afan Marco Tabini wrote: IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
True, but if you check that it's equal to 'on' and it doesn't exist, you'll get a warning. If you want to avoid the warning, check that it exists first. Matt I mean, if $_SERVER['HTTPS'] exists doesn't mean it's equal to 'on' but if $_SERVER['HTTPS'] == 'on' IT MEANS $_SERVER['HTTPS'] exists why then if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') -afan Jochem Maas wrote: Marco Tabini wrote: On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found? That's because it shows up only if you are under HTTPS! :-) AFAICT tell you should check whether the value is actually set to 'on' (IIRC a post by Rasmus): e.g. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDB&s=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-) Marco -afan Marco Tabini wrote: IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- Matt Blasinski (mbv) Information Systems Technology Services Professional Internet Infrastructure Applications Technology Division of Information Technology 3228 Computer Science and Statistics 1210 West Dayton Street Madison WI 53706 Work (608) 263-4865 Personal Cell (608) 347-6940 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
Right. Tested and found $_SERVER['HTTPS'] has to be 'on' :) But, there is something in the code Jochem wrote that bothers me for a while: if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } Doesn't $_SERVER['HTTPS']=='on' automatically means isset($_SERVER['HTTPS']) ? I mean, if $_SERVER['HTTPS'] exists doesn't mean it's equal to 'on' but if $_SERVER['HTTPS'] == 'on' IT MEANS $_SERVER['HTTPS'] exists why then if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') -afan Jochem Maas wrote: Marco Tabini wrote: On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found? That's because it shows up only if you are under HTTPS! :-) AFAICT tell you should check whether the value is actually set to 'on' (IIRC a post by Rasmus): e.g. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDB&s=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-) Marco -afan Marco Tabini wrote: IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
Marco Tabini wrote: On 8/5/05 3:24 PM, "Jochem Maas" <[EMAIL PROTECTED]> wrote: SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDB&s=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-) :-) There's also a Firefox search toolbar with a Google passthru: http://beeblex.com/faq/ <-- (see item #4) impressive really very nice indeed! Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
On 8/5/05 3:24 PM, "Jochem Maas" <[EMAIL PROTECTED]> wrote: > SIDENOTE REGARDING BEEBLEX.COM: > > I just added a bookmark in firefox to beeblex.com as follows > > http://beeblex.com/search.php?d=ALLDB&s=%s > and I gave it a keyword of 'beeb' > > now I can go to firefox and type 'beeb HTTPS' to get an direct hit - > so now there is no excuse not to be using Marco's cool new resource :-) > :-) There's also a Firefox search toolbar with a Google passthru: http://beeblex.com/faq/ <-- (see item #4) Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
Marco Tabini wrote: On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found? That's because it shows up only if you are under HTTPS! :-) AFAICT tell you should check whether the value is actually set to 'on' (IIRC a post by Rasmus): e.g. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDB&s=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-) Marco -afan Marco Tabini wrote: IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks Marco! > :) > > I was looking for something like this on phpinfo() but didn't found? That's because it shows up only if you are under HTTPS! :-) Marco > > > -afan > > Marco Tabini wrote: > >> IIRC, if you're using Apache you can check >> >> If (isset ($_SERVER['HTTPS'])) >> >> You can also check this thread: >> >> http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP >> S%27%5D >> >> -- >> BeebleX - The PHP Search Engine >> http://beeblex.com >> >> On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> >> >> >>> Hi, >>> I need to check does URL use http or https? >>> >>> Right now I use this code: >>> >>> if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) >>> { >>> header('location: [URL]https://www.test.com/test.php[/URL]'); >>> exit; >>> } >>> >>> but I am sure there is much better solution. >>> :) >>> >>> >> >> >> >> >> >> >> -- Marco Tabini President & CEO Marco Tabini & Associates, Inc. 28 Bombay Ave. Toronto, ON M3H 1B7 Canada Phone: +1 (416) 630-6202 Fax: +1 (416) 630-5057 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found? -afan Marco Tabini wrote: IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check http:// or https:// ?
IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > I need to check does URL use http or https? > > Right now I use this code: > > if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) > { >header('location: [URL]https://www.test.com/test.php[/URL]'); >exit; > } > > but I am sure there is much better solution. > :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to check http:// or https:// ?
Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php