$code="524";
$filepath="/assets/$code/";
$file="";
if(@fopen($path,"r")){
// code
// replace function here (ill do this)
}
echo '<a href="link.php?go=$file">your colour is: </a>';
At the moment, the code is always going to be 3 digits, it will always have a subfolder with only an underscore and color and then inside that one file..
PHP has a file_exists()
function;
if ( file_exists( '/assets/' . $code . '_blush/' . $code . '_blush.jpg' ) ) {
// ...
}