Don't use a urldecode on a $_GET variable !
Say you have a script:
script.php [ Hide ] <?php
// Don't do this !
$value = urldecode($_GET['something']);
?>
Exploit:
An attacker can make a query to that script
script.php?something=%2527 [...]
The fact...
PHP "receives" this as %27, which your urldecode() will convert to ' (the singlequote). This may be CATASTROPHIC when injecting into SQL or some PHP functions relying on escaped quotes -- magic quotes rightly cannot detect this and will not protect you!
Eg. This exploit affects phpBB < 2.0.11
Solution:
Just an example of how you can make that more secure: