tag mismatch
#1

How to Fix This?

Код:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail] && strcmp(email, inputtext))
				{
	                SendClientMessage(playerid, COLOR_RED, "You have entered an unmatching email address.");

					return 1;
				}
i get this error!
Код:
warning 213: tag mismatch
Reply
#2

Show your code for IsValidEmail. Assuming it returns true or false,

PHP код:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail
Does not make sense.
Reply
#3

Код:
#define IsValidEmail(%1) \
	regex_match(%1, "[a-zA-Z0-9_\\.]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4}")
THIS
Reply
#4

You can't do:
PHP код:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail
Just check if the input matches with the variable. But if you also want to check if it's a valid e-mail:

PHP код:
stock IsValidEmailEx(const string[])
{
    static
        
RegEx:rEmail
    
;
    
    if ( !
rEmail )
    {        
        
rEmail regex_build("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
    }
    
    return 
regex_match_exid(stringrEmail);
}
main()
{        
    
printf("ValidEmail: %s"IsValidEmailEx("test@test.test") ? ("true") : ("false"));
    
printf("Non ValidEmail: %s", !IsValidEmailEx("t[e]st@test.test") ? ("true") : ("false"));

Source: https://sampforum.blast.hk/showthread.php?tid=247893

You code would end up looking like:

PHP код:
if(!IsValidEmailEx(inputtext) || strcmp(emailinputtexttrue))
{
     return 
1;

You used && but that means it needs to be an invalid e-mail and not a match. Using ||, it will work if it's either an invalid e-mail or if there isn't a match.
Reply
#5

I see, but a code im doing is to match the email address he gave when he registered and match it when he forgot his password.
Reply
#6

You can't compare strings using "==", here you have to use "strcmp" function. Unless the pEmail is not actually his email stored in a string in which case I could be wrong as to what exactly is the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)