Your Ad Here

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




 Sponsors
 Links
low cost magazines
dvd information
programmershelp
 Downloads
dzphp editor
EasyPHP
mysql_phpgenerator
php-studio-trial
phpdesigner_7_2_5
phpMyAdmin-3.4.3.2
/phptriad2-2-1
phpxedit_321
rapidphp 2011
WampServer2.1d-x64
WampServer2.1e-x32
xampp-win32-1.7.4-VC6-installer
xampplite-win32-1.7.3
 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") ?>

Time
paycounter example

Now lets see the stats

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

9057 




Books
 Sponsors


 Random Code
strip html tags from some text(string)
Check if an image exists(image)
Display gravatars(Wordpress)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials
Get PHP
Programmers help




beginners PHP Copyright © 2004 onwards by beginnersPHP.