
Originally Posted by
GreggH
Hi,
Sorry I will try to explain a bit better. I have got a bit further in my attempt since i wrote that but still not got it working yet.
Lets say for example I have 50 websites which are all identical except the details that are processed in the form are sent to the owners of the 50 websites. The I have 1 advertising on google that when someone clicks on that advertising they get directed to a php processing page which in turn will redirect them to the 1st site out of 50, then when the next person clicks on the advertising they will get redirected to the 2nd site out of the 50 and that will go on until all 50 sites have been visited and then the cycle will repeat.
What i have kinda of worked out so far is that if I have a counter which I have done in a txt file which updates +1 everytime someone visits, then i have an associative array which would associate each number to a different url then redirect based on that. The problem i have been having at the moment is I cant get the count to go back to the start again it just keeps going up. This is what i have for my count so far.
PHP Code:
<?php
$File = "counter.txt";
$handle = fopen($File, 'r+') ;
$data = fread($handle, 512) ;
if ($count = 50){
$count = 1;
fseek($handle, 0) ;
fwrite($handle, $count) ;}
else
$count = $data + 1;
print "You are visitor number ".$count;
fseek($handle, 0) ;
fwrite($handle, $count) ;
fclose($handle) ;
?>
I haven't even started with the array yet. Maybe you would know an easier way to do this.
Thanks
hey
so you want to split your paid traffic between 5 or more sites?
if yes, i write an example for u. try this
PHP Code:
<?php
$sites_list = array(
'http://www.google.com',
'http://www.aol.com',
'http://www.yahoo.com',
'http://www.msn.com',
'http://www.meebo.com');
$counter_text_file = "counter.txt";
$present = file_get_contents($counter_text_file);
$lastone = intval($present) + 1;
$count = count($sites_list);
if($present < ($count-1))
{
//file_put_contents("counter.txt", $lastone);
$handle = fopen($counter_text_file, 'w');
fwrite($handle, $lastone);
fclose($handle);
}
else
{
//file_put_contents("counter.txt", 1);
$handle = fopen($counter_text_file, 'w');
fwrite($handle, 0);
fclose($handle);
}
print "You are being redirect to ".$sites_list[ $present ];
?>
Bookmarks