Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

Make money selling software. Check this out here

Hosted clickbank mall. Check this out here




   Misc

   Amazon

   Links

    


A PHP pay counter

 

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") ?>

win
ih paycounter example

Now lets see the stats

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

1250 

 


 

 



 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
delete files on a floppy disk(VB)
write a character using cout(C++)
split a file into path info(php)
API disable ctrl alt and del .Not XP or 2000(VB)
change computer name(Visual Basic)
typewriter status bar(Javascript)
Degrees / Radians conversions(PHP)
processor info using WMI(C Sharp)

    




Copyright © 2004 by programmershelp.co.uk