diff options
| author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-22 16:19:13 +0800 |
|---|---|---|
| committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-22 16:19:13 +0800 |
| commit | 1cbb45492da9a4c5351f3156b00286447a8b014a (patch) | |
| tree | 34d3c17e820b560139116aa9f10ea0dcd93a9021 /login.h | |
| parent | e405b28efceb0865910c3821d92f6f3cb9a6f0be (diff) | |
Login and logout functions
Diffstat (limited to 'login.h')
| -rw-r--r-- | login.h | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -0,0 +1,49 @@ +#ifndef ICCLIENT_LOGIN_H +#define ICCLIENT_LOGIN_H + +#include "request.h" + +inline void login(const char *username, const char *password, const char *verify + , const char *click, const char *successpage, const char *nextpage + , const char *failpage) +{ + struct curl_httppost *post, *last = NULL; + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_username" + , CURLFORM_PTRCONTENTS, username + , CURLFORM_END); + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_password" + , CURLFORM_PTRCONTENTS, password + , CURLFORM_END); + if (verify) + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_verify" + , CURLFORM_PTRCONTENTS, verify + , CURLFORM_END); + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_click" + , CURLFORM_PTRCONTENTS, click + , CURLFORM_END); + if (successpage) + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_successpage" + , CURLFORM_PTRCONTENTS, successpage + , CURLFORM_END); + if (nextpage) + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_nextpage" + , CURLFORM_PTRCONTENTS, nextpage + , CURLFORM_END); + if (failpage) + curl_formadd(&post, &last + , CURLFORM_COPYNAME, "mv_failpage" + , CURLFORM_PTRCONTENTS, failpage + , CURLFORM_END); + last = NULL; + request(NULL, NULL, post, "%s", "process"); + curl_formfree(post); + post = NULL; +} + +#endif // ICCLIENT_LOGIN_H |