[Tutorial] Send an email from the game
#4

Thank you for the tutorial, although I think you should emphasize a bit more on making the code secure.
What if the player wants to include the &-character in the e-mail? It will get cut off. Or if the player writes a - in the e-mail, it will be converted to a space by the PHP script. I don't understand if this tutorial is necessary at all, at least in such form. I have seen a script that has both issues covered with URL encoding. You could as well send the data as a POST request instead of GET.

Also, code like this:
pawn Код:
public EmailDelivered(index, response_code, data[])//data[] Will contain "Email delivered" see in PHP file
{
    new buffer[128];
    if(response_code == 200)
    {
        format(buffer, sizeof(buffer), "Status: %s", data);//In game will print Status: Email delivered
        SendClientMessage(index, COLOR_SAMP, buffer);
    }
    else
    {
        format(buffer, sizeof(buffer), "Status: Undelivered Response Code: %d", response_code);//Else will print error code, see reference
        SendClientMessage(index, COLOR_SAMP, buffer);
    }
    return 1;
}
... can be simplified to this:
pawn Код:
public EmailDelivered(index, response_code, data[])//data[] Will contain "Email delivered" see in PHP file
{
    new buffer[128];
    if(response_code == 200)
    {
        format(buffer, sizeof(buffer), "Status: %s", data);//In game will print Status: Email delivered
    }
    else
    {
        format(buffer, sizeof(buffer), "Status: Undelivered Response Code: %d", response_code);//Else will print error code, see reference
    }
    SendClientMessage(index, COLOR_SAMP, buffer);
    return 1;
}
Also, for those who are using sscanf, you have given a great idea that came with the functions of SA-MP 0.3b. But why not a working code representation using sscanf?

Good luck!
Reply


Messages In This Thread
Send an email from the game - by ikey07 - 14.06.2012, 20:47
Re: Send an email from the game - by FireCat - 14.06.2012, 20:56
Re: Send an email from the game - by Kirollos - 29.06.2012, 20:34
Re: Send an email from the game - by AndreT - 29.06.2012, 21:01
Re: Send an email from the game - by ikey07 - 01.07.2012, 11:03
Re: Send an email from the game - by Unista - 31.12.2012, 21:12
Re: Send an email from the game - by RedCrossER - 31.12.2012, 21:29
Re: Send an email from the game - by Matt - 12.02.2013, 23:59
Re: Send an email from the game - by freddy smyth - 23.02.2013, 04:09
Re: Send an email from the game - by DLR - 23.02.2013, 11:04

Forum Jump:


Users browsing this thread: 1 Guest(s)