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
https://forums.phpfreaks.com/topic/216889-help-with-a-website/
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
https://forums.phpfreaks.com/topic/216889-help-with-a-website/#findComment-1126705
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
https://forums.phpfreaks.com/topic/216889-help-with-a-website/#findComment-1126720
Share on other sites

It turns our I can easily use cron jobs with GoDaddy, so I can sort that out.In regards to the random time, I found this website:

 

http://sqa.fyicenter.com/Online_Test_Tools/Random_Date_Time_Value_Generator.php

 

but it doesnt explain how they get the random times very well.

Link to comment
https://forums.phpfreaks.com/topic/216889-help-with-a-website/#findComment-1126724
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.