תראה פה זה בשיטה בלי משתמש מהמסד אלא מוגדרים מראש !
וזה כן עובד !
PHP קוד:
<?
// Returns '1' if valid, or '0' if invalid
// Initialize user table
// Add entries to this table in the form "USER"=>"Password"
// All entries (except the last one) must be finished with a ','.
$user_table = array(
"John Doe"=>"JohnnyBoy",
"Billy Nest"=>"Billy Password",
"Jane Smith"=>"Firetruck"
);
// Check if data was posted to script
if ($_POST)
{
// Loop through table
foreach($user_table as $username=>$password)
{
// Check if md5's of user/pass match passed values
if (($_POST['username_md5'] == md5($username)) AND ($_POST['password_md5'] == md5($password)))
{
// The user/pass combo matched
echo '1';
exit;
}
}
// The user/pass combox did not match
echo '0';
exit;
}
else
{
// Output message if nothing is posted (eg. if script is loaded into a web-browser)
echo "No post data found.";
}
?>