aboutsummaryrefslogtreecommitdiff
path: root/cforum.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-09-18 01:52:04 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-09-18 01:52:04 +0200
commit24bf14f6653ebf1c1ba79b9f212d35417bb6acbf (patch)
tree913a0f1bebf835a1109652b1c61d363972ee9a28 /cforum.c
parente25f56cbe86041d4ab19e474e38032fa7e681ac7 (diff)
downloadcforum-24bf14f6653ebf1c1ba79b9f212d35417bb6acbf.tar.gz
Implement attachments
Diffstat (limited to 'cforum.c')
-rw-r--r--cforum.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/cforum.c b/cforum.c
index 2997ced..dbf320c 100644
--- a/cforum.c
+++ b/cforum.c
@@ -15,7 +15,7 @@ int
main(int argc, char *argv[])
{
char err[MAXERR], *p, *qs, *v;
- int postid, userid;
+ int attachmentid, postid, userid;
sqlite3_stmt *stmt;
/*
@@ -70,15 +70,21 @@ main(int argc, char *argv[])
}
/* Parse query string. */
- postid = userid = 0;
+ attachmentid = postid = userid = 0;
while(p = nextparam(GET, 128)){
v = split(p);
- if(!postid && strcmp(p, "post") == 0) postid = atoi(v);
- else if(!userid && strcmp(p, "user") == 0) userid = atoi(v);
+ if(!attachmentid && strcmp(p, "attachment") == 0)
+ attachmentid = atoi(v);
+ else if(!postid && strcmp(p, "post") == 0)
+ postid = atoi(v);
+ else if(!userid && strcmp(p, "user") == 0)
+ userid = atoi(v);
}
/* Handle request. */
- if(postid)
+ if(attachmentid)
+ showattachment(attachmentid);
+ else if(postid)
showpost(postid);
else if(userid)
showuser(userid);