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!
simonmlewis wrote:BTW you cannot use this as it errors on the ;.
I count three left parens and only two right parens in that line. Do you have error reporting turned on? Posting the error message would help (or specifically tell you where the problem is).
Depending on how you use it this is a common vector for hackers to steal user's cookies and hijack accounts. A little better protection is to use the following routine to filter this variable before echoing it's contents:
Never trust user input. Always filter it before you echo it, store it, or use it. Just google PHP_SELF and XSS for many examples. The most powerful XSS hack to this variable allows the attacker to steal cookie data from your users. This could lead to hijacked accounts and a host of other problems. They can also inject malware through your site using this exploit as well.