This topic is locked

Randomized login background

2/25/2015 09:29:21
PHPRunner General questions
S
sickacid author

Hi, I want to change login background (randomized). I've take some ispiration by http://xlinesoft.com/blog/2014/10/31/random-page-background-halloween-edition/

and I've done this code:
Custom CSS

/ login page background /

body.function-login {

height:100%;

background-image:url("http://192.168.2.108/gestione2015v80/output/images/'.$_SESSION["background"].'";);

...
Login page -> Before Display
$bg = array('sfondo01.jpg', 'sfondo02.jpg', 'sfondo03.jpg', 'sfondo04.jpg', 'sfondo05.jpg', 'sfondo06.jpg', 'sfondo07.jpg' );

$i = rand(0, count($bg)-1); // generate random number size of the array

$_SESSION["background"]= "$bg[$i]";
I think the mistake is in the session var. Have U any suggestion to fix my code? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=22992&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />

Sergey Kornilov admin 2/25/2015

You cannot use PHP variables in Custom CSS code. Custom CSS code goes directly to .css file and PHP variables won't work there. Use step by step instructions provided in that article.