Jump to content

Help with a website...


byrne86

Recommended Posts

Hi, I haven't used any php for a while, but i am making a website, and i need some advice on how to do the following:

 

I want the website to change an image once every 24 hours, the image will revert back to the original image after 2 minutes.

 

Does anyone have an idea how I could start doing this?

Link to comment
Share on other sites

I'm thinking along these lines:

 

One script runs on a cron job at midnight daily, generates the random time for the image to display for that day, and inserts that value in a database.

 

The script that calls the image can then check the database, and if the time is between the random time and 2 minutes later, the alternate image is the one that gets served.

Link to comment
Share on other sites

A cron job is a scheduled action on the server (I think it's called a 'scheduled task' in WinD'ohs). I've never had to generate a random time, so I haven't put much thought into it. Initially, I'm thinking you could generate a random between 0-23, and one from 00-59, and concatenate them into a time value, but somehow I'm not sure that's a good idea. Maybe someone else has a better way . . .

Link to comment
Share on other sites

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.