Jump to content

between au3 and php, COM, mysql


bleed
 Share

Recommended Posts

Hello,

I`d need some help on passing the variables from my desktop application (compiled au3.exe file) to my web server auth script (.php) and vice versa for auth purposes.

I have never done anything similar and I was trying to figure out all day today how to do this. COM is brand new to me totaly as you can see, and I would really appreciate some guidance about how to tackle this problem.

I have managed to get some things working, like getting username from mysql database, but I cant pass the $var values from my desktop application to my .php script. In an essence, .php should compare username, password, ip address and hardware ID (still figuring that out)from my au3 file with mysql database, and act accordingly.The following code is messy, and not workable atm, but I need to get some sleep now, and hopefully someone will be able to point me into the right direction in next few hours.

Thank you.

au3 file:

$oRet = _HTTPRequest('POST', 'http://www.mysite.com/file.php', 'zdvfsdf')
$id = "testuser"
$pw = "pass"
$hid = "testHID"
$ip = "Ipaddress"
$oData = "some data here for testing"
ConsoleWrite($oRet)
Func _HTTPRequest($oMethod, $oURL, $oData)
    Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    $oHTTP.Open($oMethod, $oURL, False)
    If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    $oHTTP.Send($oData);error out requested
    Return $oHTTP.ResponseText
    ;ConsoleWrite($oHTTP)
EndFunc

server script:

<?
$username="test_user";
$password="somepw";
$database="some_bulletin";
$string="pass";
$passuser='';//COM object
$iduser='';//COM object

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database, Let admins know immediately!");
$query="SELECT * FROM user WHERE username=$iduser And password=$passuser";
$result=mysql_query($query);

$num=mysql_numrows($result);
mysql_close();

//echo "<b><center>Database Output</center></b>";

$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"username");
$last=mysql_result($result,$i,"password");
$salt=mysql_result($result,$i,"salt");
$hash=md5(md5($string) . $salt);

//echo "<b>$first</b><br>";
//echo "<b>$last</b><br>";
//echo "<b>$salt</b><br>";
//echo "<b>$hash</b><br>";
$i++;
}

?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...