summaryrefslogtreecommitdiff
path: root/member.c
blob: b8076d0fde493e5cecf604c4e55dc98b14539843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include <stddef.h>
#include <stdbool.h>
#include "login.h"
#include "icclient/member.h"

void icclient_member_newaccount(size_t (*handler)(void *, size_t, size_t, void *),
		struct icclient_member *member, const char *username, const char *password,
		const char *verify, const char *successpage, const char *nextpage,
		const char *failpage)
{
	login(handler, member, username, password, verify, "NewAccount", successpage,
			nextpage, failpage);
}

void icclient_member_login(size_t (*handler)(void *, size_t, size_t, void *),
		struct icclient_member *member, const char *username, const char *password,
		const char *successpage, const char *nextpage, const char *failpage)
{
	login(handler, member, username, password, NULL, "Login", successpage, nextpage,
			failpage);
}

void icclient_member_account(const char *fname, const char *lname, const char *address1,
		const char *address2, const char *city, const char *state,
		const char *zip, const char *email, const char *phone_day)
{
	struct curl_httppost *post, *last = NULL;
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_form_profile",
			CURLFORM_COPYCONTENTS, "account_change",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_todo",
			CURLFORM_COPYCONTENTS, "return",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_nextpage",
			CURLFORM_COPYCONTENTS, "member/account",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_check",
			CURLFORM_COPYCONTENTS, "Save_database",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "fname",
			CURLFORM_PTRCONTENTS, fname,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "lname",
			CURLFORM_PTRCONTENTS, lname,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "address1",
			CURLFORM_PTRCONTENTS, address1,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "address2",
			CURLFORM_PTRCONTENTS, address2,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "city",
			CURLFORM_PTRCONTENTS, city,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "state",
			CURLFORM_PTRCONTENTS, state,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "zip",
			CURLFORM_PTRCONTENTS, zip,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "email",
			CURLFORM_PTRCONTENTS, email,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "phone_day",
			CURLFORM_PTRCONTENTS, phone_day,
			CURLFORM_END);
	last = NULL;
	request(NULL, NULL, post, "%s", "process");
	curl_formfree(post);
	post = NULL;
}

void icclient_member_changepassword(const char *password_old, const char *password,
		const char *verify)
{
	struct curl_httppost *post, *last = NULL;
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_action",
			CURLFORM_COPYCONTENTS, "return",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_check",
			CURLFORM_COPYCONTENTS, "Change_password",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_successpage",
			CURLFORM_COPYCONTENTS, "member/service",
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_password_old",
			CURLFORM_PTRCONTENTS, password_old,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_password",
			CURLFORM_PTRCONTENTS, password,
			CURLFORM_END);
	curl_formadd(&post, &last,
			CURLFORM_COPYNAME, "mv_verify",
			CURLFORM_PTRCONTENTS, verify,
			CURLFORM_END);
	last = NULL;
	request(NULL, NULL, post, "%s", "member/change_password");
	curl_formfree(post);
	post = NULL;
}

void icclient_member_logout()
{
	request(NULL, NULL, NULL, "%s", "logout");
}