song.php is the file that I'm using as my template file, and it calls
information from the includes/ directory, which the file "1" would be in. If
someone would please look at song.php (I stripped it down to the basics
pretty much) and let me know the best and most secure way to do what I want
it to do. When finished, the includes directory will have dozens of files
(numbered 1 and up), as you can see from the dropdown list in song.php .
Thanks for the help.

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


Rick Beckman wrote:
> Okay, I was mistaken... There is a gaping security hole in my simple
> li'l script... How do I modify it to only accept files from a certain
> path? I want the url format to be script.php?call=1 where "1" is the
> called file in the /includes/ directory. Just when I get optimistic I
> leave the entire system exposed. Yeah, that fits with my luck. :-)
>
>
> Rick Beckman wrote:
>> Sarcasm aside, I do have the script set up (although I didn't note so
>> in the last response) to not accept files with '.' or '..' in the
>> path. The URL can accept directories within the one the PHP script is
>> in, but not in a different path or any directory above its own (i.e.,
>> the server files).
>>
>>
>> John W. Holmes wrote:
>>>> I have a page set up that loads the contents of a text file into an
>>>> HTML template using PHP. (i.e. something.com/page.php?include=1
>>>> where "1" is a simple no-extension text file in the same directoy
>>>> as page.php). Is there a
>>>> way to modify the PHP code in the template page to search for the
>>>> included page in another directory? Right now, the only way to do
>>>> it is to have the URL as "page.php?include=files/1".
>>>>
>>>> Currently, here is the code I use to takes the $include URL
>>>> variable and makes the file accessible in the template:
>>>>
>>>> $info = file($include);
>>>
>>> Can I get the URL to your server, please, so I can pull up
>>> page.php?include=/etc/passwd ?? Thanks, I would really appreciate
>>> that.
>>>
>>> But seriously, I really hope you are validating what $include is.
>>>
>>> If you want the file to be included from a different directory, then
>>> you have to pass some flag/variable to PHP to tell it where to look.
>>> If you always want it to be in the same dir, then use
>>>
>>> $info = file('files/' . $include);
>>>
>>> ---John Holmes...


begin 666 song.php
M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#0N,#$@
M5')A;G-I=&EO;F%L+R]%3B(@(FAT=' Z+R]W=W<N=S,N;W)G+U12+VAT;6PT
M+VQO;W-E+F1T9"(^#0H\:'1M;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YG+"!S86EL:6YG+"!S
M86EL:6YG+"!S86EL:6YG+"!S86EL:6YG(&%L;VYG#0I5;G1I;"!M>2!,;W)D
M(&-O;65S(&)A8VL@86YD($AE('=I;&P@=&%K92!M>2!T;R!M>2!H96%V96YL
M>2!H;VUE#0I))VQL(&ME97 @;VX@<VEN9VEN)RP@<VAO=71I;B<L(&=I=FEN
M)R!P<F%I<V5S#0I/:"P@:&]W('1H92!H96%V96YS('=I;&P@<FEN9PT*5VAE
M;B!W92!G871H97(@=7 @:6X@:&5A=F5N('=I=&@@0VAR:7-T(&]U<B!+:6YG
M#0I7:&5N('=E(&=A=&AE<B!U<"!I;B!H96%V96X@=VET:"!#:')I<W0@;W5R
5($MI;F<@*$QO<F0@86YD($MI;F<I
`
end


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to