SSL For Members Only
Posted: Tue Feb 07, 2012 8:38 am
I was wondering how exactly to increase both traffic and security to the site I am working on, and it came to me...SSL...So I created the following snippet of code to enable SSL for Logged in members ONLY. This not only solved the security issue for me, but also solved another problem...Google Ad-sense!
For those that have experience with Google Ad-sense, you will already know how great the program is...but also how disappointing it is that they do not offer an SSL version of it. So here is another way to entice members to join your site while making money at the same time. Let me explain:
My idea is to display ads on the site to non-members and to offer an ad-free and SSL secure environment to my members, so with this code it will not only allow you to provide the SSL secure environment, it will also allow you to display Ads on your site (non-ssl) without having to worry about the security warnings your browser will throw at you.
Installing the mod is VERY simple...
Step 1:
Open style/Indigo/header.php
Step 2:
Find: (It's the first few lines of code in the file)
Step 3:
Add before:
Step 4:
Save and upload!
Your all done! Now when you login, your members will automatically be redirected to an "https" version of every page. And since it is loaded before any other code, you shouldn't run into any errors. This code does assume that your server is running SSL on port 443. If not, you can adjust the port accordingly.
Now for the Ad part...lol...Will create a new mod topic as soon as I am done!
That's all for now...
For those that have experience with Google Ad-sense, you will already know how great the program is...but also how disappointing it is that they do not offer an SSL version of it. So here is another way to entice members to join your site while making money at the same time. Let me explain:
My idea is to display ads on the site to non-members and to offer an ad-free and SSL secure environment to my members, so with this code it will not only allow you to provide the SSL secure environment, it will also allow you to display Ads on your site (non-ssl) without having to worry about the security warnings your browser will throw at you.
Installing the mod is VERY simple...
Step 1:
Open style/Indigo/header.php
Step 2:
Find: (It's the first few lines of code in the file)
- Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<meta name="description" content="<?php echo $fcontent[6];?>"/>
<meta name="keywords" content="keywords"/>
<meta name="author" content="author"/>
<link rel="stylesheet" type="text/css" href="./css/global.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="./styles/<?php echo $style; ?>/style.css" media="screen"/>
Step 3:
Add before:
- Code: Select all
<?php if ($_SESSION['islogged'] <> true) {
}else{
if ($_SERVER['SERVER_PORT']!=443)
{
$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_URI'];
header("Location: $url");
}
}
?>
Step 4:
Save and upload!
Your all done! Now when you login, your members will automatically be redirected to an "https" version of every page. And since it is loaded before any other code, you shouldn't run into any errors. This code does assume that your server is running SSL on port 443. If not, you can adjust the port accordingly.
Now for the Ad part...lol...Will create a new mod topic as soon as I am done!
That's all for now...