I just started reading a guide on here last night at around 12am, so as you can guess, I really don't have that much skill in php :P
Anyway, Im using a banner service at free-banners.com (http://affiliate.free-banners.com/cgi-bin/adserver/affiliate?iid=453013). At this site, you get a user name, yada yada yada, you place a banner on your site, and for every view a banner at your site gets, one of your banners gets displayed at someone else's site. Anyways, for their html code you need on your site, they say that for each page you want it to display on, you need to change the "page=#" code. That way, you get a credit for each page. So, for a forum, I created 50 different codes with the ad mod which will randomly switch around, then I realized that I could just maybe use a simple php code to change the "page=#" thing easily. So what I did was I put the $number to 54, I made the html code read "$number" rather than 54, and I want it to gradually increase by 1 every hit the page gets. I have no clue if this is possible, so that's why I'm asking, is this possible to increase the number by 1 every hit it gets? This is what I have:
<?
$number = 54; //This is the page number, I want this to gradually increase by 1.
echo "<!-- Begin Free-Banners v3.0 HTML Tag. All Rights Reserved. Patent Pending. -->
<center>
<style>.FBText { FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #376c8c; FONT-FAMILY: Arial, Helvetica, San-Serif; TEXT-DECORATION: none; } A.FBText:hover { text-decoration: underline; }</style>
<table bgcolor=#376c8c border=0 cellpadding=0 cellspacing=1 width=468><tr bgcolor=#ffffff><td valign=top colspan=2>
<iframe src=http://ads.free-banners.com/cgi-bin/adserver/banner?iid=453013&istatus=3&iogeography=53346304&iocategory=135135232&iolanguage=26&ifilter=2&type=2&page=$number hspace=0 vspace=0 width=468 height=60 marginwidth=0 marginheight=0 frameborder=0 scrolling=no>
<a href=http://ads.free-banners.com/cgi-bin/adserver/click?iid=453013&istatus=3&iogeography=53346304&iocategory=135135232&iolanguage=26&ifilter=2 target='_top'><img
src=http://ads.free-banners.com/cgi-bin/adserver/banner?iid=453013&istatus=3&iogeography=53346304&iocategory=135135232&iolanguage=26&ifilter=2&type=1&page=$number width=468 height=60 border=0 alt='Free-Banners'></a></iframe>
</td></tr>
<tr bgcolor=#ffffff><td>
<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td width=90><a href=http://www.bizcentral.com/ target=_top><img alt='Business' src=http://ads.free-banners.com/images/bizcentral.gif width='90' height='8' border=0></a></td>
<td width=378 align=center class=FBText><a href=http://www.affiliatebot.com/ class=FBText target=_top>Affiliate Programs</a> • <a href='http://coupons.foolfind.com/' class=FBText target=_top>Deals</a> • <a href=http://www.friendsearch.com/ class=FBText target=_top>Personals</a> • <a href=http://www.advertisingz.com/ class=FBText target=_top>Advertising</a> • <a href=http://www.cheaprated.com/ class=FBText target='_top'>Shopping</a>
</td></tr></table></td></tr></table>
</center>
<!-- End Free-Banners v3.0 HTML Tag. All Rights Reserved. Patent Pending. -->";
?>
I'm a complete noob at this, I just started reading about php last night :P
Nevermind, I dont need help anymore, I took apart a counter code and I figured out a way to do this, thanks anyway!
<?
//Starting count.php\\
if (file_exists('count_file.txt'))
{
$fil = fopen('count_file.txt', r);
$dat = fread($fil, filesize('count_file.txt'));
$dat+1;
fclose($fil);
$fil = fopen('count_file.txt', w);
fwrite($fil, $dat+1);
}
else
{
$fil = fopen('count_file.txt', w);
fwrite($fil, 1);
echo '1';
fclose($fil);
}
//Starting Ads\\
echo "<!-- Begin Free-Banners v3.0 HTML Tag. All Rights Reserved. Patent Pending. -->
<center>
<style>.FBText { FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #376c8c; FONT-FAMILY: Arial, Helvetica, San-Serif; TEXT-DECORATION: none; } A.FBText:hover { text-decoration: underline; }</style>
<table bgcolor=#376c8c border=0 cellpadding=0 cellspacing=1 width=468><tr bgcolor=#ffffff><td valign=top colspan=2>
<iframe src=http://ads.free-banners.com/cgi-bin/adserver/banner?iid=453013&istatus=3&iogeography=53346304&iocategory=135135232&iolanguage=26&ifilter=2&type=2&page=$dat hspace=0 vspace=0 width=468 height=60 marginwidth=0 marginheight=0 frameborder=0 scrolling=no>
<a href=http://ads.free-banners.com/cgi-bin/adserver/click?iid=453013&istatus=3&iogeography=53346304&iocategory=135135232&iolanguage=26&ifilter=2 target='_top'><img
src=http://ads.free-banners.com/cgi-bin/adserver/banner?iid=453013&istatus=3&iogeography=53346304&iocategory=135135232&iolanguage=26&ifilter=2&type=1&page=$dat width=468 height=60 border=0 alt='Free-Banners'></a></iframe>
</td></tr>
<tr bgcolor=#ffffff><td>
<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td width=90><a href=http://www.bizcentral.com/ target=_top><img alt='Business' src=http://ads.free-banners.com/images/bizcentral.gif width='90' height='8' border=0></a></td>
<td width=378 align=center class=FBText><a href=http://www.affiliatebot.com/ class=FBText target=_top>Affiliate Programs</a> • <a href='http://coupons.foolfind.com/' class=FBText target=_top>Deals</a> • <a href=http://www.friendsearch.com/ class=FBText target=_top>Personals</a> • <a href=http://www.advertisingz.com/ class=FBText target=_top>Advertising</a> • <a href=http://www.cheaprated.com/ class=FBText target='_top'>Shopping</a>
</td></tr></table></td></tr></table>
</center>
<!-- End Free-Banners v3.0 HTML Tag. All Rights Reserved. Patent Pending. -->";
?>
flat-file counters are not 100% accurate because multiple people could try to write to the same file at the same time.
Count = 10
First person reads file
Second person reads file
First person saves 10+1
Second person saves 10+1
For this reason its best to use a mysql database and increase the figure by 1, without reading it.
For this particular thing though, thats not a big deal, 2 people reading the same page# will still count as a credit from each. It's also not a big deal if it goes up 2, I just need the number changing so that 1 person wont see the same number 2 times
No, it won't count EACH.
As in the above example.
Both would write 11, so in effect you aren't counting 50% of hits.
And thats just with 2. Alot of the time you could have 10-20 or more requests at the same time, in which could you would only be counting 5% of hits