Simple PHP script - need help
Posted by: Jaysin
Posted on: 2007-06-04 09:05:00
OK, I'm building a site and have been doing all of my testing on a local XAMPP web server. Everything has been working fine, but when I uploaded my site to test on Dreamhost one of my PHP pages broke and I can't figure out why. It's a very simple thing and I'm assuming it has to do with the PHP Extra Web Security enabled for that domain.
What I'm doing is having a gallery page where the blown up image appears in an iframe. The page I'm loading into the iframe (image.php) is a simple php page that takes the variable $pic as the name of the image to load. It also takes the variable $pictext as a string to describe the image and $link as a condition to see if there is a larger size of the picture.
Now, what's totally broken is that when I load the gallery there is nothing showing up on that iframe page. I have checked and it is loading the image.php into the iframe, it's just not showing any image or text. I have tried loading the image.php as it's own page (outside of the iframe) and it's still broken. So, here is the code for the image.php page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gallery picture</title>
<link href="../css/base.css" rel="stylesheet" type="text/css" />
<script src="../javascript/rightclick.js" type="text/javascript"></script>
<script src="../javascript/portup.js" type="text/javascript"></script>
<style type="text/css">
--snipped style definitions that have no bearing on this problem--
</style>
</head>
<body>
<div class="centr">
--OK, here is my php. The whole "if large" condition is just checking to see if there is a link to a larger image--
<?php
if($link ==large){
$size = getimagesize('images/'.$pic.'_lrg.jpg');
echo '<span class="smaller_text">Click the image for a larger view</span>';
echo '<a href="fullsize.php?pic='.$pic.'&width='.($size[0]+30).'&height='.($size[1]+80).'" onclick="portUp(this.href,'console','.($size[1]+20).','.($size[0]+20).');return false;" target="_new"><img src="images/'.$pic.'.jpg" vspace="8" /></a><br />';
echo $pictext;
}else{
echo '<div style="height:1em"> </div>';
echo '<img src="images/'.$pic.'.jpg" vspace="8" /><br />';
echo $pictext;
}
?>
</div>
</body>
</html>
Pretty simple page right? But when I call this page in it's own window using "image.php?pic=test" I get nothing in the source where the pic variable should be echoed. It just comes out as <img src="images/.jpg" vspace="8" />. So, this is why I'm assuming it's the extra web security setting. If so is there a new way I should passing variables? Or do I need to turn off extra security? Or am I missing something really stupid?
Many thanks in advance for any help you can provide. I didn't want to include a link to our testing area since this seems like a simple enough problem, but if it's necessary to fix the problem I will.