need help with php code

Status
Not open for further replies.

itmees

Active Member
487
2010
26
0
need a bit help with php.

i have a script that gets info from file and displays it on site, however when file contains php script, then site will run it, and thats bad bcos security

php code to get file:
<?php include("./files/".$_GET["ID"].".file"); ?>

is there any way to disable php from running and displaying only file content, so it would ignore php tags in content. however it should allow html tags

cheers :)
 
Last edited:
6 comments
darn i should have taken that php course :D

edit: gonna contact script creator, he probably has ideas
 
Last edited:
if you wants to display html from a file and not execte php code from that file then you can use fopen, here is a small example.

PHP:
	$file =  "location/file.php";
	$f = fopen($file, "r");
		while ( $line = fgets($f, 1000) ) {
		print $line;
		}

and if you wants to display php with colors highlighting code u can use highlight_file function which will display php code without executing it and remember it will not parse html code.
 
Status
Not open for further replies.
Back
Top