[REQ] Verify Minecraft Username

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
pythros
Registered User
Posts: 6
Joined: Fri Jan 25, 2008 5:11 am

[REQ] Verify Minecraft Username

Post by pythros »

I have a required field for registration for users on my forum called "Minecraft Username". However, I've been getting bogus bots or people registering that don't have a thing to do with Minecraft let alone play on my Minecraft server. I've seen various of plugins made for MC server owners but not one that verifies the username against Minecraft's own "paid player" database via "http://www.minecraft.net/haspaid.jsp?user=". The player's username would immediately follow = and is case sensitive. It returns back a simple text message of true or false. For example, by checking my Minecraft account by going to http://www.minecraft.net/haspaid.jsp?user=pythros, it would print "true".

What I am exactly requesting is a guide as to how to do this or someone to make it where when the user hits "Submit" on the register page, that it will check the link above for the true/false statement and then allows the user to register to deny them based on the true/false statement. With my coding and logic experience, it doesn't seem it would take a whole lot. However, I know nothing of phpBB API coding :?
User avatar
AmigoJack
Registered User
Posts: 5799
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [REQ] Verify Minecraft Username

Post by AmigoJack »

Open /includes/ucp/ucp_register.php and find:

Code: Select all

            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); 
After, add:

Code: Select all

            /*** 2011-09-15 BEGIN AmigoJack
                Check custom fields: has Minecraft nick paid? ***/
            
            // Change "xxxxx" to your actual field name
            define( 'FIELDNAME_MINECRAFT', 'xxxxx' );
            
            if( isset( $cp_data['pf_'. FIELDNAME_MINECRAFT] ) ) {
                $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode( $cp_data['pf_'. FIELDNAME_MINECRAFT] ) );
                if( strpos( $sRes, 'true' )=== FALSE ) $error[]= 'The Minecraft ID must exist';
            }
            /*** 2011-09-15 END ***/ 
See comment to replace the given string. Untested (because currently I can't request that site).
Last edited by AmigoJack on Sun Jan 08, 2012 2:32 am, edited 1 time in total.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: [REQ] Verify Minecraft Username

Post by Saldash »

pythros, are you validating these custom fields as unique to stop people sharing usernames?
And what's to stop someone from using the username of person they know has paid? :?
World Recoded UK - DreamHost Site of the Month winner February 2011!
pythros
Registered User
Posts: 6
Joined: Fri Jan 25, 2008 5:11 am

Re: [REQ] Verify Minecraft Username

Post by pythros »

@AmigoJack
I was first thinking you meant by "Field Name" as Field identification. After I put I in the correct name in there, it worked like a charm! Thank you very much! However, I will let you know that if the incorrect field name is there, it treated it as an incorrect MC username. No harm there since it does work! ^_^

@Saldash
I have a few players who are siblings that only use one account so that part doesn't bother me. It was the fact that I was getting bogus spam accounts and people "spying" on my server from a former server I was on that kept creating accounts. At least this way, I don't have to look up the name manually to see if it is a valid account or not on Minecraft. I do have it as a "requirement" that they use here Minecraft name as their forum name. However, we all know people don't like to read or follow directions. >.>
creepinevil
Registered User
Posts: 12
Joined: Sun May 01, 2011 10:10 am

Re: [REQ] Verify Minecraft Username

Post by creepinevil »

Hello,
I would like to do something very similar to this but instead of the custom field i would like the main username to be their Minecraft name. What altercations would i need to make?

Thanks!
User avatar
AmigoJack
Registered User
Posts: 5799
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [REQ] Verify Minecraft Username

Post by AmigoJack »

Open /includes/ucp/ucp_register.php and find:

Code: Select all

            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); 
After, add:

Code: Select all

            /*** 2012-01-07 BEGIN AmigoJack
                Check username: has Minecraft nick paid? ***/
            $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode( $data['username'] ) );
            if( strpos( $sRes, 'true' )=== FALSE ) $error[]= 'The username must exist on Minecraft';
            /*** 2012-01-07 END ***/ 
Last edited by AmigoJack on Sun Jan 08, 2012 2:32 am, edited 2 times in total.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
creepinevil
Registered User
Posts: 12
Joined: Sun May 01, 2011 10:10 am

Re: [REQ] Verify Minecraft Username

Post by creepinevil »

