diff options
Diffstat (limited to 'article.c')
-rwxr-xr-x | article.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/article.c b/article.c deleted file mode 100755 index 85de2ca..0000000 --- a/article.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "main.h" - -int main(void) -{ - char article[50] = "...", *env; - char* tmp_h = NULL; - int num = 0, i; - - env = getenv("QUERY_STRING"); - if(!env || sscanf(env, "article=%d", &num) != 1) - num = 0; - - if( env >= 0) - { - int nb_CR = 0, c; - FILE* fichier = fopen("article/_liste", "r"); - if(!fichier) - erreur("Impossible de charger la page. Veuillez reessayer ultérieurement."); - - for(nb_CR=-1;nb_CR < num && fgets(article, 50, fichier);++nb_CR); - - if(nb_CR != num) - erreur("Article introuvable"); - for(tmp_h=article;*tmp_h;tmp_h++) - if( isspace(*tmp_h) ) - *tmp_h = '\0'; - - } - char date[20], titre[50] = "Vive la lettre H !", ident[50]; - int type = getinfo(article, titre, date, ident); - if( titre ) - start(titre, "Site d'ache : Articles et présentation de mes projets"); - else - start("Ache", "Site d'ache : Articles et présentation de mes projets"); - { // LOG - char chemin[50] = ""; - char command[100] = ""; - time_t rawtime; - struct tm* UTCTime; - FILE* log; - time( &rawtime ); - UTCTime = gmtime( &rawtime ); - sprintf(chemin, "logs/%.2d.%.2d.%.2d.txt", UTCTime->tm_mday, UTCTime->tm_mon, UTCTime->tm_year); - log = fopen(chemin, "a"); - - - if( log ) - { - fprintf(log, "[%.2d:%.2d:%.2d]<%s-%s>%d\n", UTCTime->tm_hour, UTCTime->tm_min, UTCTime->tm_sec, getenv("REMOTE_ADDR"), getenv("HTTP_USER_AGENT"), num); - fclose(log); - } - else - { - printf("Voir %s", chemin); - perror( "Erreur :"); - return 1; - } - if( getenv("REMOTE_ADDR") ) { - sprintf(command, "wget -q -O - ipinfo.io/%s | tr \"\\n\" \" \" | tr -s ' ' >> %s", getenv("REMOTE_ADDR"), chemin); - system(command); - sprintf(command, "echo ' ' >> %s",chemin); - system(command); - } - } - sideBar(); - //sommaire(); - contenu(article, num); - voirAussi(); - end(); - return 0; -} - |