CGI Executable
Posted: 22. February 2008 12:28
How do I get XAMPP to use an executable file as a CGI script? I've written the executable in C, here's the C source code:
and here's the form I'm using:
How do I get XAMPP to treat result.exe as a CGI file?
- Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main() {
char *buf;
printf("%s%c%c\n", "Content-type=text/html;charset:iso-8859-1",13,10);
printf("<html>\n<head>\n<title>CGI EXE</title>\n</head>\n<body>\n<p>");
printf("<h1>Your Form Results:</h1>");
buf = getenv("QUERY_STRING");
if(buf == NULL)
return -1;
printf("My ");
int i = 0;
while(buf[i] != '=')
printf("%c", buf[i++]);
printf(" is: ");
i++;
while(buf[i] != '&')
printf("%c", buf[i++]);
printf("\n\nMy ");
i++;
while(buf[i] != '=')
printf("%c", buf[i++]);
printf(" is: ");
i++;
while(buf[i] != '&')
printf("%c", buf[i++]);
printf("\n</body>\n\n</html>");
return 0;
}
and here's the form I'm using:
- Code: Select all
<form action="result.exe">
<input type="text" name="name" /><br />
<input type="text" name="nickname" /><br />
<input type="submit" value="Click!" />
</form>
How do I get XAMPP to treat result.exe as a CGI file?