hey there, I am working on a login page in flash and used ’ foundation php for flash’ tutorial to build the login page. Now, I want for some one to look at the script and tell me if its the correct way of using php script without detecting password thru the browser:
the php script is as follow:
<?
$usernames[] = "test";
$passwords[] = "test";
$messages[] = "Welcome!";
// Check that a username and password have been passed...
if (!isset($username) || empty($username) || !isset($password) || empty($password)) {
// If not tell Flash movie that we've failed and return error message
print "&result=Fail&errorMsg=" . urlencode("You need to supply a username and password");
exit;
}
// Set a variable so we can indicate whether a match was found or not
$matchFound = false;
// Now we loop through each entry in our arrays looking for a valid match
for ($count = 0; $count < count($usernames) && $matchFound == false; $count++) {
// If username and password matches entry...
if ($username == $usernames[$count] && $password == $passwords[$count]) {
// Get the user's message and indicate we've found a match
$message = $messages[$count];
$matchFound = true;
}
}
// If we found a match...
if ($matchFound) {
// Tell the Flash movie that login was successful and return custom message
print "&result=Okay&message=" . urlencode($message);
} else {
// Otherwise, tell Flash movie we failed
print "&result=Fail&errorMsg=" . urlencode("No match found for username/password");
}
?>