Using PHP_SELF in the action field of a form to submit php form
In this article shows the usage of PHP_SELF variable and how to avoid PHP_SELF exploits. What is PHP_SELF variable? PHP_SELF is a variable that returns the current script being executed. This variable returns the name and path of the current file (from the root folder). You can use this variable in the action field of the FORM. There are also certain exploits that you need to be aware of. We shall discuss all these points in this article. We will now see some examples. echo $_SERVER['PHP_SELF']; a) Suppose your php file is located at the address: http://www.yourserver.com/form-action.php In this case, PHP_SELF will contain: "/form-action.php" b) Suppose your php file is located at the address: http://www.yourserver.com/dir1/form-action.php For this URL, PHP_SELF will be : "/dir1/form-action.php" Using the PHP_SELF variable in the action field of the form A common use of PHP_SELF variable is in the action field of the <form> tag....