Page 1 of 1

banner system

Posted: Thu Dec 04, 2003 12:59 am
by basdog22
Need help here:

Is there a way that i create a random script that the results will be category depended?

What i mean is:
I want to make a script that will display random banners but not so random... For example:
A customer "customerA" has subsdribed in the banner system at category "1" and another one "customerB" at category "2". CustomerA must have his banner displayed more often than customerB. Lets say 10/10 displays for customerA and 9/10 displays for customerB.

How could i do this?

Posted: Thu Dec 04, 2003 9:15 am
by JAM
Well, there are various ways. The first I thought of is that you could store the 'hits' of a certain banner somewhere (preferably database).
By using those hits, you can recreate your own statistics and make the banners visible based on that.

The below is just a quick example of something that might give you more ideas. Hope it's understandable enough.

Code: Select all

<pre>
<?php
    $one = 15;
    $two = 8;
    $total = $one+$two;
    // show percentage (roughly)
    echo round($one / $total * 100);
    echo '<br>';
    echo round($two / $total * 100);

    echo '<hr>';

    if ($one < 66) { $one++; } // increase the value of banner1...
    else { $two++; } // ...or banner two.

    // re-display the result
    $total = $one+$two;
    echo round($one / $total * 100);
    echo '<br>';
    echo round($two / $total * 100);
?>

Code: Select all

65
35
---
67
33

Posted: Thu Dec 04, 2003 3:29 pm
by basdog22
Say i have 5 image holders to put 10 banners...

1-3 banners are category 1(pay more)
4-8 banners are category 2(<1)
9-10 banners are category 3(<2)

a script to display random banners but with respect to those that pay more??? :wink: :wink: :wink: