Jump to content
Sign in to follow this  

Login Script / Check Wordpress credentials via PHP function using INet.

Recommended Posts

So, I've been trying to make a simple login for my autoit script.  Basically I just want the login script to check the username/pass via a php function on my wordpress site.  I've included my current login script and php script that I have uploaded to my wordpress site.

Here is the login script I have:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>

AutoItSetOption("GUIOnEventMode", 1)

$hLoginGUI = GUICreate(" :: Login", 232, 110, -1, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUICtrlCreateLabel("Username:", 16, 12, 64, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$hInputUsername = GUICtrlCreateInput("", 96, 8, 121, 21)
GUICtrlSetLimit(-1, 20)
GUICtrlSetTip(-1, "Please enter your username")
GUICtrlCreateLabel("Password:", 16, 44, 62, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$hInputPassword = GUICtrlCreateInput("", 96, 40, 121, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
GUICtrlSetLimit(-1, 20)
GUICtrlSetTip(-1, "Please enter your password")
$hButtonLogin = GUICtrlCreateButton("Login", 144, 72, 75, 25)
GUICtrlSetCursor(-1, 0)
$hLabelCreateAccount = GUICtrlCreateLabel("Create account", 16, 80, 77, 17)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitScript")
GUICtrlSetOnEvent($hButtonLogin, "_Login")
;GUICtrlSetOnEvent($hLabelCreateAccount, "_CreateAccount")
GUISetState(@SW_SHOW, $hLoginGUI)

While 1

Func _Login()
    $value = _INetGetSource("http://zzz.com/zzz.php?username=" & GuiCtrlRead($hInputUsername) & "&password=" & GuiCtrlRead($hInputPassword))
    If $value = 0 Then
        MsgBox(0, "Woot", $value)
    If $value = 1 Then
        MsgBox(0, "Fail", $value)
        MsgBox(0, "actual value" , $value)

Func ExitScript()

PHP Script

include '/wp-includes/user.php';

$auth = /wpincludes/user.php/wp_authenticate_username_password(NULL, $username, $password);

if (is_wp_error($auth)) {
$return = false;
return $return;

} else {
$return = true;
return $return;


So in theory, I thought this would work.  The php script alone should do all the authentication on the wordpress side of things.  I am trying to use INetGetSource to call that php function and get a return whether the username/password put in the login box was true or false.

If there is a different and simple way to do this, I'd love to know it.  I don't need this to be super secure, I just want it to work.

Any ideas?

Edited by Wovenn

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...