View Full Version : Show ads based on URL (HTTP vs HTTPS)
zagman76
02-20-2009, 11:43 PM
I would like to deliver less (or no) ads to people who use the SSL version of the site. How would I program that into my headers, so if a person requests/views the page with https://my.forum.com they don't see ads?
I know there's something with an IF statement, but I can't seem to get it right.
Thanks!
Dismounted
02-21-2009, 02:58 AM
if (empty($_SERVER['HTTPS']) === false)
{
// https on
}
zagman76
02-22-2009, 02:06 AM
if (empty($_SERVER['HTTPS']) === false)
{
// https on
}
I am getting this error:
The following error occurred when attempting to evaluate the template 'footer':
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /path/to/forum/includes/adminfunctions_template.php(3729) : eval()'d code on line 10
This is likely caused by a malformed conditional statement.
Line 10, is if (empty($_SERVER['HTTPS']) === false)
Dismounted
02-24-2009, 05:00 AM
You cannot directly put that into a template - it is not a template conditional...
<if condition="empty($_SERVER['HTTPS']) === false">
zagman76
02-25-2009, 12:20 AM
You cannot directly put that into a template - it is not a template conditional...
<if condition="empty($_SERVER['HTTPS']) === false">
Ok - I've got it working in reverse... when I go to https:// I get ads, and when I go to http:// I do not. How can I reverse this behavior? I have tried making the 'false' a 'true' and also tried making it '!= false"' ... but it doesn't seem to work.
the basic structure I did was:
<if statement>
: codes for ads :
<else />
rest of template (footer in this case)
</if> (at end of footer template).
Dismounted
02-25-2009, 05:51 AM
<if condition="empty($_SERVER['HTTPS']) === true OR $_SERVER['HTTPS'] === 'off'">
zagman76
02-26-2009, 12:53 AM
<if condition="empty($_SERVER['HTTPS']) === true OR $_SERVER['HTTPS'] === 'off'">
That worked! Thank you very much!!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.