OsakaWebbie
Programmer
From a single document root (where all my PHP files are located for a database interface), I have set up code to access client-specific files from another directory (/var/ One of the types of files I get from there is CSS, so that each client can have their own colors and such. Getting the CSS files is no problem - I have:
And in style.php (after security checks) I have:
The problem is how to get images that are specified in the CSS, like background-image. Client-specific images referenced in HTML can be served in a similar way to the CSS files, like:
But that doesn't work in CSS as far as I know. I tried:
But unless I just have a bug in my code, sticking a PHP file reference in CSS doesn't work. Does anyone know how I can do this?
Code:
<link rel="stylesheet" href="style.php" type="text/css" />
Code:
$path = "/var/www/".$_SESSION['client']."/css/";
header("Content-type: text/css");
readfile($path."style.css");
Code:
<img src="getphoto.php?file=whatever">
{in getphoto.php}
$path = "/var/www/".$_SESSION['client']."/photos/";
header("Content-type: image/jpg");
readfile($path.$_GET['file']);
Code:
background-image: url(cssimage.php?file=whatever);
{similar code in cssimage.php with a different path and detecting the mime type}