# Help: PHP, Actionscripting login

**URL:** <https://forum.kirupa.com/t/help-php-actionscripting-login/224069>\
**Category:** Uncategorized\
**Created:** [April 28, 2007, 4:07am UTC](https://forum.kirupa.com/t/help-php-actionscripting-login/224069 "2007-04-28T04:07:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JonWatson11964](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@JonWatson11964](https://forum.kirupa.com/u/JonWatson11964)\
**Post date:** [April 28, 2007, 4:07am UTC](https://forum.kirupa.com/t/help-php-actionscripting-login/224069/1 "2007-04-28T04:07:13Z")

</div>

Hi, I am having trouble to get the SendAndLoad() function to work correctly so that when the php script echo’s or print(“result”) is called it gets a string saying pass, or fail… the following is my code for php, and action script. Also I have provided two pictures explaining the what exactly I want… Any help is very appreciated.

Thanks  
-Jon

\<?php

```
$host = "localhost";
$usr = " ********";
$pss = " ********";
$dbselect = "test";
$username = $_POST['username1'];
$password = $_POST['password1'];

mysql_connect($host, $usr, $pss) or die(mysql_error());
mysql_select_db($dbselect);

$result = mysql_query("SELECT * FROM login") or die(mysql_error());
$getUsrnames;
$getPasswords;
while($string = mysql_fetch_array($result))
{ 
     $getUsrnames .= $string['name']." ";
    $getPasswords .= $string['password']." ";
}
$Usrnames = explode(" ", $getUsrnames);
$Passwords = explode(" ", $getPasswords);
$check = false;
$int = 0;
for($i = 0; $i &lt; count($Usrnames); $i++) 
 {
         if(strcmp($username, $Usrnames[$i])== 0)
         {
             $check = true;
             $int = $i;
         }
         
 }
 $passorfail = "";
 if(strcmp($password,$Passwords[$int]) == 0)
         $passorfail = "success";
         else $passorfail = "failure";
    
                             
print ("processed1=$passorfail");

```

?\>  
//This script does work with an html form, where the user is just redirected if the  
//passwords match, otherwise they are redirected to failure.php and redirected then  
//back to the login.htm page

-------------------------ActionSCRIPT---------------------------

on(press)  
{  
var1 = user.text;  
var2 = pass.text;

```
 envelope = new LoadVars();
 envelope_received = new LoadVars();

 envelope.username1 = var1;
 envelope.password1 = var2;
 envolope_received.processed1 = "default";
 envelope.SendAndLoad("http://www.nemuspaper.com/process.php", envelope_received, "POST");
 the_status = envelope_received.processed1;
 proc.text = the_status+var1+var2; 

```

}

//The on press is called from the login button. for the input text fields I used the  
instance name instead of the Var name because otherwise it would not display the  
values in the dynamic field that states what the php script returns and the username  
and password from the input fields. I used sendAndLoad, and “POST” as the method  
which then I used $\_POST array in the php, I have tried the HTTP\_POST\_VARS array.

Here is the image before typing anything in

[![](http://img407.imageshack.us/img407/8198/beforetypedxr4.th.jpg)](http://img407.imageshack.us/my.php?image=beforetypedxr4.jpg)

Here is the image of what the script actually does

[![](http://img402.imageshack.us/img402/7851/aftertypedau1.th.jpg)](http://img402.imageshack.us/my.php?image=aftertypedau1.jpg)

-Again, thanks for any help.