AmigoJack wrote:Open /includes/ucp/ucp_register.php and find:

Code: Select all

            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); 
After, add:

Code: Select all

            /*** 2012-01-07 BEGIN AmigoJack
                Check username: has Minecraft nick paid? ***/
            $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode( $user-> data['username'] ) );
            if( strpos( $aRes, 'true' )=== FALSE ) $error[]= 'The username must exist on Minecraft';
            /*** 2012-01-07 END ***/ 

Hi,

This doesn't seem to work... Players who are using their existing Minecraft account usernames get denied (The username must exist on Minecraft)
User avatar
AmigoJack
Registered User
Posts: 5799
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [REQ] Verify Minecraft Username

Post by AmigoJack »

My fault: $user-> data['username'] must be $data['username'] - I've edited my post.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
creepinevil
Registered User
Posts: 12
Joined: Sun May 01, 2011 10:10 am

Re: [REQ] Verify Minecraft Username

Post by creepinevil »

AmigoJack wrote:My fault: $user-> data['username'] must be $data['username'] - I've edited my post.
Still no luck D:
User avatar
AmigoJack
Registered User
Posts: 5799
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [REQ] Verify Minecraft Username

Post by AmigoJack »

Then you have to give at least one example username which is refused at registration but which exists on Minecraft.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
creepinevil
Registered User
Posts: 12
Joined: Sun May 01, 2011 10:10 am

Re: [REQ] Verify Minecraft Username

Post by creepinevil »

The names we tried were:
  • Creepinevil
    EC2Jonathan
    DeFuZee
    SteamAnimator
    Ret311
    Spaniol
    Alexxa3889
    bigboyhy4
    Cho_gall
Used in case sensitive, then in all caps, then in lowercase.

:S

EDIT:

I will try to set it up again, i need to change some other things first that are unrelated.
User avatar
AmigoJack
Registered User
Posts: 5799
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [REQ] Verify Minecraft Username

Post by AmigoJack »

Found a typo, so it never worked in the first place. $aRes must be $sRes. Updated my both code posts and now also tested it: all your given names exist, except Alexxa3889 (found out it was also a typo, because Alexa3889 exists).
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
creepinevil
Registered User
Posts: 12
Joined: Sun May 01, 2011 10:10 am

Re: [REQ] Verify Minecraft Username

Post by creepinevil »

Works perfectly!

Thanks!
codman1
Registered User
Posts: 3
Joined: Sun Aug 12, 2012 9:09 am

Re: [REQ] Verify Minecraft Username

Post by codman1 »

AmigoJack wrote:Open /includes/ucp/ucp_register.php and find:

Code: Select all

            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);  
After, add:

Code: Select all

            /*** 2011-09-15 BEGIN AmigoJack
                Check custom fields: has Minecraft nick paid? ***/
            
            // Change "xxxxx" to your actual field name
            define( 'FIELDNAME_MINECRAFT', 'xxxxx' );
            
            if( isset( $cp_data['pf_'. FIELDNAME_MINECRAFT] ) ) {
                $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode( $cp_data['pf_'. FIELDNAME_MINECRAFT] ) );
                if( strpos( $sRes, 'true' )=== FALSE ) $error[]= 'The Minecraft ID must exist';
            }
            /*** 2011-09-15 END ***/  
See comment to replace the given string. Untested (because currently I can't request that site).
Hi, I'm sorry for bumping this old topic but my request in part uses the above. I just wondered is there a way to make the custom field for the Minecraft Username be unique as I personally would like that feature along with the verifying of the username.
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: [REQ] Verify Minecraft Username

Post by Saldash »

Which ever way you do it, you still can't truly validate the Minecraft username..
All you can do is check to see if the account has bought the game, not whether that person is who they say they are.

I could create a bogus account, use a minecraft username I know has paid and then access your site.
And doubly, because your making it unique, if the real person wanted to sign up they couldn't because they'd already be registered...

It's just a bad way of managing the whole thing..

You'd be better off allowing accounts to be created but put them in a default group with no access...
On a separate page, have the verifier (if the minecraft API will allow it) check the username and password combination. You don't even have to store more than just a check key of 1 or 0. Or if you must you can then store the username..

But as it stands at the moment, your way is very open to misuse.
World Recoded UK - DreamHost Site of the Month winner February 2011!
Locked

Return to “[3.0.x] MOD Requests”