Re: [PHP] http vs https
Hi, isset($_SERVER['HTTPS']) should do it. Regards, Jonathan On Sat, Jan 23, 2010 at 2:11 PM, Ben Miller biprel...@gmail.com wrote: Is there a PHP function that will return whether the request was http or https? I have functions that need to cURL other servers - sometimes over SSL, sometimes not, depending whether the function is called from http://www.mydomain.com/script_that_calls_function.php or https://www.mydomain.com/script_that_calls_function.php Hope the question is clear. Thanks, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https session problem
On Thu, June 9, 2005 7:43 am, Joe Harman said: I am having a little problem with users keeping the same session id when they go from http to https... is there a work around for this... I don't appear to have this problem when using openSSL just when the site has it's own certificate. should I store the session id in a cookie??? or is there another way or setting A Cookie would be a fine way to pass it, or in the URL. You probably have a very clear user-interaction-path into and out of SSL anyway, so you'd only be changing a couple lines of code, in a well-designed application. Essentially, it's probably best to think of your HTTP and HTTPS as two totally different servers, with nothing in common, even when, in fact, they are the same server with the same files in the same exact hard drive and all that. Some hosts split HTTPS off on another box ; Some don't. If you're ready for the split, you're more mobile. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https session problem
On 6/11/05, Joe Harman [EMAIL PROTECTED] wrote: On 6/11/05, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, June 9, 2005 7:43 am, Joe Harman said: I am having a little problem with users keeping the same session id when they go from http to https... is there a work around for this... I don't appear to have this problem when using openSSL just when the site has it's own certificate. should I store the session id in a cookie??? or is there another way or setting A Cookie would be a fine way to pass it, or in the URL. You probably have a very clear user-interaction-path into and out of SSL anyway, so you'd only be changing a couple lines of code, in a well-designed application. Essentially, it's probably best to think of your HTTP and HTTPS as two totally different servers, with nothing in common, even when, in fact, they are the same server with the same files in the same exact hard drive and all that. Some hosts split HTTPS off on another box ; Some don't. If you're ready for the split, you're more mobile. -- Like Music? http://l-i-e.com/artists.htm Yep... i am going to have to keep something in a cookie to identify the user if they come back to the site... I was trying to avoid the whole P3P things with cookies... not that it's hard... it's jsut a pain in the butt :o) Thanks! Cheers! Yep... i am going to have to keep something in a cookie to identify the user if they come back to the site... I was trying to avoid the whole P3P things with cookies... not that it's hard... it's jsut a pain in the butt :o) Thanks! Cheers! -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] http to https
Hitek - I tried adding the exit; after the header ('Location... Andre - Your idea about sending them to another page is a good one. I tried it, without any luck. What could the issue still be? To simplify my problem, I have a simple script: ?php header ('Location https://www.tgwedding.com/payment6.php'); exit; ? Which just hangs when I access the page and it doesn't redirect. Typing URL in browser correctly sends me to the secure page though. -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 9:42 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] http to https Well, I'm no php-guru, that's for sure, but if you are trying to call: https://www.tgwedding.com/payment6.php from http://www.tgwedding.com/payment6.php might be where the problem lies. You might need to do a 'refresh' since What is strange is when I go back on my browser and resubmit, it correctly sends it to the https location and all is well. What I have done a s a clutz-hack is to create an additional page for the re-direct, which then sends it back to the page in question. (I used that for 'cookie' detection/browser ident as well on my opening pages.) I suppose you might get away with a Meta Refresh but I'm not too clear whetehr you can accomplish that for the same page . . Aside from that idea . . . . Hth, Andre On Thursday 17 June 2004 08:31 pm, you wrote: Yeah, I'm assuming it's set. I have an installed ssl cert from a CA and have successfully run other https scripts (by typing in the URL) on the server. I check phpinfo(), http://www.tgwedding.com/tgwedding/phpinfo.php php, http, ftp, https, ftps, compress.bzip2, compress.zlib I searched php.ini for ssl and https and didn't find anything though -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:26 PM To: Ryan Schefke Subject: Re: [PHP] http to https Just a thought - is https on the server set? (Check your php.ini) On Thursday 17 June 2004 08:20 pm, Ryan Schefke wrote: Hi Andre, Thanks for responding. I'm not using sessions, just cookies. I used your recommendation in the code below (which gets executed if the submit button is pushed. It still sends it to http://www.tgwedding.com/payment6.php; instead of https://www.tgwedding.com/payment6.php; Any advice please? if (isset($submit)) { if ($radiobutton == 1) { $value=$validcoupon; } else { $value=0; } $query_insertcoupon = UPDATE sitepayment SET couponcode='$value' WHERE customerID='$CID'; $result_insertcoupon = mysql_query ($query_insertcoupon); // run the query if ($_SERVER['HTTPS'] != on){ header(Location: https://www.tgwedding.com/payment6.php;); exit;} // $redirect = https://www.tgwedding.com/payment6.php;; //header (Location: $redirect); } = -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:01 PM To: Ryan Schefke; [EMAIL PROTECTED] Subject: Re: [PHP] http to https Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] http to https
Hi Ryan, you have an error in your script. Quoting Ryan Schefke [EMAIL PROTECTED]: ?php header ('Location https://www.tgwedding.com/payment6.php'); exit; ? correct one is ?php header ('Location: https://www.tgwedding.com/payment6.php'); ? Note the : after Location. HTH -R'twick -- This is a signature This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https
Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] http to https
Ryan Schefke mailto:[EMAIL PROTECTED] on Thursday, June 17, 2004 4:28 PM said: [snip] [snip] [snip] What am I doing wrong? you're pressing the return key too much. 0_0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] http to https
Quick follow up... Has anyone had any issues with redirecting from an http script to https? Every time I try to to a redirect to https it hangs. For example, I write a simple script like this, nothing... ?php header ('Location https://www.tgwedding.com/payment6.php'); ? ...but if I type that link in a browser http is working fine. -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:01 PM To: Ryan Schefke; [EMAIL PROTECTED] Subject: Re: [PHP] http to https Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] http to https
Hi Andre, Thanks for responding. I'm not using sessions, just cookies. I used your recommendation in the code below (which gets executed if the submit button is pushed. It still sends it to http://www.tgwedding.com/payment6.php; instead of https://www.tgwedding.com/payment6.php; Any advice please? if (isset($submit)) { if ($radiobutton == 1) { $value=$validcoupon; } else { $value=0; } $query_insertcoupon = UPDATE sitepayment SET couponcode='$value' WHERE customerID='$CID'; $result_insertcoupon = mysql_query ($query_insertcoupon); // run the query if ($_SERVER['HTTPS'] != on){ header(Location: https://www.tgwedding.com/payment6.php;); exit;} // $redirect = https://www.tgwedding.com/payment6.php;; //header (Location: $redirect); } = -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:01 PM To: Ryan Schefke; [EMAIL PROTECTED] Subject: Re: [PHP] http to https Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https
Well, I'm no php-guru, that's for sure, but if you are trying to call: https://www.tgwedding.com/payment6.php from http://www.tgwedding.com/payment6.php might be where the problem lies. You might need to do a 'refresh' since What is strange is when I go back on my browser and resubmit, it correctly sends it to the https location and all is well. What I have done a s a clutz-hack is to create an additional page for the re-direct, which then sends it back to the page in question. (I used that for 'cookie' detection/browser ident as well on my opening pages.) I suppose you might get away with a Meta Refresh but I'm not too clear whetehr you can accomplish that for the same page . . Aside from that idea . . . . Hth, Andre On Thursday 17 June 2004 08:31 pm, you wrote: Yeah, I'm assuming it's set. I have an installed ssl cert from a CA and have successfully run other https scripts (by typing in the URL) on the server. I check phpinfo(), http://www.tgwedding.com/tgwedding/phpinfo.php php, http, ftp, https, ftps, compress.bzip2, compress.zlib I searched php.ini for ssl and https and didn't find anything though -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:26 PM To: Ryan Schefke Subject: Re: [PHP] http to https Just a thought - is https on the server set? (Check your php.ini) On Thursday 17 June 2004 08:20 pm, Ryan Schefke wrote: Hi Andre, Thanks for responding. I'm not using sessions, just cookies. I used your recommendation in the code below (which gets executed if the submit button is pushed. It still sends it to http://www.tgwedding.com/payment6.php; instead of https://www.tgwedding.com/payment6.php; Any advice please? if (isset($submit)) { if ($radiobutton == 1) { $value=$validcoupon; } else { $value=0; } $query_insertcoupon = UPDATE sitepayment SET couponcode='$value' WHERE customerID='$CID'; $result_insertcoupon = mysql_query ($query_insertcoupon); // run the query if ($_SERVER['HTTPS'] != on){ header(Location: https://www.tgwedding.com/payment6.php;); exit;} // $redirect = https://www.tgwedding.com/payment6.php;; //header (Location: $redirect); } = -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:01 PM To: Ryan Schefke; [EMAIL PROTECTED] Subject: Re: [PHP] http to https Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https
try placing an exit(); after your header line. At 04:27 PM 6/17/2004, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
I usually just use $_SERVER['SERVER_PORT'] -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is not really secure. Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I usually just use $_SERVER['SERVER_PORT'] -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
Presumably you know the HTTPS port on your server. Anything not SSL is going to be straight HTTP. The point here is that SSL happens a layer below PHP. PHP doesn't care whether it is running over SSL or not. In fact it has no idea what transport layer is below it. So your only way to tell is to depend on whatever the web server tells you. Look at a phpinfo() for both an SSL and a non-SSL request and see what the differences are on your server. For me, checking SERVER_PORT has been the most portable/reliable mechanism. -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is not really secure. Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I usually just use $_SERVER['SERVER_PORT'] -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
So far so good, the next problem is now, that the port changes with every new request. Tried this on my personal server an my hoster's one. Perhaps there is another way? JScript, xml or anything other? Thanx so far, Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Presumably you know the HTTPS port on your server. Anything not SSL is going to be straight HTTP. The point here is that SSL happens a layer below PHP. PHP doesn't care whether it is running over SSL or not. In fact it has no idea what transport layer is below it. So your only way to tell is to depend on whatever the web server tells you. Look at a phpinfo() for both an SSL and a non-SSL request and see what the differences are on your server. For me, checking SERVER_PORT has been the most portable/reliable mechanism. -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is not really secure. Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I usually just use $_SERVER['SERVER_PORT'] -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
No, the destination port will not change. You must be looking at the source port. -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: So far so good, the next problem is now, that the port changes with every new request. Tried this on my personal server an my hoster's one. Perhaps there is another way? JScript, xml or anything other? Thanx so far, Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Presumably you know the HTTPS port on your server. Anything not SSL is going to be straight HTTP. The point here is that SSL happens a layer below PHP. PHP doesn't care whether it is running over SSL or not. In fact it has no idea what transport layer is below it. So your only way to tell is to depend on whatever the web server tells you. Look at a phpinfo() for both an SSL and a non-SSL request and see what the differences are on your server. For me, checking SERVER_PORT has been the most portable/reliable mechanism. -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is not really secure. Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I usually just use $_SERVER['SERVER_PORT'] -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
For sure, and this port changes every time I make a new request. Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] No, the destination port will not change. You must be looking at the source port. -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: So far so good, the next problem is now, that the port changes with every new request. Tried this on my personal server an my hoster's one. Perhaps there is another way? JScript, xml or anything other? Thanx so far, Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Presumably you know the HTTPS port on your server. Anything not SSL is going to be straight HTTP. The point here is that SSL happens a layer below PHP. PHP doesn't care whether it is running over SSL or not. In fact it has no idea what transport layer is below it. So your only way to tell is to depend on whatever the web server tells you. Look at a phpinfo() for both an SSL and a non-SSL request and see what the differences are on your server. For me, checking SERVER_PORT has been the most portable/reliable mechanism. -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is not really secure. Alex Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I usually just use $_SERVER['SERVER_PORT'] -Rasmus On Sat, 5 Apr 2003, Alexander Weber wrote: Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
Unfortunally is not set. It's like the variable does not exist, because when I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only SERVER_PROTOCOL. I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3. register_globals OFF safe:mode OFF stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002 If you need more info: ICQ 46858764. Thanx Alex John W. Holmes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
Alexander Weber wrote: Hi! anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. Thanx a lot! Alex Try $_SERVER['SERVER_PROTOCOL'] -- Burhan Khalid phplist[at]meidomus[dot]com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP or HTTPS
Hi Burhan, sorry but this tells me only HTTP/1.1 but not if the connection is secure or not. Alex Burhan Khalid [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Alexander Weber wrote: Hi! anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. Thanx a lot! Alex Try $_SERVER['SERVER_PROTOCOL'] -- Burhan Khalid phplist[at]meidomus[dot]com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTTP or HTTPS
anybody knows how to find out the connection type (http or httpS)? Tried out $HTTP_SERVER_VARS. $_SERVER['HTTPS'] will be set if it's over HTTPS. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php