use this code on your login page or any other page where you want to accept data securely.
NOTE: For this to work you will need a secure certificate set up on your site.
<?php
//https uses port 81 by default this may need to be changed
//on your web server.
define('HTTPS_PORT',81);
//if the person is not connected to our page securely
//we redirect them to https.
if(!is_https()) {
//underscore added because phpbuilder puts url tags
//around the ht_tps://
header('Location: ht_tps://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
} //end if
//This function checks to see if we are running an
//https connection by port
function is_https_port() {
//are we using an https connection
if($_SERVER['REMOTE_HOST'] == HTTPS_PORT) {
return TRUE;
} else {
return FALSE;
} //end if
} //end is_https
?>