diff options
author | John Ankarström <john@ankarstrom.se> | 2021-09-18 01:52:04 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-09-18 01:52:04 +0200 |
commit | 24bf14f6653ebf1c1ba79b9f212d35417bb6acbf (patch) | |
tree | 913a0f1bebf835a1109652b1c61d363972ee9a28 /cforum.c | |
parent | e25f56cbe86041d4ab19e474e38032fa7e681ac7 (diff) | |
download | cforum-24bf14f6653ebf1c1ba79b9f212d35417bb6acbf.tar.gz |
Implement attachments
Diffstat (limited to 'cforum.c')
-rw-r--r-- | cforum.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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); |