Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

PHP check username

Hi... I've modified my forum quite a bit so far... there are just a couple of things I'd like.
is there any way to confirm the usernames via an external source?

I don't really know OOP that well but I can do the basics and read it (just about) and I figure the script that needs editing is applications/dashboard/controllers/class.entrycontroller.php

the external site you can visit a page www.whatever.com/page.php?user= will either return true or false... pretty simple, just file_get_contents, or cURL or whatever and if == true then do whatever else display error.

just not sure what/where to add this?

any help would be great

Comments

  • If you are looking to have another site authenticating your Users, you should adopt a Single Sign On solution, such as ProxyConnect or JsConnect.

    From a more general perspective, you should not modify core files, unless absolutely necessary, as any update could overwrite and break your changes. The correct way of altering and extending Vanilla is by implementing plugins.

  • no not having an external site do anything, trying to query the external site to confirm that their username is their in-game name.

    I'm happy to modify core files if it's necessary... or make a plugin. from browsing here it seems I need to create a function ValidateMyCustomRule($Value) {
    somewhere... still not sure where or how to do it.

  • [update] ok I worked it out.. on line 1576 of applications/dashboard/models/class.usermodel.php I added:

    if (C('Garden.Registration.NameUnique', TRUE) && $Username) {
    $Where['Name'] = $Username;
    $sRes= file_get_contents( 'http://www.website.com/info.php?user='. rawurlencode( $Where['Name'] ) );
    if( strpos( $sRes, 'true' )=== FALSE ){
    $this->Validation->AddValidationResult('Name', 'The name you entered is not a valid Minecraft account.');
    $Valid = FALSE;
    }
    unset($Where['Name']);
    }

    and it works! :D

  • Read up on plugins, you can add any method to the entry controller with a plugin using create.

    Gdn::Session()->IsValid(); and Gdn::Session()->User->Name; will help

    grep is your friend.

Sign In or Register to comment.