Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    91
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Showing ads only to 20% percent of visitors. Or different ads to another 80% visitors

    Hi guys, how to do this in a php file

    Showing ads only to 20% percent of visitors. Or showing different ads to another 80% visitors

    any way that can work, maybe using time intervals, like the visitors that visit the site at minute 0-12 only that show it, and visitors that visit the site at minute 13-59 is not. Or another methode

    please help or share if you have, this should be easy enough and many people should need it, already googling it but still cant found it
    Whats up

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    Easiest way would be to generate a random number and do it on a 'dice role'

    PHP Code:

    if ( mt_rand ) == )
      
    display_advert();
    else
      
    do_something_else(); 

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by basketmen View Post
    Maybe using time intervals, like the visitors that visit the site at minute 0-12 only that show it, and visitors that visit the site at minute 13-59 is not.

    Take a look at the php date function.

    Untested, might be syntax errors
    PHP Code:
    $minutes date("i"); //i minutes with leading zeros, 00 to 59

    if ($minutes <= 12) {
    // do this
    } else {
    // do this

    Last edited by Len Whistler; 07-31-2012 at 08:02 PM.
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •