# Login php and flash question

**URL:** <https://forum.kirupa.com/t/login-php-and-flash-question/166110>\
**Category:** Uncategorized\
**Created:** [October 17, 2005, 5:32am UTC](https://forum.kirupa.com/t/login-php-and-flash-question/166110 "2005-10-17T05:32:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![audrius\_05](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@audrius\_05](https://forum.kirupa.com/u/audrius_05)\
**Post date:** [October 17, 2005, 5:32am UTC](https://forum.kirupa.com/t/login-php-and-flash-question/166110/1 "2005-10-17T05:32:43Z")

</div>

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:

```php
 <?
	$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");
	}
	?> 

```
