Im currently writing a voting application in PHP that is totally user-configurable. I have come up with a pretty big problem using GD to create bar charts to create results.
The colours of each bar should be changeable, so I have a configuration file with the hex codes for the colours in. In the PHP image file, I use the following code:
require('../config/conf.php');
$bgcolour[1] = substr($backgroundcolour, 1, 2);
$bgcolour[2] = substr($backgroundcolour, 3, 2);
$bgcolour[3] = substr($backgroundcolour, 5, 2);
$black = ImageColorAllocate($im, "0x".$bgcolour[1], "0x".$bgcolour[2], "0x".$bgcolour[3]);
GD and/or PHP doesnt seem to recognise the fact that i'm using a variable to define colour.
I also have a similar problem setting the expiration date of a cookie. Again, this value is being taken from an external configuration file:
require('../config/conf.php');
setcookie("already_voted", 1, time()+$votewait);
This works fine though if I replace the $votewait variable with a number.
Does anyone know what I am doing wrong?? 😕