phpist

Untitled

Oct 6th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <stdio.h> // Включаем функции ввода/вывода
  2. #include <stdlib.h> // Включаем функцию getenv()
  3.  
  4. int main(void) {
  5. // получаем значение переменной окружения REMOTE_ADDR
  6. char *remote_addr = getenv("REMOTE_ADDR");
  7. // ... и еще QUERY_STRING
  8. char *query_string = getenv("QUERY_STRING");
  9. // печатаем заголовок
  10. printf("Content-type: text/html\n\n");
  11. // печатаем документ
  12. printf("<!DOCTYPE html>");
  13. printf("<html lang='ru'>");
  14. printf("<head>");
  15. printf("<title>Работа с переменными окружения</title>");
  16. printf("<meta charset='utf-8'>");
  17. printf("</head>");
  18. printf("<body>");
  19. printf("<h1>Здравствуйте. Мы знаем о Вас все!</h1>");
  20. printf("<p>Ваш IP-адрес: %s</p>", remote_addr);
  21. printf("</p>Вот параметры, которые Вы указали: %s</p>", query_string);
  22. printf("</body></html>");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment