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?
banner system
Moderator: General Moderators
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.
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