Hi,
I have an problem with CGI. I have created an C script (attached to mail),
just to test it and to make an "internet elevation" - an general ask with
answers yes / no.
I compiled this program gcc -o /usr/local/apache/cgi-bin/anone anone.c;
when I tried it directly, with seted enviroment variable AN everithing
works OK, but when I tried it from WWW, I got error 500.
How can I to solve my problem? Where in this problem?
---
This was my first CGI script, I have no expiriences.....
---
Thanx
+-----------------------------------+
| |
| Radim HABALA |
| |
| e-mail: [EMAIL PROTECTED] |
| |
| Englisova 13, OPAVA, 746 01 |
| Czech Republic (Europe) |
| |
| tel : (0653) 21 46 34 |
| |
+-----------------------------------+
#include<stdio.h>
#include<stdlib.h>
char *an;
int ka=0;
int kn=0;
FILE *soubor;
main()
{
printf("Content-type: text/plain\n\n");
if ((an = getenv("AN"))==NULL)
{
printf ("AN not found");
};
soubor = (FILE *)fopen("HLASUJ", "r");
if (soubor!=NULL)
{
fscanf(soubor, "%d %d", &ka, &kn);
fclose(soubor);
}
if (an[0]=='A') ka++;
else kn++;
soubor = (FILE *)fopen("HLASUJ", "w");
fprintf(soubor, "%d %d", ka, kn);
fclose(soubor);
printf("<HTML><BODY>Ano: %d, Ne: %d</BODY></HTML>",ka,kn);
}
<HTML>
<BODY>
<FORM ACTION="/cgi-bin/anone?FN=A" METHOD="GET">
Ano <INPUT TYPE="radio" NAME="AN" VALUE="ANO">
Ne <INPUT TYPE="radio" NAME="AN" VALUE="NE">
<INPUT TYPE="submit" VALUE="Odesli">