SA-MP Forums Archive
How can i check the mail if is valid - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How can i check the mail if is valid (/showthread.php?tid=547789)



How can i check the mail if is valid - Metharon - 25.11.2014

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.


Re: How can i check the mail if is valid - M4D - 25.11.2014

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


Re: How can i check the mail if is valid - Vince - 25.11.2014

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.


Re: How can i check the mail if is valid - MerryDeer - 09.09.2016

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


Re: How can i check the mail if is valid - SickAttack - 09.09.2016

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