CGI pour Apache pour le portail captif
darcs-hash:20051109125931-d1718-3e16c1da886636e4ae382b516f6af9f186c70777.gz
This commit is contained in:
parent
bd0bb1f1bf
commit
d51e0595a8
1 changed files with 27 additions and 0 deletions
27
wifi/addip.c
Normal file
27
wifi/addip.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
FILE *fd;
|
||||
char *ip;
|
||||
|
||||
if ((fd = fopen("/hotspot.socket", "a")) == NULL)
|
||||
goto erreur;
|
||||
|
||||
if ((ip = getenv("REMOTE_ADDR")) == NULL)
|
||||
goto erreur;
|
||||
|
||||
fprintf(fd, "%s\n", ip);
|
||||
fflush(fd);
|
||||
fclose(fd);
|
||||
|
||||
printf("Location: https://wifi.crans.org/captifauthok.html\r\n");
|
||||
printf("\r\n");
|
||||
return 0;
|
||||
|
||||
erreur:
|
||||
printf("Location: https://wifi.crans.org/captiferreur.html\r\n");
|
||||
printf("\r\n");
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue