Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.    
  8.     string delimiter = "=";
  9.     string request_uri = getenv("QUERY_STRING");
  10.     string key_val = request_uri;
  11.     string token = key_val.substr(0, key_val.find(delimiter));
  12.     cout << "Content-type:text/html\r\n\r\n";
  13.     cout << "<html>\n";
  14.     cout << "<head>\n";
  15.     cout << "<title>Hello World - First CGI Program</title>\n";
  16.     cout << "</head>\n";
  17.     cout << "<body>\n";
  18.     cout << "token:\t\n" + token << "\n" << endl;
  19.     cout << "Referrer:\t\n" << getenv("HTTP_REFERER") <<  "\n" << endl;
  20.     cout << "QUERY_STRING:\t\n" +request_uri << "\n" <<  endl;
  21.     cout << "<h2>Hello World! This is my first CGI program</h2>\n";
  22. //    cout << "<script>alert(1)</script>";
  23.    
  24.     cout << "</body>\n";
  25.     cout << "</html>\n";
  26.    
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement