View Single Post
Old 04-27-2005, 02:33 PM   #6 (permalink)
Silvy
paranoid
 
Silvy's Avatar
 
Location: The Netherlands
Let me join in this with a question:

You need http://www.arch13.com/index.php?id=brewery&id2=12345
to turn into a "brewery" page with image number 12345?

Or are you trying to hide id2 from the url and just show id=brewery ?

EDIT: I think I get the fact that you want to simplify the URL to hide the paths, but it's ok to have both id= and id2= in the url.

So I suggest (as posted by you earlier):
http://www.arch13.com/index.php?id=brewery&id2=12345

The code should be something like this:
PHP Code:
//constant:
define('IMAGE_PATH''img/');
//VALIDATE THE INPUT BEFORE THIS.
$filename=$_REQUEST['id'].'_'.$_REQUEST['id2'].'.jpg'  //turns index.php?id=brewery&id2=1 into brewery_1.jpg
$image_location=IMAGE_PATH.$filename  (turns it into 'img/brewery_1.jpg'
Then you can proceed to check for file_exists, and enter it into your code.
And you should validate your code as people could try to access your complete filesystem by requesting stuff like id=../../etc/passwd
(Depending on system setup this might work).
__________________
"Do not kill. Do not rape. Do not steal. These are principles which every man of every faith can embrace. "
- Murphy MacManus (Boondock Saints)

Last edited by Silvy; 04-27-2005 at 02:47 PM..
Silvy is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76