Sander Tromp
Feb 6 2004, 07:12 AM
When someone is buying some advertisements from your site and he aint a member,
He can't check stats.
But if you add a something in the client ID (in this example: x23advertiser and must be unique for each advertiserser, but don't change "x23").
And make a page and call it something like adstats2.php
Then just go to this site:
http://www.yourdomain.com/pages/adstats2.p...iser=advertiserYou will be able to see the stats.
Here is de code for adstats2.php:
| CODE |
<? include("setup.php");?> <? include("header.php");?> <br> <table border=0 align="center"> <tr> <td valign=top> <table width=100% border=1 bgcolor=#eeeeee> <tr bgcolor=gray> <td align=center colspan=4><font color="ffffff"><b>Email Ads</b></font></td> </tr> <tr> <th align=center> <font color="000000" size="2">Ad Name</font></th> <th align=center><font color="000000" size="2">Clicks</font></th> <th align=center><font color="000000" size="2">Expires</font></th> <th align=center><font color="000000" size="2">Last viewed</font></th> </tr> <? $L='<tr><td>'; $M='</td><td>'; $R='</td></tr>'; $S='dont_show'; $cols=30; $rows=3; { global $scripts_url,$HTTP_SESSION_VARS; $results=@mysql_query("select * from " . mysql_prefix . "email_ads where id='x23$_GET[advertiser]' order by description"); while ($row=@mysql_fetch_array($results)) {if ($row[run_type] == 'date') {$row[run_quantity]=mytimeread($row[run_quantity]);} else {$row[run_quantity]=number_format($row[run_quantity], 0);} $row[clicks]=number_format($row[clicks], 0); if ($row[run_quantity] == 0) {$row[run_quantity]='';} if ($row[run_type] == ongoing) {$run_type='Never';} if ($row[run_type] == clicks) {$run_type='clicks';} if ($row[run_type] == date) {$run_type='';} echo $L . '<a href=' . $scripts_url . 'runner.php?REDIRECT=' . rawurlencode( $row[site_url]). ' target=_blank>' . $row[description] . '</a>' . $M . $row[clicks] . $M . $row[run_quantity] . ' ' . $run_type . $M . mytimeread( $row[time]). $R; } } ?> </table>
<table width=100% border=1 bgcolor=#eeeeee> <tr bgcolor=gray> <td align=center colspan=4><font color="ffffff"><b>HTML Ads</b></font></td> </tr> <tr> <th align=center><font color="000000" size="2">Ad Name</font></th> <th align=center><font color="000000" size="2">Views</font></th> <th align=center><font color="000000" size="2">Expires</font></th> <th align=center><font color="000000" size="2">Last viewed</font></th> </tr> <? $L= "<tr><td>"; $M= "</td><td>"; $R= "</td></tr>"; { global $HTTP_SESSION_VARS; $results=@mysql_query("select * from " . mysql_prefix . "rotating_ads where id='x23$_GET[advertiser]' and site_url='' and image_url='' and html!='' order by description"); while ($row=@mysql_fetch_array($results)) { if ($row[runad] > 1) {$row[time]=$row[runad];} if ($row[time] == 0) {$row[time]='00000000000000';} if ($row[run_type] == 'date') {$row[run_quantity]=mytimeread($row[run_quantity]);} else {$row[run_quantity]=number_format($row[run_quantity], 0);} $row[views]=number_format($row[views], 0); if ($row[run_quantity] == 0) {$row[run_quantity]='';} if ($row[run_type] == ongoing) {$row[run_quantity]='Never';} if ($row[run_type] == views) {$row[run_quantity]='views';} echo $L . "$row[description]" . $M . "$row[views]" . $M . $row[run_quantity] . $M . mytimeread( $row[time]). $R; } } ?> </table>
<table width=100% border=1 bgcolor=#eeeeee> <tr bgcolor=gray> <td align=center colspan=6><font color="ffffff"><b>Banner Ads</b></font></td> </tr> <tr> <th align=center><font color="000000" size="2">Ad Name</font></th> <th align=center><font color="000000" size="2">Views</font></th> <th><font size="2">Clicks</font></th> <th><font size="2">CTR</font></th> <th align=center><font color="000000" size="2">Expires</font></th> <th align=center><font color="000000" size="2">Last viewed</font></th> </tr> <? $L="<tr><td>"; $M="</td><td>"; $R="</td></tr>"; $S='not'; $C='Clicks'; $V='Views'; { global $scripts_url,$HTTP_SESSION_VARS; $results=@mysql_query("select * from " . mysql_prefix . "rotating_ads where id='x23$_GET[advertiser]' and site_url!='' and image_url!='' order by description"); while ($row=@mysql_fetch_array($results)) {if ($row[runad] > 1) {$row[time]=$row[runad];} if ($row[time] == 0) {$row[time]='00000000000000';} if ($row[run_type] == 'date') {$row[run_quantity]=mytimeread($row[run_quantity]);} else {$row[run_quantity]=number_format($row[run_quantity], 0);} $row[views]=number_format($row[views], 0); $row[clicks]=number_format($row[clicks], 0); if ($row[views]) {$ctr=number_format($row[clicks] / $row[views], 3). " to 1";} if ($row[run_quantity] == 0) {$row[run_quantity]='';} if ($row[run_type] == 'ongoing') {$run_type=Never;} if ($row[run_type] == 'date') {$run_type='';} if ($row[run_type] == 'clicks') {$run_type=Clicks;} if ($row[run_type] == 'views') {$run_type=Views;} echo $L . '<a href=' . $scripts_url . 'runner.php?REDIRECT=' . rawurlencode( $row[site_url]). ' target=_blank>' . $row[description] . '</a>' . $M . $row[views] . $M . $row[clicks] . $M . $ctr . $M . $row[run_quantity] . ' ' . $run_type . $M . mytimeread( $row[time]). $R; } } ?> </table>
<table width=100% border=1 bgcolor=#eeeeee> <tr bgcolor=gray> <td align=center colspan=6><font color=ffffff><b>Paid To Click Ads</b></font></td> </tr> <tr> <th align=center><font color="000000" size="2">Ad Name</font></th> <th align=center><font color="000000" size="2">Views</font></th> <th><font size="2">Clicks</font></th> <th><font size="2">CTR</font></th> <th align=center><font color="000000" size="2">Expires</font></th> <th align=center><font color="000000" size="2">Last viewed</font></th> </tr> <? $L="<tr><td>"; $M="</td><td>"; $R="</td></tr>"; $C='Clicks'; $V='Views'; { global $scripts_url,$HTTP_SESSION_VARS; $results=@mysql_query("select * from " . mysql_prefix . "ptc_ads where id='x23$_GET[advertiser]' order by description"); while ($row=@mysql_fetch_array($results)) { if ($row[run_type] == 'date') {$row[run_quantity]=mytimeread($row[run_quantity]);} else {$row[run_quantity]=number_format($row[run_quantity], 0);} $row[views]=number_format($row[views], 0); $row[clicks]=number_format($row[clicks], 0); if ($row[views]) {$ctr=number_format($row[clicks] / $row[views], 3). " to 1";} if ($row[run_quantity] == 0) {$row[run_quantity]='';} if ($row[run_type] == 'clicks') {$run_type=clicks;} if ($row[run_type] == 'views') {$run_type=view;} if ($row[run_type] == 'date') {$run_type='';} if ($row[run_type] == 'Ongoing') {$run_type=never;} echo $L . '<a href=' . $scripts_url . 'runner.php?REDIRECT=' . rawurlencode( $row[site_url]). ' target=_blank>' . $row[description] . '</a>' . $M . $row[views] . $M . $row[clicks] . $M . $ctr . $M . $row[run_quantity] . ' ' . $run_type . $M . mytimeread( $row[time]). $R; } } ?> </table>
<table width=100% border=1 bgcolor=#eeeeee> <tr bgcolor=gray> <td align=center colspan=6><font color=ffffff><b>Paid To Sign-Up Ads</b></font></td> </tr> <tr> <th align=center><font color="000000" size="2">Ad Name</font></th> <th align=center><font color="000000" size="2">Views</font></th> <th><font size="2">Sign-Ups</font></th> <th><font size="2">Sign-up Ratio</font></th> <th align=center><font color="000000" size="2">Expires</font></th> <th align=center><font color="000000" size="2">Last viewed</font></th> </tr> <? $L="<tr><td>"; $M="</td><td>"; $R="</td></tr>"; $S='dont_show'; $C='Sign-Ups'; $V='Views'; { global $scripts_url,$HTTP_SESSION_VARS; $results=@mysql_query("select * from " . mysql_prefix . "pts_ads where id='x23$_GET[advertiser]' order by description"); while ($row=@mysql_fetch_array($results)) { if ($row[run_type] == 'date') {$row[run_quantity]=mytimeread($row[run_quantity]);} else {$row[run_quantity]=number_format($row[run_quantity], 0);} $row[views]=number_format($row[views], 0); $row[signups]=number_format($row[signups], 0); if ($row[views]) {$ctr=number_format($row[signups] / $row[views], 3). " to 1";} if ($row[run_quantity] == 0) {$row[run_quantity]='';} if ($row[run_type] == 'signups') {$run_type=signups;} if ($row[run_type] == 'views') {$run_type=views;} if ($row[run_type] == 'ongoing') {$run_type=never;} echo $L . '<a href=' . $scripts_url . 'runner.php?REDIRECT=' . rawurlencode( $row[site_url]). ' target=_blank>' . $row[description] . '</a>' . $M . $row[views] . $M . $row[signups] . $M . $ctr . $M . $row[run_quantity] . ' ' . $run_type . $M . mytimeread( $row[time]). $R; } }
?> </table>
</td> </tr> </table> <br> <? include("footer.php");?>
|
For a demo:
http://www.gold4less.net/pages/adstats3.ph...hp?advertiser=1I'm still in the learning process, so i don't know if it's written correctly, but at least it's working

Edited: lightsphynx pointed me out on a privacy-issue. Edited the script a little
lightsphynx
Feb 6 2004, 08:51 PM
That's a good idea, however you've left yourself open for anybody to view anybody's ad stats. It's not too much of a problem, unless you run accoss a hacker who's looking for somebody with $$ to try to hack or what not. At any rate you really don't want the world to be able to browse any and everybody's stuff. So Here's a fix for you. Add a prefix to every non-member ad username. Something like 89x_Advname. The prefix should be something that nobody would use as a username. Then build it in your code like this:
results=@mysql_query("select * from " . mysql_prefix . "ptc_ads where id='89x_".$_GET[advertiser]."' order by description");
You would still link it with the advertisers name ?blah=advname and everything will work fine, and people can't lookup a specific users info.
Sander Tromp
Feb 7 2004, 05:36 AM
Wow, thanks for reporting.
Will change it later today

(just having a 15min-brake

)