On the Flash side use this:
var dataToSend:LoadVars = new LoadVars();
var answer:LoadVars = new LoadVars();
dataToSend.username = username.text;
dataToSend.sendAndLoad("http://localhost/login.php", answer, "POST");
answer.onLoad = function(success)
{
if(success)
{
if(this.numElements == 1) // There can be only one user
with this name...
{
if(this.userPasword == userPasword.text)
{
// everything is good...
}
else
{
// user entered the wrong password...
}
}
}
}
On the PHP side:
<?php
$hostname = "localhost";
$database = "whatever";
$username = "username";
$password = "top secret";
$con = mysql_pconnect($hostname, $username, $password) or die(mysql_error());
mysql_select_db($database, $con);
$search = sprintf("select * from users where username = '%s'",
$_POST["username"]);
$data = mysql_query($search, $con) or die(mysql_error());
$line = mysql_fetch_assoc($data);
$num_lines = mysql_num_rows($data);
$result = "&numElements=" . $num_lines;
if($num_lines != 0)
{
$result .= sprintf("&name=%s&password=%s",
utf8_encode($line['username']),
utf8_encode($line['password']));
}
echo $result;
mysql_free_result($con);
?>
Hope this helps.