Jump to content

Recommended Posts

I see no reason why it wouldn't be possible.

I'm very curious HOW you make something like this, how do you START. I have searched for existing scripts, but there aren't.

 

If someone visits a redirect, his visit get lost. So you can't count this.

And if you CAN count this, how do you tell the script to stop redirect the visitors to page B.

 

I need a plan, because I have no idea.  :confused:

 

You could store the number of users redirected in a flat-file.

 

$num = file_get_contents('counter.txt');
file_put_contents('counter.txt', $num + 1);
if($num <= 50)
     header('Location: a.html');
else
     header('Location: b.html');

One of the ways would be to store the number of visits into a file.

Script would work like this (psudocode)

 


read number of visits from file
(if > 50) {
redirect to B 
}else {
increase number of visits by 1 and save to file
redirect to A
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.