Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP] Registration

Junior Spellweaver
Joined
Mar 4, 2009
Messages
165
Reaction score
5
Ok i know i look like a noob but im not ive learned php html and alot more codes.
Can somebody tell me with my registration ppl keep on registering with MOD- in front of there names so can somebdoy tell me how to make them not be able to do that.

Thankyou
 
Joined
Jun 8, 2007
Messages
1,985
Reaction score
490
We don't call people "noob" in this section.

Anyway, it should be able to be solved with a simple conditional statement, no?
PHP:
$message = (string) null; //predefine message string.
$regi_error = (int) null; //predefine registration error counter
if(eregi('mod-',$_POST['user'])==true) //check if the username contains 'mod-' of any case (upper, lower, mixed..)
{
    $message .= 'Your name is invalid.'; //tell users their name is invalid....
    $regi_error++; //add to the registration error counter
}

if($regi_error<1) //Check if there are errors.
{
    //continue checking form...
}

Hope that helps ;)
 
Newbie Spellweaver
Joined
Jan 1, 2009
Messages
46
Reaction score
1
Although EREG functions will not be used anymore in the new PHP version, you should start working with PREG functions
 
Junior Spellweaver
Joined
Mar 4, 2009
Messages
165
Reaction score
5
We don't call people "noob" in this section.

Anyway, it should be able to be solved with a simple conditional statement, no?
PHP:
$message = (string) null; //predefine message string.
$regi_error = (int) null; //predefine registration error counter
if(eregi('mod-',$_POST['user'])==true) //check if the username contains 'mod-' of any case (upper, lower, mixed..)
{
    $message .= 'Your name is invalid.'; //tell users their name is invalid....
    $regi_error++; //add to the registration error counter
}

if($regi_error<1) //Check if there are errors.
{
    //continue checking form...
}

Hope that helps ;)

Thankyou so much it worked!
 
Joined
Jun 8, 2007
Messages
1,985
Reaction score
490
Although EREG functions will not be used anymore in the new PHP version, you should start working with PREG functions

Hmm interesting. i didn't know that. Well I can work with PREG functions.

Well, 321olos, if you decide to upgrade to PHP 5.3, you can put these functions on there and they will let it work. These are not equivalents, but they will work for this purpose.. and most.
PHP:
if(!function_exists(ereg))
{
    function ereg($needle,$haystack)
    {
         return preg_match( '/'.$needle.'/', $haystack );
    }
}

if(!function_exists(eregi))
{
    function eregi($needle,$haystack)
    {
         return preg_match( '/'.strtolower($needle).'/', strtolower($haystack) );
    }
}
If str_ functions still work.. :/:
 
Last edited:
Vous Pas Reel
Loyal Member
Joined
Nov 6, 2007
Messages
880
Reaction score
11
We don't call people "noob" in this section.

Anyway, it should be able to be solved with a simple conditional statement, no?
PHP:
$message = (string) null; //predefine message string.
$regi_error = (int) null; //predefine registration error counter
if(eregi('mod-',$_POST['user'])==true) //check if the username contains 'mod-' of any case (upper, lower, mixed..)
{
    $message .= 'Your name is invalid.'; //tell users their name is invalid....
    $regi_error++; //add to the registration error counter
}

if($regi_error<1) //Check if there are errors.
{
    //continue checking form...
}
Hope that helps ;)
correction you dont, He is infact a noob, he most deffinailty does not know php. This most likely for his hotel.
 
Newbie Spellweaver
Joined
Jan 1, 2009
Messages
46
Reaction score
1
Hmm interesting. i didn't know that. Well I can work with PREG functions.

Well, 321olos, if you decide to upgrade to PHP 6, you can put these functions on there and they will let it work. These are not equivalents, but they will work for this purpose.. and most.
PHP:
if(!function_exists(ereg))
{
    function ereg($needle,$haystack)
    {
         return preg_match( '/'.$needle.'/', $haystack );
    }
}

if(!function_exists(eregi))
{
    function eregi($needle,$haystack)
    {
         return preg_match( '/'.strtolower($needle).'/', strtolower($haystack) );
    }
}
If str_ functions still work.. :/:

I don't know exactly what it was but there was something with em lol. Ofcourse the functions still can be used, but it's not recommended to do (Deprecated Functions).

It already starts at PHP 5.2 -> PHP 5.3

Quote from php.net:
Code:
Deprecated functions: 
ereg() (use preg_match() instead) 
ereg_replace() (use preg_replace() instead) 
eregi() (use preg_match() with the 'i' modifier instead) 
eregi_replace() (use preg_replace() with the 'i' modifier instead)
(and more)
 
Junior Spellweaver
Joined
Mar 4, 2009
Messages
165
Reaction score
5
correction you dont, He is infact a noob, he most deffinailty does not know php. This most likely for his hotel.

I dont have a hotel but i have a small forum that i coded some pages a for and i changed the register around. And when they registered with MOD- in fornt of there names they started deleting ppl. But now they dont :)
 
Back
Top