Minor bug fix for PHP-openid example

Keith Grennan keith at sxip.com
Fri Dec 1 10:08:29 PST 2006


the consumer example assumes it's running non-SSL.

k.

--- try_auth.php-dist   2006-12-01 10:03:30.000000000 -0800
+++ try_auth.php        2006-12-01 10:03:04.000000000 -0800
@@ -11,12 +11,17 @@
     exit(0);
 }

+$scheme = 'http';
+if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
+    $scheme .= 's';
+}
+
 $openid = $_GET['openid_url'];
-$process_url = sprintf("http://%s:%s%s/finish_auth.php",
+$process_url = sprintf("$scheme://%s:%s%s/finish_auth.php",
                        $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'],
                        dirname($_SERVER['PHP_SELF']));

-$trust_root = sprintf("http://%s:%s%s",
+$trust_root = sprintf("$scheme://%s:%s%s",
                       $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'],
                       dirname($_SERVER['PHP_SELF']));

@@ -40,4 +45,4 @@

 header("Location: ".$redirect_url);

-?>
\ No newline at end of file
+?>




More information about the Dev mailing list