29.06.2012, 21:01
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:
... can be simplified to this:
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!
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;
}
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;
}
Good luck!