Skip to content

Instantly share code, notes, and snippets.

@jahidulsaeid
Created November 10, 2018 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jahidulsaeid/e7897e2226d0ba7ce6be9dd4fa04230e to your computer and use it in GitHub Desktop.
Save jahidulsaeid/e7897e2226d0ba7ce6be9dd4fa04230e to your computer and use it in GitHub Desktop.
Everytime refresh background change
<?php
$backgrounds = array
(
array
(
'image' => 'images/42.png',
'url' => 'http://google.se'
),
array
(
'image' => 'images/56.jpg',
'url' => 'http://disney.com'
)
);
$choice = $backgrounds[array_rand($backgrounds)];
$image = $choice['image'];
$url = $choice['url'];
?>
<body style="background:url('<?php echo $image; ?>'); background-size: cover;" onclick="window.location = '<?php echo $url; ?>' ">
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment