PHP Help - inserting code

yak8998

Member
May 2, 2003
135
0
0
This shouldn't be too hard I hope :D

I use the format index.php?art=______
where art points to the pathname and file of the selected article, without the extension. I want to take the file and just drop its contents into the output (ie: print("yadda yadda"). I'm not too experienced with PHP, I figured the best way to do this would be to use the file commands. How would I do this, or is there a better way? Thanks
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
include() or require() the file.

Also note that you're taking in arbitrary text, that the user can modify in any way, and then using that as a pathname of a file to show them. You will need to do some checks on that input before just blindly include()ing a file.