summaryrefslogtreecommitdiff
path: root/ws2a/showbug.c
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-29 20:52:17 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-29 20:52:17 -0400
commit15fcc190319a3deaaeaa544833ea07475e790585 (patch)
tree25b9ad86998682bb0d270521ef9efa00c0047d8a /ws2a/showbug.c
parent785ac61778829e572556f4c9f40026e6b624e81e (diff)
downloadwebpage-15fcc190319a3deaaeaa544833ea07475e790585.tar.gz
webpage-15fcc190319a3deaaeaa544833ea07475e790585.tar.bz2
webpage-15fcc190319a3deaaeaa544833ea07475e790585.zip
re-synching
Diffstat (limited to 'ws2a/showbug.c')
-rw-r--r--ws2a/showbug.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/ws2a/showbug.c b/ws2a/showbug.c
deleted file mode 100644
index 27a01e6..0000000
--- a/ws2a/showbug.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdint.h>
-
-int main(){
- char* data = getenv("QUERY_STRING");
- //char data[20] = "?id=1";
- char* hardip = getenv("REMOTE_ADDR");
- printf("%s%c%c\n",
- "Content-Type:text/html;charset=iso-8859-1",13,10);
- FILE* lastfilenum;
- lastfilenum = fopen("../ws2a/bugs/lastbug","r");
- if(lastfilenum == NULL){
- printf("Error reteriveing bugs, contact the admin!");
- return 1;
- }
- long long last = 0;
- if(fscanf(lastfilenum,"%lld",&last) < 1){
- printf("Error finding file id");
- return 1;
- }
- fclose(lastfilenum);
- long long thisid = 0;
- sscanf(data,"id=%lld",&thisid);
- if(thisid > last){
- printf("Invalid!");
- return 1;
- }
-
- char filestring[64] = "../ws2a/bugs/";
- char filename[10];
- sprintf(filename,"%lld",thisid);
- strcat(filestring,filename);
- FILE* bugfile;
- bugfile = fopen(filestring,"r");
- if(bugfile == NULL){
- printf("Unable to open bug file!");
- return 1;
- }
- while(!feof(bugfile)){
- char c = fgetc(bugfile);
- if(feof(bugfile)){
- break;
- }else{
- putchar(c);
- }
- }
- fclose(bugfile);
- return 0;
-}