hopingsteam

Trimitere request HTTP

Jun 10th, 2018
197
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function FunctieNoua(index, response_code, data[])
  2. {
  3.     new string[128];
  4.     if(response_code == 200)
  5.     {
  6.         format(string, sizeof(string), "Mesaj: %s", data);
  7.         SendClientMessage(index, -1, string);
  8.     }
  9.     else
  10.     {
  11.         format(string, sizeof(string), "NU S-A TRIMIS: %d", response_code);
  12.         SendClientMessage(index, -1, string);
  13.     }
  14. }
  15.  
  16. function LoadAccount(playerid)
  17. {
  18.     new queryyy[312];
  19.     new playerIP[64], playerGPCI[64], stringAfisare[256];
  20.     GetPlayerIp(playerid, playerIP, sizeof(playerIP));
  21.     gpci(playerid, playerGPCI, sizeof(playerGPCI));
  22.  
  23.     format(stringAfisare, sizeof(stringAfisare), "OLD IP: %s | NEW IP: %s", PlayerInfo[playerid][pLastIP], playerIP);
  24.     SendClientMessage(playerid, -1, stringAfisare);
  25.  
  26.     format(stringAfisare, sizeof(stringAfisare), "OLD GPCI: %s | NEW GPCI: %s", PlayerInfo[playerid][pLastGPCI], playerGPCI);
  27.     SendClientMessage(playerid, -1, stringAfisare);
  28.  
  29.     if(strcmp(PlayerInfo[playerid][pLastIP], playerIP) || strcmp(PlayerInfo[playerid][pLastGPCI], playerGPCI))
  30.     { // Daca cele doua ip-uri sunt diferite sau cele doua GPCI
  31.         if(!strcmp(PlayerInfo[playerid][pLastIP], "0") && !strcmp(PlayerInfo[playerid][pLastGPCI], "0"))
  32.             SendClientMessage(playerid, -1, "Totul e pe zero");
  33.         else
  34.         {
  35.             new text[128], string[128];
  36.             format(text, sizeof(text), "A-fost-detectata-o-noua-logare-de-pe-alt-calculator!!!");
  37.             format(string, sizeof(string), "drpciv.online/testSAMP.php?code=12345&msg=%s", text);
  38.  
  39.             HTTP(playerid, HTTP_GET, string, "", "FunctieNoua");
  40.             SendClientMessage(playerid, -1, "S-a trimis request-ul");
  41.             SendClientMessage(playerid, -1, string);
  42.         }
  43.     }
  44.  
  45.     mysql_format(SQL, queryyy, sizeof(queryyy), "UPDATE usersdata SET LastIP='%s', GPCI='%s' WHERE pID = %d", playerIP, playerGPCI,PlayerInfo[playerid][pMySQLID]);
  46.     mysql_tquery(SQL, queryyy, "", "");
  47.  
  48.  
  49.     format(stringAfisare, sizeof(stringAfisare), "IP: %s | GPCI: %s", playerIP, playerGPCI);
  50.     printf(stringAfisare);
  51. }
RAW Paste Data