Jump to content


login system


  • You cannot reply to this topic
5 replies to this topic

#1 Frozen_W

    Young Padawan

  • Members
  • Pip
  • 186 posts
  • Gender:Male
  • Location:Belgium, Gistel
  • Interests:Just gimme a PC and i'm happy!<br />Also my friends, some concerts, parties,...<br />After the pc, the usual stuff;)

Posted 01 April 2006 - 04:43 AM

Hi, I have a problem with a login system i'm building in flash that communicates with a php document on the server.

this is the piece that communicates with flash

$userName = $_POST['Gebruikersnaam'];
$userPasword = $_POST['Paswoord'];
$query ="SELECT pasword FROM Login WHERE username ='$userName'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ($row == "")
{
echo "acces=Unkown Username";
}
else
{
extract($row);
if ($userPasword == $pasword)
{
	$acces = "true";
	echo $acces;
}
else
{
	$acces = "false";
	echo $acces;
}

My php doc works with a normal html document with forms but it doesn't works with the fla. document that is included.[attachment=1052:attachment] (open the txt. then copy it into a texteditor and save it as login.fla)

Any help is welcome, Greetings Freaky

Edited by ResidentFreaky, 01 April 2006 - 07:05 AM.


#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 01 April 2006 - 05:49 AM

your zip file is damaged...

#3 gszauer

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 01 April 2006 - 10:14 AM

I couldnt acess the source code eather, but
From what i can tell this is whats happening:
1, The user puts his login info into flash
2, flash posts it to the php file
3, the php file is loaded into flash
4, according to the result of the file the php file posts the results....
Am i correct? (I need to know this in order to help)

Points to remember -
1, dont use echo, use the print command

This is what i would do,
Have the following database setup
colum 1 - id - autoincrement
colum 2 - username - varchar 255
colum 3 - password - varchar 255
1, make php list all of the login info within the database This tutorial has a php file that can be modofied to do this
2, load the list into flash, and use a for loop so that the code wont be so darn long
3, within flash check if usernamex matches passwordx where x represents the number eatch username is given (this is the same as the id number from the database)

I hope this has helped. As soon as i can download the fla i'll take a look at it

#4 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 01 April 2006 - 11:45 AM

You need to give the inputboxes InstanceNames, so that your Actionscript is able to do the if statement you wrote, then atm your script checks if the textfield "geburikersnaam" has been filled.. but since flash can't find the textfield, it will not go through the if statement.

#5 Frozen_W

    Young Padawan

  • Members
  • Pip
  • 186 posts
  • Gender:Male
  • Location:Belgium, Gistel
  • Interests:Just gimme a PC and i'm happy!<br />Also my friends, some concerts, parties,...<br />After the pc, the usual stuff;)

Posted 01 April 2006 - 01:43 PM

View Postgszauer, on Apr 1 2006, 05:14 PM, said:

I couldnt acess the source code eather, but
From what i can tell this is whats happening:
1, The user puts his login info into flash
2, flash posts it to the php file
3, the php file is loaded into flash
4, according to the result of the file the php file posts the results....
Am i correct? (I need to know this in order to help)

Points to remember -
1, dont use echo, use the print command

This is what i would do,
Have the following database setup
colum 1 - id - autoincrement
colum 2 - username - varchar 255
colum 3 - password - varchar 255
1, make php list all of the login info within the database This tutorial has a php file that can be modofied to do this
2, load the list into flash, and use a for loop so that the code wont be so darn long
3, within flash check if usernamex matches passwordx where x represents the number eatch username is given (this is the same as the id number from the database)

I hope this has helped. As soon as i can download the fla i'll take a look at it
Yes, the user iputs his username and pasword into flash, flash sends 2 variables to "logincheck.php" that program
verifies the variables if they match up with the username etc. in the database, and then php should send or variables or something else to flash I think that is going wrong.

To funkysoul, I added instance names to the input boxes, but the program still doesn't goes to the next scene when I enter the correct password etc.

Thanks for all the good help already, Greetz Freaky

#6 Frozen_W

    Young Padawan

  • Members
  • Pip
  • 186 posts
  • Gender:Male
  • Location:Belgium, Gistel
  • Interests:Just gimme a PC and i'm happy!<br />Also my friends, some concerts, parties,...<br />After the pc, the usual stuff;)

Posted 02 April 2006 - 06:31 AM

now, I have read some Tutorials on sending variables to a php doc. and from php to flash and so on.
And I changed my 2 files, but still it doesn't goes to the next scene when the info is correct, but when the info is
wrong it does says "Acces Denied" as programmed but only for less than a second. The updated files ==>

<?php
$userName = $_POST['Gebruikersnaam'];
$userPasword = $_POST['Paswoord'];
$query ="SELECT pasword FROM Login WHERE username ='$userName'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ($row == "")
{
echo "Unkown Username";
}
else
{
extract($row);
if ($userPasword == $pasword)
{
	$acces = "true";
	echo "&$acces=$acces&";
}
else
{
	$acces = "false";
	echo "&$acces=$acces&";
}
}
?>
above code is the piece that processes the information that was send bye Flash

The fla (delete the .zip extension!!!) ==> [attachment=1053:attachment]





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users