Check if SSL is available

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
User avatar
hopfateam
Forum Newbie
Posts: 12
Joined: Sun May 29, 2005 6:30 pm
Location: Germany
Contact:

Check if SSL is available

Post by hopfateam »

I would wrote a CMS which allows admins to either use SSL or regular http

The problem is that not all providers support SSL (especially on shared hostings):

i would like to check if SSL is supported or not:

e.g:
User installed CMS on http://www.domain.com
atm I offer a link with https://www.domain.com to see if ssl works

But I´m not satisfied with this

Is there a way to check if SSL is supoorted or not?!

Something link $_ENV[] or else?!

:?: :idea:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

first, check if ssl is supported in the list of wrappers, then try creating a link to it in code. Set the timeout to quite short. If you get a page response, it's got it enabled in some fashion.

If you're running Apache, the Apache functions in php may help. The $_SERVER superglobal may also have some details, but not as likely.
User avatar
hopfateam
Forum Newbie
Posts: 12
Joined: Sun May 29, 2005 6:30 pm
Location: Germany
Contact:

Post by hopfateam »

THX, for the reply feyd

SERVER_SIGNATURE might work, don´t you think?!
I mean, it the only variable, which considers to contain information about ssl... :oops:

At my xampp it shows
"Apache/2.0.53 (Win32) mod_ssl/2.0.53 OpenSSL/0.9.7f PHP/5.0.4 Server at localhost Port 80"

While it doesnot show anything like this at my webspace @ lycos (shared hosting without SSL-Support)
User avatar
hopfateam
Forum Newbie
Posts: 12
Joined: Sun May 29, 2005 6:30 pm
Location: Germany
Contact:

Post by hopfateam »

nice script to echo all superglobals

Code: Select all

<?php $var=$_ENV;
$var_array=array($_COOKIE,$_ENV,$_FILES,$_GET,$_POST,$_REQUEST,$_SESSION,$_SERVER);
$var_array1=array('$_COOKIE','$_ENV','$_FILES','$_GET','$_POST','$_REQUEST','$_SESSION','$_SERVER');

?>
<?php
foreach($var_array as $vartitle =>$varvalue){
echo"<h2>$var_array1[$vartitle]</h2> <hr />";

foreach($varvalue as $title1 =>$value1){

echo"$title1 == $value1 <br>";
}}
 ?>
Post Reply