mercredi 28 juin 2017

Keep random number for x amount of time

Right now I generate a random number every time a page is reloaded, I use that number to change the background image of my website.

Every page reload is a little too much, how would I only allow the number to change every x minutes?

Code in my header right now is really easy..

$randombg = rand(1,29);

echo '<style type="text/css">
<!--
#header-container{
background: url(images/header-bg' . $randombg . '.jpg) 50% 0;
}
-->
</style>';




Aucun commentaire:

Enregistrer un commentaire