#native_company# #native_desc#
#native_cta#

Switching between the http to https and vice versa

By Siddhu
on February 3, 2003

// ssl certficate must be installed for your site
// include the page where the function is defined
require (‘sslredirection.php’);
// copy paste the below code on the every page

<?SSlRedirection($PHP_SELF)?>

// write the following code in the page called sslredirection.php
// function which do the necessary things
// it takes the page name as input type parameter

<?
function SSlRedirection($sVal)
{

global $SERVER_NAME; // your server name

global $SERVER_PORT; // server port

$strSSLPageName = “test.php”; // the page name which should be on the https
<bt>if(($sVal == $strSSLPageName))

{

if($SERVER_PORT == 80)

{

$strRedirectUrl = “https://”.$SERVER_NAME.$sVal;

header(“Location: $strRedirectUrl”);

}

}

else

{

if ($SERVER_PORT == 443)

{

$strRedirectUrl = “http://”.$SERVER_NAME.$sVal;

header(“Location: $strRedirectUrl”);

}

}

}
?>