Sign in to follow this  
johnnyMakesGames

[java] where do I start with security username/password?

Recommended Posts

Hi, building an applet that requires a logon. I want to require folks to logon to play the game. Do I create accounts with the website and then have my java applet read that same database or do I create the account in the applet itself? Not sure what I would do other than, in the applet, pass the username an password to mysql and verify the account (however you do that.) Thanks.

Share this post


Link to post
Share on other sites
SteveTaylor    160
Quote:
in the applet, pass the username an password to mysql and verify the account (however you do that.)
Seems like the most sensible choice, although I wouldn't allow the applet to connect directly to the database. If you have access to a servlet engine (eg Tomcat) with your hosting, I would suggest using Apache XML-RPC for applet-server communication. I have actually got this to work with a $6.99/month godaddy hosting account.

Share this post


Link to post
Share on other sites
AbelCorver    112
Hy, I have the solution. Do you have access to PHP? I always create a PHP file to create an account on the website. You could add a kind of CAPTCHA to it or something. Then create a PHP page that prints true/false when it is loaded with a parameter: 'user' and 'password'. For example:

Java Code:

URL url = new URL("http://www.mywebsite.com/checkAccount.php?user=mrX&password=mysecretpassword123");

try{
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String s = null;
while((s=in.readLine())!=null){
if(s.equals("true"){
// logged in! example:
Game.continue();
}
}
in.close();
}catch(IOException e){}

Registering users on your website will also generate more pageclicks and people will be able to see the last news and your ads (more income!!)

Hope this will help! (it helped me several times)

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