. */ // call: photo.php?id=$id include("./../config.php"); include("./../include/mysql.php"); include("./../include/globals.php"); include("./../include/functions.php"); if( isset($_GET['candidate']) ) { $query = "SELECT `FirstName`, `LastName`, `photo` FROM `candidates` WHERE `id` = " . addslashes(get_int('id')); if( !isset($_SESSION['sess_uid']) || $_SESSION['sess_uid'] <= 0 ) { $query .= " AND `Approved`='yes'"; } }elseif( isset($_SESSION['sess_uid']) && $_SESSION['sess_uid'] > 0 ) { $query = "SELECT `FirstName`, `LastName`, `photo` FROM `applications` WHERE `id`=" . addslashes(get_int('id')); } if( isset($query) && @mysql_num_rows( $res=doquery($query) )==1 ) { $row=mysql_fetch_array($res); if( strlen($row['photo'])>0 ) { header("Content-type: image/jpeg"); header("Content-disposition: inline; filename=\"Photo ".$row['FirstName']." ".$row['LastName'].".jpg\""); echo $row['photo']; }else { header("Content-type: image/png"); $im = ImageCreate(120, 50); $background_color = ImageColorAllocate($im, 104, 103, 222); $text_color = ImageColorAllocate($im, 242, 186, 47); ImageString($im, 2, 5, 5, "No photo available", $text_color); ImageString($im, 2, 5, 20, "for this person", $text_color); ImagePNG($im); ImageDestroy($im); } mysql_free_result($res); }else { // No photo found, show error picture header("Content-type: image/png"); $im = ImageCreate(120, 50); $background_color = ImageColorAllocate($im, 104, 103, 222); $text_color = ImageColorAllocate($im, 242, 186, 47); ImageString($im, 2, 5, 5, "Access denied", $text_color); ImagePNG($im); ImageDestroy($im); } ?>