Guest User

Untitled

a guest
Nov 7th, 2022
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CLIENT CODE:
  2. function Login()
  3. {
  4.     form f = {username, password};
  5.     WWW request = SendRequest("https:/.../login.php", f);
  6.  
  7.     wait request;
  8.  
  9.     if(request.error != NULL || request.message == "ERROR")
  10.         return "Error";
  11.     else
  12.         {
  13.             if(request.message == "LOGIN_OK")
  14.                 GoForwardAndLoadNextThing();
  15.         }
  16. }
  17.  
  18.  
  19. SERVER CODE:
  20. function ProcessLogin(form f)
  21. {
  22.     Query q = SELECT username WHERE user = f.user AND password = f.password;
  23.    
  24.     QueryResult result;
  25.     q.DoQuery(result);
  26.    
  27.     // If there was a match
  28.     if(result != 0)
  29.         die("LOGIN_OK")
  30.     else
  31.         die("ERROR");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment