Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Connect Java App to a Wordpress MYSQL Database  (Read 1837 times)
0 Members and 1 Guest are viewing this topic.
Offline Master_Mas

Junior Newbie




Master Mas, Opening a Door Way to a New World


« Posted 2013-05-11 07:54:32 »

Hello

So I'm in the current process of building a launcher for my game. One of the systems I need is login. How the login will work on a general base is the java app will somehow send the username and password encoded (I already know how to do the encoding) to the Wordpress front end and request a login using the username and password. From there WordPress does its normal way of logging in. But instead of returning the website it needs to goto, I would like it to return if the user was accepted or not.

So I would be guessing a plugin on the wordpress side will be required so it can just return true or false. Next will be java, I need a way to send a username and password to wordpress. Though wordpress doesn't use java, it uses PHP. So is there I can request a php query inside java.

I have looked at XMLRPC but I can't find a way for just to login to wordpress from that, it seems that you have to use a function to do something to test to see if you can login. If someone knows how to just do login, I wouldn't mind that either.

Thanks, Sam

Offline l3dx

Junior Duke


Medals: 1


Say what?


« Reply #1 - Posted 2013-05-11 08:07:21 »

MySQL has nothing to do with PHP. What you need to do is simply to connect to the database directly from you java code, and perform the (SQL) query. Do some google searches for "mysql java tutorial".

It might also be possible to decide if a user is succesfully authenticated based on the HTTP status codes. If wordpress does this in a sane way  Roll Eyes
Offline ReBirth
« Reply #2 - Posted 2013-05-11 10:51:02 »

All you need is the database URL and login credential. Then JDBC will take care of it.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2013-05-11 11:23:09 »

Never ever expose your database to the outside world.

Query WordPress itself, over HTTP. If you want to use a specialized solution, write a JSON API, but I can't stress enough that a database must be only reachable by a serverside application, where business logic defines the used queries; never execute queries received from a client.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline l3dx

Junior Duke


Medals: 1


Say what?


« Reply #4 - Posted 2013-05-11 11:44:39 »

Very good point! I didn't consider that. Before you know it somebody knows your db host and credentials.
Offline Danny02
« Reply #5 - Posted 2013-05-11 11:50:34 »

also, perhaps it's easier for you to use OAuth for your user accounts.

Means that your user can login with their Facebook, Google, Twitter .... accounts into your app.
Offline cylab

JGO Ninja


Medals: 52



« Reply #6 - Posted 2013-05-11 14:04:14 »

Cant you just post the user credentials to the login form and check the http response code to not be 403?

Mathias - I Know What [you] Did Last Summer!
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2013-05-11 14:07:53 »

What makes you think WordPress returns statuscode 403?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (49 views)
2014-10-17 03:59:02

Norakomi (38 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (34 views)
2014-10-15 16:18:58

TehJavaDev (65 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!