Retourner au contenu associé (journal : Mon serveur Web)
Posté par andeus le 07 juin 2007 à 03:41. En réponse au journal Mon serveur Web. Évalué à 10.
#!/usr/bin/php5 HTTP/1.0 403 Forbidden Date: <?php echo date(DATE_RFC822)."\r\n"; ?> Server: Apache Content-Type: text/html <?php readfile('/var/www/blacklisted/index.html'); ?>
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #define STATUS "HTTP/1.0 403 Forbidden" #define SERVER "Apache" #define CONTENT_TYPE "text/html" #define PAGE_FILE "/var/www/blacklisted/index.html" int main(int argc, char *argv[]) { char date[50]; time_t t; struct tm *tmp; FILE *fp; char line[1024]; t = time(NULL); tmp = localtime(&t); strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", tmp); printf("%s\r\n", STATUS); printf("Date: %s\r\n", date); printf("Server: %s\r\n", SERVER); printf("Content-Type: %s\r\n", CONTENT_TYPE); printf("\r\n"); if ((fp = fopen(PAGE_FILE, "r")) == NULL) { perror("Could not read file"); return 1; } while (fgets(line, 1024, fp) != NULL) { printf("%s", line); } fclose(fp); return 0; }
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Re: Optimisations:
Posté par andeus . En réponse au journal Mon serveur Web. Évalué à 10.
Sinon en PHP, 0 fork:
Ou en C: