1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

auto rotate number

Discussion in 'PHP & Perl' started by mylikes786, Jan 31, 2014.

  1. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    I created traffic exchange site
    i want show fake status total site added
    it should work like. make a file in which i can put random number. and in total site added it randomly add any of those number in file after every 5 - 10 sec. and after every 24 hrs it start from 0

    auto rotate number like this site
    addmefast.com

    live exchange
     
  2. innozemec

    innozemec Jr. VIP Jr. VIP

    Joined:
    Aug 19, 2011
    Messages:
    5,290
    Likes Received:
    1,799
    Location:
    www.Indexification.com
    Home Page:
    that way too hard for the job you wanna do.. amf for example is using a simple javascript code to handle that number rotation

    you can find one for sure using a google search

    edit: you wanna tell me you coded a whole exchange website with all the necessary php/javascript code and mysql databases and don't know to do this simple task? come on...
     
  3. mypmmail

    mypmmail Junior Member

    Joined:
    Jan 31, 2008
    Messages:
    111
    Likes Received:
    27
    You will definitely need javascript to do the number rotation thingy because it is shown on the browser end.

    As for how to reset the number every 24 hours, you can do it 2 ways.
    - use cookie to store the starting number and use it to continue when user opens the browser again
    an example of cookie is shown in the thread
    www.blackhatworld.com/blackhat-seo/...-users-submitting-same-id-more-than-once.html

    - use ajax or any server script where the number is stored on the server and the number on the server reset once every 24 hours
    I would prefer this method because it involve less storing and retrieving and if the number is real number, this will definitely be a more accurate way.

    hth
     
  4. mandingo

    mandingo Newbie

    Joined:
    Jan 29, 2014
    Messages:
    10
    Likes Received:
    2
    I agree with mypmmail's second suggestion. You will need to store the value separately on the server. With your implementation, make sure the traffic display is the same value across multiple computers in case the visitor decides to check. You can use AJAX to read from a text file you manually edit. Then you can establish a cron job with your server to run a PHP script that resets the counter file back to 0. This can get tricky if you have many different sites. If so, you might as well put all the sites in an SQL database with a related initial traffic value.
     
  5. blackboat

    blackboat Newbie

    Joined:
    May 8, 2012
    Messages:
    29
    Likes Received:
    4
    Occupation:
    CEO
    Location:
    BHW
    Much more easier to just use the JS that addmefast is using, and modify it a bit to get what you want with that reset to 0 :p