<?php
session_start();
$db=mysql_connect("mysql5.000webhost.com", "***", "***");
mysql_select_db("a8915214_DB", $db);
$email = $_POST['email'];
$password = $_POST['password'];
$SQL = "SELECT * FROM login WHERE email ='".$email."' AND password = '".$password."'";
$rs = mysql_query($SQL);
$numRows = mysql_num_rows($rs);
if($numRows > 0){
$_SESSION['loggedIn'] = true;
echo 'login=success';
}else{
echo 'login=failure';
}
?>
my flash code is as follows:
var lvSend:LoadVars = new LoadVars();
var lvReceive:LoadVars = new LoadVars();
tError.autoSize = "right";
mcLogin.onRelease = function() {
trace("Value92076 :"+_root.usertext1.text);
var valid:Boolean = validateForm();
if (valid) {
lvSend.email = tEmail.text;
lvSend.password = tPassword.text;
lvSend.sendAndLoad("newlogin.php",lvReceive,"POST");
} else {
tError.text("Please complete all fields");
}
};
function validateForm():Boolean {
if (tEmail.text == "" || tPassword.text == "" ) {
tError.text="Please fill all the fields!";
return false;
}
else if (tEmail.text == "") {
tError.text="Please enter valid email address!";
return false;
} else if (tEmail.text.indexOf("@") == -1 || tEmail.text.indexOf(".") == -1) {
tError.text="Please enter valid email address!";
return false;
}
return true;
}
lvReceive.onload = function(success:Boolean) {
if (success) {
if (this.login== "success") {
loadMovieNum("logout.swf", 5);
usertext1.text=tEmail.text;
//gotoAndStop(821);
} else {
tError.text = "I'm sorry you did not enter valid login details";
}
} else {
tError.text = "No reponse from server.Check your firewall and internet connection.";
}
};
i am new on flash thats why see king a man could help me.i know its quite easy for a man aware of flash, please guys help me get out of this problem. thanks in advance.
MOD EDIT: Added code tags. Also removed DB credentials, geez, don't post passwords on the Internet!!! And when posting code...USE CODE TAGS!!!
This post has been edited by JackOfAllTrades: 28 November 2012 - 06:47 AM

New Topic/Question
Reply


MultiQuote


|