vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Show ads based on URL (HTTP vs HTTPS) (https://vborg.vbsupport.ru/showthread.php?t=206066)

zagman76 02-20-2009 11:43 PM

Show ads based on URL (HTTP vs HTTPS)
 
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

PHP Code:

if (empty($_SERVER['HTTPS']) === false)
{
    
// https on



zagman76 02-22-2009 02:06 AM

Quote:

Originally Posted by Dismounted (Post 1750350)
PHP Code:

if (empty($_SERVER['HTTPS']) === false)
{
    
// https on



I am getting this error:

Quote:

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
PHP Code:

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...
Code:

<if condition="empty($_SERVER['HTTPS']) === false">

zagman76 02-25-2009 12:20 AM

Quote:

Originally Posted by Dismounted (Post 1753025)
You cannot directly put that into a template - it is not a template conditional...
Code:

<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

Code:

<if condition="empty($_SERVER['HTTPS']) === true OR $_SERVER['HTTPS'] === 'off'">

zagman76 02-26-2009 12:53 AM

Quote:

Originally Posted by Dismounted (Post 1753960)
Code:

<if condition="empty($_SERVER['HTTPS']) === true OR $_SERVER['HTTPS'] === 'off'">

That worked! Thank you very much!!


All times are GMT. The time now is 06:45 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01918 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (3)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete