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
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.
Jamal Faiye | 26-08-2013 |
Very usefull |