Advertisement
Guest User

Untitled

a guest
May 11th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.77 KB | None | 0 0
  1. /* BrotherBand Library version 1.0.0.0 */
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <sys/types.h>
  5. #include <sys/sockets.h>
  6. #include <netinet/in.h>
  7.  
  8. #define CLIENTCODE 1
  9.  
  10. /*****************************************/
  11. /*     BrotherBand API Device Codes      */
  12. /*****************************************/
  13. #define DEVNDS 1
  14. #define DEVPSP 2
  15. #define DEVPANDORA 3
  16.  
  17. /**************************************************/
  18. /*     BrotherBand API Versioning / UserAgents    */
  19. /**************************************************/
  20. #define DSAgent "Nintendo DS/MENUdo"
  21. #define PSPAgent "Sony PSP/MENUdo"
  22. #define Pandora "Pandora/MENUdo"
  23. #define ProtocolVersion 1001
  24.  
  25. /*****************************************/
  26. /*      BrotherBand API Status Codes     */
  27. /*****************************************/
  28. #define REQUESTOK 200
  29. #define REQUESTFAIL 500
  30. #define UNAUTHORIZED 403
  31. #define NOTFOUND 404
  32. #define MENUDOACTIVATE 192
  33. #define MENUDOCLIENT 300
  34. #define NONMENUDO 301
  35. #define MENUDOUPDATE 101
  36. #define NOUPDATE 102
  37. #define BROTHERALREADYEXIST 202
  38. #define BROTHERNOTEXIST 203
  39. #define ACHIEVEMENTEXISTS 700
  40.  
  41. /**********************************************/
  42. /*      BrotherBand API General Constants     */
  43. /**********************************************/
  44. #define SAVE_PUBLIC 1
  45. #define SAVE_PRIVATE 0
  46.  
  47.  
  48. struct UserData
  49. {
  50. char Password[255];
  51. char Username[255];
  52. int GamesPlayed;
  53. char mySID[255];
  54. int UserID;
  55. char BrotherInfo[255];
  56. int CurrentTeamID;
  57. char DisplayName[255];
  58. char CustomTitle[255];
  59. char SiteAvatar[255];
  60. char BrotherIDs[255];
  61. }
  62. struct UserData myInfo;
  63. void Login(char Username[255], char Password[255])
  64. {
  65.     int sockfd, portno, n;
  66.     struct sockaddr_in serv_addr;
  67.     struct hostent *server;
  68.     portno = htons(80);
  69.     sockfd = socket(AF_INET, SOCK_STREAM, 0);
  70.     server = gethostbyname("gamenow.asia");
  71.     bzero((char *) &serv_addr, sizeof(serv_addr));
  72.     serv_addr.sin_family = AF_INET;
  73.     bcopy((char *)server->h_addr,
  74.          (char *)&serv_addr.sin_addr.s_addr,
  75.          server->h_length);
  76.     serv_addr.sin_port = (portno);
  77.     if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0)
  78.         #Error Connecting here...
  79.     printf("Error Connecting to Gamenow.Asia");
  80.     char request[255];
  81.     char fullrequest[255];
  82.     sprintf(request,"action=2&username=%s&password=%s",Username,Password);
  83.     sprintf(fullrequest,"POST /mWifi/index.php HTTP/1.1\r\nHost: gamenow.asia\r\nContent-Type: applicationx-www-form-urlencoded\r\nContent-Length:%s\r\n\r\n%s",strlen(request),request);
  84.     n = write(sockfd,fullrequest,strlen(request));
  85.     n = read(sockfd,buffer,255);
  86.     if(buffer != "") {
  87.         myInfo.Username == Username;
  88.         myInfo.Password == Password;
  89.         myInfo.mySID == buffer;
  90.         return buffer;
  91.        
  92.     } else {
  93.         return false;
  94.     }
  95. }
  96.  
  97. void <-- Was making another function and forgot to finish, this would be LoginSID.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement