Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 5th, 2012, 01:59 PM
IMaVBNoob's Avatar
IMaVBNoob IMaVBNoob is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 122 IMaVBNoob User rank is Private First Class (20 - 50 Reputation Level)IMaVBNoob User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 13 h 57 m 38 sec
Reputation Power: 8
Send a message via MSN to IMaVBNoob
How do i retrieve vaiables or a echo(""); from php?

Hi im having some trouble with my login form. i know this script works i had it working on a website that i started to develop in php. I had a few ideas to implement some flash and decided it would be better if i did the whole website in flash. so im trying to convert the php scripts that i have written to be able to be used along with my flash document. Im scripting in AS2

My question is how do i return the echo to the flash document to see if the was invalid or not?

This doesn't seam to be working can someone point me in the right direction? Here is the AS

Code:
SubmitLogin_btn.onRelease = function() {
    //call php to verify the correct username and password
formdata = new LoadVars();
    formdata.useremail=useremail.text;
    formdata.userpass=passwrd.text;
	formdata.remember=remember.value;
	formdata.send("doLogin.php", "_self", "POST"); 

};
formdata.onLoad = function(success) {
        if (success) {
            this.status.text = "Redirecting to members home.";
			gotoAndStop(31);
			
        } else {
           this.status.text = "Failed login attempt.";
        gotoAndStop(30);
		}
    };


here is the login php script... global.php is a php script to connect to the database.

Code:
<?php include_once("scripts/global.php");
$message ='';
if(isset($_POST["useremail"])) {
	$email = $_POST['useremail'];
	$pass = $_POST['userpass'];
	$remember = $_POST['remember'];
	
	if((!$email)||(!$pass)){
		$message = 'Please insert both fields.';
	}else{
		//Secure the data
		$email = mysql_real_escape_string($email);
		$pass =sha1($pass);
	
		$query = mysql_query("SELECT * FROM members WHERE email='$email' AND password='$pass' LIMIT 1")
		or die('Could not check memeber');
		$count_query = mysql_num_rows($query);
		if($count_query == 0){
		 echo "invalid"; 
		}else{
			$_SESSION['pass'] = $pass;
			while($row = mysql_fetch_array($query)){
				$username=$row['username'];
				$id=$row['id'];
				}
				$_SESSION['username'] = $username;
				$_SESSION['id'] = $id;
				
				if ($remember == 'yes'){
					//SEt Cookies
					setcookie('id_cookie',$id,time()*60*60*24*100,'/');
					setcookie('pass_cookie',$id,time()*60*60*24*100,'/');
					}
		echo "success"; 			

			}
		}
}




?>

Last edited by IMaVBNoob : November 5th, 2012 at 02:24 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > How do i retrieve vaiables or a echo(""); from php?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap