Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Random login screen images, based on time.
<?php
$loginImages = ['login-bg-11.jpg', 'login-bg-12.jpg', 'login-bg-13.jpg', 'login-bg-14.jpg', 'login-bg-15.jpg', 'login-bg-16.jpg', 'login-bg-17.jpg'];
$seed = srand(floor(time() / (60*60*24)));
$randomizedSeedNumber = rand(0, count($loginImages)) % 100;
$randomizedLoginImage = $loginImages[$randomizedSeedNumber]??$loginImages[0];
echo $randomizedLoginImage;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.