On Thu, October 5, 2006 5:15 am, Meline Martirossian wrote:
> I have just made my first php mini website. I have my header, footer,
> navigation and main pages.
> The header, footer and navigation appear as "includes" in my main
> page.
>
> When I click on my navigation links, I get a new blank browser window
> with the image on it. This is not what I want.
>
> Can you help me with instructing the server to load the image on my
> main page and in the designated area instead of a new blank page?
>
> http://www.squareinch.net/portfolio2.php
<?php
require 'header.inc';
require 'navbar.inc'; //probably should be folded into header.inc...
if (isset($_REQUEST['logo'])){
$logo = $_REQUEST['logo'];
///// everything between these marks is about input validity
///// You don't need it to understand how to do what you want
///// You need it to understand how not to get hacked
$logo = basename($logo); //minimal crude anti-hack scrubbing...
//slightly more anti-hack scrubbing
if (substr($logo, -4) !== '.jpg'){
echo "<p>Invalid Input</p>";
require 'footer.inc';
exit;
}
//In an IDEAL world, you program the logos into a DB
//You then check that '$logo' is *in* the DB, so you know it's
//a valid logo.
//Unless they hack your DB *and* muck with your URL at same time...
////// end of input validty section
?>
<img src="/images/<?php echo $logo?>" />
<?php
}
else{
?>
<p>Put the square inch logo here or whatever is there when there
is no image selected</p>
<?php
}
require 'footer.inc';
?>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php