if you have a $POST superglobal:
$POST["username"]='123123123';
$_POST["password"]='1*****asdasd';
foreach($_POST as $key => $value){
$$key = $value;
}
this litle code then make global variables from your $_POST superglobal. $$ means create a variable with the string after, in these cases $username and $password will be created. However this looks like pritty, one little trouble could happened:
$password="123"; //you can access as admin with this password
$_POST["user"]='123123123';
$_POST["pass"]='aaaaa';
/* The user then makes a form, and creates a new textfield with password as a variable name*/
foreach($_POST as $key => $value){
$$key = $value;
}
//and woala, $password will gives new value, overwrite!
if( $password==$pass )
include("adminpanel.php");
this is bad. These is a better way to make this using the extract function:
$size = "large";
$color="red";
$var_array = array("color" => "blue",
"size" => "medium",
"shape" => "sphere");
extract($var_array, EXTR_PREFIX_SAME, "wddx");
echo "$color, $size, $shape, $wddx_size\n";
from the php.net manual.