Ads For Guests Only

Any hacks and modifications will be in here...

Ads For Guests Only

Postby Tyler.S » Tue Feb 07, 2012 9:05 am

Ok...round two lol. Here is the code that you will need to display ads to Guests only, and hide them from your logged in members. For this example, I am using Google Ad-Sense. When combined with my "SSL For Members Only Mod", you will be able to offer your members both an Ad-Free and SSL environment without the annoying SSL warnings.

In this case, I am only adding the Google code to the bottomads.php file, but it can be used for any ad placement.

Step 1:

Open bottomads.php (found in the root of DFH)

Step 2:

Find
Code: Select all
<?php
///////////////////////////////////////////////////////////////////////////
//  Product: Daddy's File Host               
//  Version: 1.2                       
//                        
// by DaddyScripts.com                  
//                               
// original source code by Jim (j-fx.ws) and Steven (galaxyscripts.com)
//////////////////////////////////////////////////////////////////////////
?>
<!--Add any ads after this line-->


Step 3:

Add the mod coding. (For this example you will see how I added my Google Ad-Sense code [Info Edited of coarse 8-) ])

Code: Select all
<?php
///////////////////////////////////////////////////////////////////////////
//  Product: Daddy's File Host               
//  Version: 1.2                       
//                        
// by DaddyScripts.com                  
//                               
// original source code by Jim (j-fx.ws) and Steven (galaxyscripts.com)
//////////////////////////////////////////////////////////////////////////
?>
<?php if ($_SESSION['islogged'] <> true) { ?>

<!--Is a Guest...So display ads-->

<script type="text/javascript"><!--
google_ad_client = "YOUR INFO";
/* YOUR INFO */
google_ad_slot = "YOUR INFO";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

               <?php }else{
//Is member...Do not display ads      
}
?>


Feel free to remove my <!--Comments--> as they are not needed for the mod to work.

Step 4:

Fill in your own ad information. Then save and upload.

That's it, your done!

I am still working around with this, so I will reply if I modify it at all. If you run into any issues just reply and we will try to work them out.

That's all for now...
Tyler.S
Premium
 
Posts: 10
Joined: Mon Feb 06, 2012 7:42 am
Location: Ontario, Canada

Re: Ads For Guests Only

Postby SamEA » Wed Mar 07, 2012 9:06 pm

Excellent, well done and good mod :).
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Ads For Guests Only

Postby Silfro » Sun May 13, 2012 9:10 am

and if you want, that only premium wont see the advertisement then do this

look up for
<?php if ($_SESSION['islogged'] <> true) { ?>


and change to
<?php if ($_SESSION['premium'] <> true) { ?>
Silfro
Premium
 
Posts: 11
Joined: Sun May 13, 2012 2:12 am


Return to Hacks and Modifications

Who is online

Users browsing this forum: No registered users and 1 guest

cron