How to make a Roleplay name checker on PHP?
#1

Hello there, I'm actually a starter on PHP. today I want to make a RP name checker for my UCP registration. I tried like 2 hours and searching randomly on ****** I can't find the shit.. Who can give me a help? and make a function for me?


I made a function but It does not working!!

PHP код:
function IsValidRPName($string)
{
    if( 
stristr$string '_' ) )
        
$_explodedName explode"_" $string );
    else return 
false;
    for (
$i 0$i $firstName$i++)
    {
        if( !
ctype_upper $_explodedName][ ] ) )
            return 
false;
        else if( !
$i )
            continue;
        else if( 
ctype_upper$_explodedName][ $i ] ) )
            return 
false;
    }
    for (
$i 0$i $lastName$i++)
    {
        if(!
ctype_upper($_explodedName][ ] ) )
            return 
false;
        else if( !
$i )
            continue;
        else if( 
ctype_upper$_explodedName][ $i ] ) )
            return 
false;
    }
    if( 
count$_explodedName ) < || strlen$Name] ) < || strlen($_explodedName]) < || strlen$string ) >= 25 )
        return 
false;
    else
        return 
true;

Reply
#2

bump plzzzzzz
Reply
#3

This could help you out: https://sampforum.blast.hk/showthread.php?tid=309062
Reply
#4

This is not a PHP help forum. Regardless:
PHP код:
function IsValidName($name)
{
    return 
preg_match("/^[A-Z]{1}[A-Za-z]+_[A-Z]{1}[A-Za-z]+$/"$name);

Test and experiment with regular expressions here: http://regexr.com/ and read more about preg_match here: http://php.net/manual/en/function.preg-match.php
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)