API bot check to help keep the bots out of your webid 2015-05-06

API bot check to help keep the bots out of your webid

  1. jjjason84
    Hello Everyone

    Here is a mod that i used on my script that i have been working on it will help keep the bots from registering on your webid. I have been using this for a long time and i have not had 1 bot register on my script and i would like to share this with webid.

    This is a email domain API check that will check the user email for the @domain.com to see if it is blacklisted in my API database. It does not check the users IP because i don't have any IP address that are needed to be checked. I never had any problems that needed to check the user IP that is registering but i will be adding this later on. This API database is updated from my users that have my script and they can update the database with new domain.com that bots are using or delete the domain.com from the database.

    The user email is not fully sent to the API for security reasons but it will brake down the user email to get the domain.com name and sends the domain.com thought the API to be checked and comes back with a value.

    Open register.php page

    Find this code
    PHP:
    function checkMissing()
    {
        global 
    $missing;
        foreach (
    $missing as $value)
        {
            if (
    $value)
            {
                return 
    true;
            }
        }
        return 
    false;
    }
    Add after
    PHP:
    //Check to see if the user email domain is blacklisted
    function emailblacklist($email
    {
        
    //Split the email and make a array
        
    $email_split explode('@'$email);
        
    // Set the api key so that we can do a domain check
        
    $api_key 'vixgkGHRV1YKJnCXewX9w15x60cJsUwiJ';
        
    //Set the data that is getting sent
        
    $content file_get_contents("https://www.u-auctions.com/api/check.php?action=api-check&email=" $email_split[1] . "&api=" $api_key);
        
    //Decode the json data to get the value
        
    $IsSpammer json_decode($contenttrue); 
        
    //Return the value to the if() statemant 
        //that is checking the user email domain
        
    return $IsSpammer['check'];
    }
    Find this code
    PHP:
    elseif (!empty($birth_month) && !empty($birth_day) && !empty($birth_year) && !checkdate($birth_month$birth_day$birth_year))
            {
                
    $ERR $ERR_117;
            }
            else
            {
    Add after
    PHP:
    // check the email to see if it is blacklisted
                
    if (emailblacklist($_POST['TPL_email']) == "failed")
                {
                    
    //Disposable email detected
                    
    $ERR $ERR_115_a;
                }
    Save and close your register.php page

    Open languages/EN/messages.inc.php

    Add these lines of codes somewhere in the messages.inc.php page.

    PHP:
    $ERR_115_a "The Email Domain Address that you entered is not permitted";
    $MSG['3500_1015416'] = "Email Blacklist";
    Save and close the messages.inc.php

    Now your all done vary simple mod :eek:

    How to View the Full Blacklist
    If you know how to code a webid tpl page you can pull the full list from my API and i will give you the code to pull the list. You will need to do some work on the tpl page because i don't have a webid script running to test this part of the mod.

    Open the themes/admin/sidebar-settings.tpl

    Find this code
    PHP:
    <li><a href="{SITEURL}admin/increments.php">{L_128}</a></li>
                                <
    li><a href="{SITEURL}admin/membertypes.php">{L_25_0169}</a></li>
    Add after
    PHP:
    <li><a href="{SITEURL}admin/blacklist_api.php">{L_3500_1015416}</a></li>
    Save and close the sidebar-settings.tpl

    1. Open the webid api.zip file
    2. Upload the webid api folder from the .zip file to your computer
    3. Open your FTP and connect to your webid directory
    3. Open the webid api folder
    4. Upload the admin and themes to your webid directory
    5. Your done

    The tpl page is vary basic so you will have to edit it to make it look better.