# Simple flash php authen

**URL:** <https://forum.kirupa.com/t/simple-flash-php-authen/22521>\
**Category:** Uncategorized\
**Created:** [June 5, 2003, 1:32am UTC](https://forum.kirupa.com/t/simple-flash-php-authen/22521 "2003-06-05T01:32:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzman121](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jazzman121/32/127_2.png) [@jazzman121](https://forum.kirupa.com/u/jazzman121)\
**Post date:** [June 5, 2003, 1:32am UTC](https://forum.kirupa.com/t/simple-flash-php-authen/22521/1 "2003-06-05T01:32:24Z")

</div>

here is what i wanna do… i want to have a log in… for my flash file… its got a username field and password field… on submit… it sends the variables of 2 fields to a .php file… which checks if the user name and password match the user name and password in the .php file… it it does… it returns a varaible to the flash file…

here is what my php file is like…

```php
<?php

$pass = $_POST['pass'];
$user = $_POST['user'];

//correct username and password ...

$orguser = "jazzman121";
$orgpassw = "test";

if ($passw==$orgpassw&$user==$orguser) {
	$result = "ACCESS GRANTED";	
}else {		
	$result = "ACCESS DENIED";
}
?>

```

im kinda new to php… so this code might not be right… i guess thats why its not working :sure:

anyways… how should my flash file look like?? please help

thanks… (if i have to change my php… please let me know about that too… )

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 1:33am UTC](https://forum.kirupa.com/t/simple-flash-php-authen/22521/2 "2003-06-05T01:33:16Z")

</div>

Im thinking this should be safe… since its serverside soo no one can find out the correct username and password… …

and i dont have a database… soo i cant do that … ☹ ( if there are other better ways to do this… please let me know thanks )

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:21am UTC](https://forum.kirupa.com/t/simple-flash-php-authen/22521/3 "2003-06-05T03:21:23Z")

</div>

PHP file:

```php

<?php

$pass = $_POST['pass'];
$user = $_POST['user'];

//correct username and password ...

$orguser = "jazzman121";
$orgpass = "test";

if ($pass == $orgpassw && $user == $orguser) 
{
    echo "result=ACCESS GRANTED";    
}
else 
{        
    echo "result=ACCESS DENIED";
}
?>

```

FLASH:

You need to create a loop to check for the variable and make sure that its not empty. This is MX code since you didn’t specify which version you are using…

```auto

_root.onEnterFrame = function(){
if(result == ""){
loadVariablesNum("phpPage.php", 0, "post");
}
else if(result == "ACCESS GRANTED"){
//do something correct here....
}
else if(result == "ACCESS DENIED"){
//Send them away here....
}
}

```

something like that should work. I didn’t check tho…
