Jump to content

login required script


Recommended Posts

  • 7 months later...

Hi Manadar

Hope you can help me get this working, I am using your mysql/php login bits n pieces, all fine so far but don't seem to be picking up the

Func IsValidSession($s)

Return $s == "VALID LOGIN"

EndFunc

If I login via a browser it works and prints VALID LOGIN to the page how do I pick that up within my autoit script?

Link to comment
Share on other sites

Hi

OK here's the code I am using in my script

$username = "uname"
$password = "pword"

$session = InetGet("http://www.domain.com/login.php?username=" & $username & "&password=" & $password)
If (IsValidSession($session)) Then
   ; Logged in
Else
   Exit
EndIf

Func IsValidSession($s)
   Return $s == "VALID LOGIN"
EndFunc

The web site has the user setup and works via a browser, and when accessed display VALID LOGIN on the page (login.php)

Manadar supplied the following code

// make a connection to the database running on the webserver
mysql_connect("localhost", "dbuser", "dbpass", "dbname");

$username = $_GET['username'];
$password = $_GET['password'];

$query = "SELECT * FROM users WHERE username = '" . mysql_real_escape_string($username) . "' AND password = ''";
$result = mysql_query($query);

if ($result) then
   echo "VALID LOGIN"; // and this would tell the Au3 script that the user exists
end

But as this part has autoit code and NOT php code it can't print/echo it out.

if ($result) then
   echo "VALID LOGIN"; // and this would tell the Au3 script that the user exists
end

So I changed the php page to this instead

if (mysql_num_rows($result) == '1')

{

print "VALID LOGIN";

}

else

{

print "Uh Oh";

}

Any help is much appreciated
Link to comment
Share on other sites

  • 2 weeks later...

Hate to bump threads back to the front but I really could do with an answer guys, in short, user is setup in mysql db and works fine through a browser, it prints VALID LOGIN to the php page on success.

How do I tell autoit exe that the result is good to go?

Edited by Phaser
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...