Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Blog
Books
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
software directory
dvd information
golfing products
 Downloads
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


Paycounter


Paycounter

This example shows how to create a paycounter for your site , with this you can put your affiliate banners and still track hits to your site . This script is in 2 parts . The counter and the file for viewing stats.

Part 1 : The counter

<?php
$counter_file = ("paycounter.txt");
$visits = file($counter_file);
$visits[0]++;
$fp = fopen($counter_file , "w");
fputs($fp , "$visits[0]");
fclose($fp);
//part 2 the banner display part
//some sample banners , use your own here
$url = array("http://www.shareasale.com/m-redirect.cfm?bannerID=7859&userID=16893&merchantID=1610&urllink=&afftrack=",
"http://www.shareasale.com/m-redirect.cfm?bannerID=2314&userID=16893&merchantID=917&urllink=&afftrack=",
"http://www.shareasale.com/m-redirect.cfm?bannerID=2091&userID=16893&merchantID=203&urllink=&afftrack=",
"http://www.shareasale.com/m-redirect.cfm?bannerID=7190&userID=16893&merchantID=2434&urllink=&afftrack=");
//the urls for the links , replace these also
$imgsrc = array("http://www.shareasale.com/banners/ACF3C9E.gif",
"http://www.shareasale.com/banners/ACF45D5.gif",
"http://www.shareasale.com/banners/120_60_1.gif",
"http://www.shareasale.com/banners/box_half_banner2.gif");
//this is alt tags which help with search engines and
//also people who switch off their images in their browsers
$alt = array("get your domain name appraised now",
"win prizes and cash",
"The ONLY Pay per click search engine online with bids starting at $.001",
"Time for a change? Make a plan with Career Advantage");
//generate a random number
srand((double)microtime() * 1000000);
$rn = (rand()%4);
//display the banner and link . This opens in a new window
echo "<center>";
echo ("<a href=$url[$rn] target=\"new\"><img src =$imgsrc[$rn] alt =$alt[$rn]></a>");
echo "<br>";
echo ("ih paycounter example");
echo "</center>";
?>

Part 2 : Show stats

<?php
$counter_file1 = ("paycounter.txt");
$visits1 = file($counter_file1);
$fp1 = fopen($counter_file , "r");
fclose($fp1);
echo $visits1[0];
?>

Demonstration

  The counter itself display with the following code

<?php include("paycounter.php") ?>

The
paycounter example

Now lets see the stats

<?php include("paystats.php") ?>

4515 




Books
 Sponsors
 Random Code
Counter example(application)
If Else statement(beginner)
getprotobynumber function(functions)
 Random Article
  Network
Programming resources
Tutorials directory
Clickbank mall
sell software
Free auctions, low cost stores
UK products
US products
Gambling directory
Sexy free wallpapers
Hosting resources
ASP site
DVD site
Domain names
Dating site
Software directory
Maxi directory
bigarticle : free articles




beginners PHP Copyright © 2004 onwards by beginnersPHP.