• Hi,

    I need to be able to place a random 8 digit number on my site that automatically changes at 12 pm every night. I have searched for plugins but have not found any that let me do this. If you know of any or how I would go about programing this any help would be greatly appreciated.

    Thanks
    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Edit NVM: Misread.

    Thread Starter Tomw497

    (@tomw497)

    To make it simpler does anyone know of a plugin or program that will automatically post text at a specified time?

    Thangs again

    This is just an idea that may or may not work, you will have to test it out for yourself and make sure it works for you:

    Use the PHP date function to get day of week

    http://www.php.net/manual/en/function.date.php

    When the day of week changes (that will be at midnight) create a new random number.

    Use PHP rand function or mt_rand to generate the 8 digit number

    http://www.php.net/rand

    http://www.php.net/manual/en/function.mt-rand.php

    I find mt_rand is more random, better to use it than rand.

    You havent specified how you want to place it on your site, eg on a few pages, all pages, in the body, in the header, etc and that will depend whether you should write a plugin, a shortcode, or create a page template.

    Keep in mind that midnight will be the midnight on your website server and may not be midnight for a user in a different time zone.

    Hope this helps 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘automated random number generator’ is closed to new replies.