Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string delimiter = "=";
- string request_uri = getenv("QUERY_STRING");
- string key_val = request_uri;
- string token = key_val.substr(0, key_val.find(delimiter));
- cout << "Content-type:text/html\r\n\r\n";
- cout << "<html>\n";
- cout << "<head>\n";
- cout << "<title>Hello World - First CGI Program</title>\n";
- cout << "</head>\n";
- cout << "<body>\n";
- cout << "token:\t\n" + token << "\n" << endl;
- cout << "Referrer:\t\n" << getenv("HTTP_REFERER") << "\n" << endl;
- cout << "QUERY_STRING:\t\n" +request_uri << "\n" << endl;
- cout << "<h2>Hello World! This is my first CGI program</h2>\n";
- // cout << "<script>alert(1)</script>";
- cout << "</body>\n";
- cout << "</html>\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement