summaryrefslogtreecommitdiff
path: root/ws2a
diff options
context:
space:
mode:
authorAlexander Pickering <Apickx@cogarr.org>2016-05-10 18:46:41 -0400
committerAlexander Pickering <Apickx@cogarr.org>2016-05-10 18:46:41 -0400
commit42c8e5653278be76c9621204a9558cb3db6f7c80 (patch)
treece3d122e6cc7c43adb8bb2d0d0a90614c8189856 /ws2a
parent6e8180b01a152119cec2cd2f6a13bc72220d7942 (diff)
parentecd2cf4f930853c13c23f5a35bb1a2610bcb54c9 (diff)
downloadwebpage-42c8e5653278be76c9621204a9558cb3db6f7c80.tar.gz
webpage-42c8e5653278be76c9621204a9558cb3db6f7c80.tar.bz2
webpage-42c8e5653278be76c9621204a9558cb3db6f7c80.zip
Merge branch 'development'
Diffstat (limited to 'ws2a')
-rw-r--r--ws2a/bugcomment.c53
-rw-r--r--ws2a/bugview.html4
-rw-r--r--ws2a/gencaptcha.c20
3 files changed, 66 insertions, 11 deletions
diff --git a/ws2a/bugcomment.c b/ws2a/bugcomment.c
new file mode 100644
index 0000000..10df1d1
--- /dev/null
+++ b/ws2a/bugcomment.c
@@ -0,0 +1,53 @@
+#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);
+ printf("data:%s",data);
+ /*
+ 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;
+}
diff --git a/ws2a/bugview.html b/ws2a/bugview.html
index 692373b..9653a63 100644
--- a/ws2a/bugview.html
+++ b/ws2a/bugview.html
@@ -70,12 +70,12 @@
</div>
<div class="container">
- <form class="form-signin">
+ <form class="form-signin" action="/cgi-bin/bugcomment.cgi">
<h2 class="form-signin-heading">Leave a comment</h2>
<label for="inputName" class="sr-only">Name</label>
<input id="inputName" class="form-control" placeholder="Screen Name" required="" autofocus="" type="text">
<label for="inputID" class="sr-only">Identifier</label>
- <input id="inputID" class="form-control" placeholder="Password" required="" type="password">
+ <input id="inputID" class="form-control" placeholder="Identifier" required="" type="password">
<textarea name="comment" rows="5" cols="50"></textarea>
<div id="captcha"></div>
<input id="solvecaptcha" class="form-control" placeholder="captcha" type="text">
diff --git a/ws2a/gencaptcha.c b/ws2a/gencaptcha.c
index c21e6ef..7ab063a 100644
--- a/ws2a/gencaptcha.c
+++ b/ws2a/gencaptcha.c
@@ -67,7 +67,7 @@ int main(){
int barraldis1 = rand()%10;
int barraldis2 = rand()%10;
- int arcdis = (rand()%99)+1;
+ int arcdis = (rand()%45)+45;
char command[1024];
unsigned long rhash = hash(randwords);
sprintf(command,"convert -background white -fill black -pointsize 48 label:\"%s\" \"/home/git/wswebpage/ws2a/captchas/%lu.png\"",randwords,rhash);
@@ -76,14 +76,16 @@ int main(){
system(command);
sprintf(command,"convert \"/home/git/wswebpage/ws2a/captchas/%lu.png\" -virtual-pixel White -distort Arc %d \"/home/git/wswebpage/ws2a/captchas/%lu.png\"",rhash,arcdis,rhash);
system(command);
-
+
printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
printf("%lu",rhash);
- /*
- char c;
- while((c = fgetc(imgfile)) && !feof(imgfile)){
- printf("char is:something\n",c);
- //putchar(c);
- }
- */
+
+ FILE* tfile;
+ char filepath[100];
+ sprintf(filepath,"/home/git/wswebpage/ws2a/captchas/%s.txt",randwords);
+ tfile = fopen(filepath,"w");
+ fprintf(tfile,rhash);
+ fclose(tfile);
+
+ return 0;
}