I tryed to include a changeing background with an PHP CSS file but even if I try my web page is blank or the background is empty...
The server is based on Linux and is running PHP 7 and Apache 2.
index.php (Version 1)
<link rel="stylesheet" type="text/css" href="./css/background.php.css">
index.php (Version 2)
<body>
<style>
<?php
include("./css/background.php.css");
?>
</style>
</body>
background.php.css
<?php
echo("
@charset "utf-8";
/* CSS Document */
");
error_reporting(E_ALL);
$choicer = rand(1, 9);
if ($choicer == 1) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 2) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 3) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 4) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 5) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 6) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 7) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
if ($choicer == 8) {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
else {
echo('
body{
background-color: #333;
background-image: url("../imgs/bg$choicer.jpg");
background-attachment: fixed;
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
}
');
}
}
}
}
}
}
}
}
?>
I hope some one can help me here with this problem.