How can i check the mail if is valid
#1

Code:
	if(dialogid == DIALOG_NEWSLETTER2)
	{
        if(!response)
        {
			ShowPlayerDialog(playerid, DIALOG_TICHET, DIALOG_STYLE_MSGBOX, "  ", "{FFFFFF}- Jucator , alege un pachet!\n\n{FFF1AF}[Acest pachet va ofera un bonus de inceput in functie de norocul dvs.]", "Pachet 1", "Pachet 2");
        }
	    if(response)
	    {
    		if( !strlen( inputtext ) ) return 	ShowPlayerDialog(playerid, DIALOG_NEWSLETTER2, DIALOG_STYLE_INPUT, "  ","{FFFFFF}- Jucator , care este adresa de e-mail ?\n\n{FFF1AF}[Va rugam ne furnizati o adresa de e-mail valida deoarece uneori poate fi folosita pentru contact]", "Trimite", "");
			strmid(Mail[playerid], inputtext, 0, strlen(inputtext));
			//format( PlayerInfo[ playerid ][ Mail ], 4, "%s", Mail[ playerid ] );
			ShowPlayerDialog(playerid, DIALOG_TICHET, DIALOG_STYLE_MSGBOX, "  ", "{FFFFFF}- Jucator , alege un pachet!\n\n{FFF1AF}[Acest pachet va ofera un bonus de inceput in functie de norocul dvs.]", "Pachet 1", "Pachet 2");
			return 1;
		}
	}
I want the inputtext is a valid mail to return 0; if isn't return 1; + a scm.
Reply
#2

sscanf > By ****** !

pawn Code:
new F[40], S[20], T[4];
if(sscanf(inputtext, "s[40]p<@>s[20]P<.>s[4]",F, S, T)) return ShowPlayerDialog.... /*Your Dialog here to show again (With error !)*/
change string sizes if you want.
Good Luck
Reply
#3

Matching e-mail addresses is incredibly difficult because there are so many valid combinations. And what about new top level domains which will be, or have been, added like .paris, .berlin, .brussels, .vlaanderen, etc, etc?

I would probably try to parse it through PHP's filter_var via SA-MP's HTTP function.

PHP Code:
<?php
    header
('Content-Type: text/plain');
    echo 
filter_var($_REQUEST['email'], FILTER_VALIDATE_EMAIL);
?>
Very simple. Will return the filtered data (i.e. e-mail address) or FALSE if it's invalid.
Reply
#4

It's possible to instantly in that way get answer? like player in dialog have to write email, and i need to check and write to player it's not valid, if valid continue my functions
Reply
#5

http://forum.sa-mp.com/showpost.php?...7&postcount=23
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)