Jump to content
  • Advertisement
Sign in to follow this  
johnnyMakesGames

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

This topic is 3663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Well it's really up to you and how you want to do it. You could always implement both but that would be more work for you. Either way though, both ways get the same job done.

Share this post


Link to post
Share on other sites
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
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
Actually, if you allow account creation via the applet, you won't need anything like captcha. No spambot I've heard of will submit applet forms.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!