if (ini_get('register_globals')){echo "<font color=red>Registor global is ON</a><br>This is a security issue, please change settings inside your php.ini file</font>";}
else{echo "Register global is OFF";}
This setting of global variables is kept inside php.ini file and is not available for edit in shared hosting plans. So you may have to contact your host to change the setting. If you are using your local machine or in windows then search for php.ini file inside your windows directory.
$username=$_POST['username'];
Here the form is submitted by POST method and similarly we can get the values for GET method or variables from the URL, server variables etc.
$username=$_GET['username'];
Here is a code example for making available the variables if register global is off
while (list ($key,$val) = each ($_POST)) {
$$key = $val;}
But note that by using above code you are defeating the very purpose of keeping the register_global off for security reasons.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| Jamal Faiye | 26-08-2013 |
| Very usefull | |