PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$file = $_GETї'file'];
if ($file) include($file);
and the message I gets is:
"Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Inetpub\wwwroot\svartfolk-php\eforum.php on line 11"
the file I'm trying to include is in the same folder as the script and contains some php..
What's on lines 1-11 C:\Inetpub\wwwroot\svartfolk-php\eforum.php? In other words, what do the lines where the error (to do with your MySQL connection as volka pointed out) is occuring look like. We can't help you if you don't give us all the information.
ehm, forgot to include the file that opened the db, so that is fixed. but another question, is there anything you should think when it comes to dynamic includes, security issues etc?
Just make sure that you aren't going to be allowing people to open any file they like. Basically have something, a switch, if statement, entries in a database, whatever, that allows you to decide whether the content to be included should be allowed.
I don't know if such a function exists, but it doesn't seem like it would be that hard to write yourself. The switch statement may be simpler, although less flexible.
I made a quick look and found the function. And it wasn't as I remebered. It is realpath($path) and it extracts the path I mention above to /etc/passwd.