Dynamically Load Background image Php Script

Dynamically Load Background image Php Script


Dynamically Load Background image Php Script in this tutorial i will show you how to make a web page with dynamic backfround change every time this page is loaded as I did with this page .

let's begin This Tutorial :

first you have to create a text file name it backgroundchanger.txt and make a list of html codes one by line you can choose from this list :

By Color Or Html Code color :

<body style="background-color:powderblue;">
<body style="background-color:#deefff;">

Load Background By images links :

<body background="URL">
 

IN This Tutorial i choose Html Code color : <body style="background-color:#ffffff;">

So i make a list with many code like this in my backgroundchanger.txt:
<body style="background-color:#0ff0ff;">
<body style="background-color:#eeeeee;">
<body style="background-color:#ffefff;">

Save And upload backgroundchanger.txt in your server root and use this php code :
<?php
$file= "backgroundchanger.txt";
$bglist = file($file);
srand((double)microtime()*1000000);
$randombg = rand(0, count($bglist)-1);
$a=2000;
echo "<font color=Blue size='6pt'>$bglist[$randombg]</font>";
?>
Previous
Next Post »