Is it possible for someone to execute a code through a URL for example
http://localhost/page.php?code=echo 'something';
If yes then how can it be done and how can you prevent it from happening?
Is it possible for someone to execute a code through a URL for example
http://localhost/page.php?code=echo 'something';
If yes then how can it be done and how can you prevent it from happening?
It's possible if something on the server takes the data in the URL and puts it somewhere where it might be treated as code (e.g. in an eval statement, in an SQL query or in an HTML document).
The defences are all specific to the place where you put the data, but usually involve escaping it.
See also SQL Injection, XSS, and the open web application security project.