Wordpress Login

Hello

So what I want to be able to do is have a login for my game, which uses my website database for logins. This is a wordpress site so it uses wordpress database structure. In the game I use JMonkey game engine and I’m using nifty-gui for my GUI interface. So what I would like to know is how I can get the username and password out of the nifty textfields and send them to my website to get checked to see if they’re correct or not. Then for it to pick up the response and if correct goes into the game otherwise have to retry.

The nifty code is

<?xml version="1.0" encoding="UTF-8"?>
<nifty>
	<useStyles filename="nifty-default-styles.xml" />
	<useControls filename="nifty-default-controls.xml" />
	
	<screen id="start" controller="racer.LoginStateScreenController">
    	<layer id="layer1" backgroundColor="#003f" childLayout="center">
        	<panel height="25%" width="35%" align="center" valign="center" backgroundColor="#f60f" childLayout="vertical">     
            	<panel id="firstPanel1" width="100%" height="40%" childLayout="center">
                	<control id="username" type="textfield" visibleToMouse="true" align="center" valign="center"/>
            	</panel>
            	<panel id="firstPanel2" width="100%" height="40%" childLayout="center">
                	<control id="password" type="textfield" visibleToMouse="true" align="center" valign="center" passwordChar="*"/>
            	</panel>
            	<panel id="firstPanel3" width="100%" height="20%" childLayout="center">
    				<control id="button1" type="button" align="center" valign="center" label="login" visibleToMouse="true">
    					<interact onClick="submit1()"/>
    				</control>
				</panel> 
        	</panel>
  		</layer>
  </screen>
</nifty>

And the Login Controller is

package racer;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class LoginStateScreenController implements ScreenController {
	
	Nifty nifty;
	Screen screen;
	
	@Override
	public void bind(Nifty nifty, Screen Screen) {
		
	}
	
	@Override
	public void onEndScreen() {
		
	}
	
	@Override
	public void onStartScreen() {
		
	}
	
	public void submit1() {
		
	}
}

Thanks Sam. Just ask if you need any addition information.

I don’t know how to use WordPress, but as for the nifty gui, a very short google search gave me the answer you were looking for.


public void submit1() {
      TextField textField = screen.findNiftyControl("username", TextField.class);
      String username = textField.getText();
      textField = screen.findNiftyControl("password", TextField.class);
      String password = textField.getText();
   }

Hope this is what you were looking for :).

Use OpenID, it works with Wordpress.