PHP Classes

File: index

Recommend this page to a friend!
  Classes of Lee J   Ads and content limit   index   Download  
File: index
Role: Example script
Content type: text/plain
Description: example file
Class: Ads and content limit
Keeps track of visitors to show limited ads a day
Author: By
Last change: better notes and example setup.
Date: 13 years ago
Size: 5,573 bytes
 

Contents

Class file image Download
<?php
/*

name: index.php
description: Example file for php ads limiter. shows how to use the class.
release date: 28-12-08
updated: 11-02-13
site: www.freakcms.com
Maker: lee johnstone
Support: info@freakcms.com

--------------------------------------------------------------------------------------------------------------------------

YOU MAY NOT
1. Use this for commercial usage
2. Claim the code as your own
3. Remove any copyrights from its original authors

YOU MAY

1. Upgrade, Update, Adjust, Modify this script, providing you keep all original comments.
2. Redistribute this code under the same license and none other.
3. Modify and use this script on your own site as you wish, providing you keep the copyright markings from original authors.


More information here.
http://www.freakcms.com/licensing.php

--------------------------------------------------------------------------------------------------------------------------

*/
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Ads And Content limiter DEMO | Freakcms.com</title>
<meta name="keywords" content="adsense, limiter, adsense limiting, ads limiter, content block, content limiter, contents and ads blocker, make money with adsense, adsense tools, safe to use, free, open source, freakcms.com, FCMS, demo, lee johnstone">
<meta name="description" content=" <p>Ads And Content limiter 1.2 is a all in one tool to protect ads and content from unwanted views and hits.</p>
<p>If a user comes to your site and views 20 pages and you have 3 ads on each page that would be 60 wasted ads as the user has been ignoring them.</p>
    <p>With this class you can control the amount of views over an exact amount of time for a users IP Address.</p>
    <p>You can also nominate IP Address's to be constantly blocked to prevent administration or even bad users from viewing the ads or content altogether. <br>
      This is achieved via a basic .txt file.</p>
    <p>This class is really simple to set up and takes no brains at all.<br>
      There is 3 variables and a text file.</p>
<p>Variables can be pre-set or hard coded into the class file.</p>">
<meta name="author" content="Lee Johnstone">
<meta name="ROBOTS" content="ALL">

<style>
body {
    background-color: #7F7F7F;
}
div.main {
    background-color: #C9C9C9;
    color:#333;
    margin:0 auto;
    margin-top:200px;
    padding: 20px 20px 20px 20px;
    border:#000 thin outset;
    border-radius:10px;
    width:50%;
    text-align:center;
}
div.menu {
    float:right;
    margin-top:0px;
    display:block;
}
a {
    color:#06F;
    text-decoration:none;
    font-family:Georgia, "Times New Roman", Times, serif;
    font-size:16px;
}
footer {
    margin:0 auto;
    text-align:center;
    font-size:10px;
    }
a.footer {
    font-size:10px;
    color:#03F;
}
</style>
</head>
<body>
<?php

   
// include the mysql data base connection
   
require_once('class.MySQL_Connect.php');
   
// start the mysql data base connection
   
$sql = new MySql_Con();
   
// Open the MySQL connection
   
$sql->GetMyConnection('DATABASE_HOST','USER_NAME','USER_PASSWORD','DATABASE_NAME');
   
// include the ads class
   
require_once('class.Ads_Limiter.php');
   
// start the ads control class
   
$ads = new ControlAds();
   
//////////////////////////////
    // amount = "some amount";//
    // some amount = int //
    // how many views does a //
    // user get before being //
    // blocked //
   
$ads->amount = '5'; //
    //////////////////////////////
    //////////////////////////////
    // block_type = "type"; //
    // //
    // This is the type of //
    // amount of time you would//
    // like to set. //
    // ------- //
    // Type's //
    // ------- //
    // years //
    // months //
    // days //
    // minutes //
    // -------- //
   
$ads->block_type = 'minutes';
   
//////////////////////////////
    //////////////////////////////
    // block_time = "amount"; //
    // This is the amount you //
    // would like for your Set //
    // type. Be sure that the //
    // amount matchs the type. //
    // -------------------- //
    // Amounts //
    // Type Amount //
    // -------------------- //
    // years | 1-66 //
    // months | 1-12 //
    // days | 1-30 //
    // minutes | 1-59 //
    // -------------------- //
   
$ads->block_time = '1';
   
//////////////////////////////
    // update ips and user status
   
$ads->UpdateAdsViews();
   
// if your finished with the sql we can shut the connection
   
$sql->CleanUpDB();
   
// check if a user can see content
   
echo '
    <div class="main">
    <div class="menu"><a href="http://freakcms.com/">Home Page</a>
    |<a href="http://freakcms.com/php_ads_limiter.php">Information and Usage</a></div>
    <h1>Ads And Content limiter DEMO</h1>
    <p>Fresh the page <font color=blue>'
.$ads->amount.'</font> times to activate the block</p>
    <p>Current limit settings '
.$ads->block_time.' '.$ads->block_type.'</p>
    <p>'
;
if(
$ads->showad == true){
   
// display content to users
   
echo 'You can view this Content';
    }else{
    echo
'<strong>You have to wait <font color=red>'.$ads->block_time.'</font> '.$ads->block_type.' before the content will be viewable again.</strong>';
    }
    echo
'</p></div>
'
;
?>
<footer>
    <p>Ads And Content limiter DEMO Created by Lee Johnstone<br>
    &copy; <a class="footer" href="http://freakcms.com">freakcms.com</a> 2007-2011<br>
    Last Updated <time><!-- #BeginDate format:Fr1a -->22/03/11 12:07 PM<!-- #EndDate -->-></time></p>
</footer>
</body>
</html>