1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(void)
{
char *dt;
time_t timer;
char time_str[25];
struct tm* tm_info;
dt=getenv("QUERY_STRING");
time(&timer);
tm_info = localtime(&timer);
strftime(time_str, sizeof(time_str), "%Y/%m/%d %H:%M:%S", tm_info);
/* Without this line, you will get 500 error */
puts("Content-type: text/html\n");
puts("<!DOCTYPE html>");
puts("<head>");
puts(" <meta charset=\"utf-8\">");
puts("</head>");
puts("<body>");
puts(" <h3>Hello world!</h3>");
printf(" <p>%s</p>\n", time_str);
if (dt!=NULL)
printf("%s\n",dt);
puts("</body>");
puts("</html>");
//traiter if url
//////////////////
system("/usr/sbin/runuser -l user -c '/usr/bin/vboxmanage startvm {6e6e342b-b65e-43fa-a842-bd9118c5e0ad} --type headless'");
return 0;
} |
Partager