-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.php
244 lines (191 loc) · 9.27 KB
/
test.php
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php require_once 'core/core.php'; ?>
<html>
<head>
<title>Creo un SITO WEB da Zero #08 ⋆ ESEMPIO di BACK-END (custom)</title>
</head>
<body>
<?php if (!$USER) : ?>
<h1>LOGIN</h1>
<form method="POST">
<input type="text" name="username" placeholder="username">
<input type="password" name="password" placeholder="password">
<input type="submit" value="LOGIN">
</form>
<?php else : ?>
<h1>LOGOUT</h1>
<form method="POST">
<?php echo $USER->username; ?>
(<span><?php echo $USER->role; ?></span>)
<input type="hidden" name="logout">
<input type="submit" value="LOGOUT">
</form>
<hr/>
<h1>TAG</h1>
<form method="GET" action="/tutorial/ep8/rest/getalltags.php">
<input type="submit" value="GET ALL TAGS">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/addtag.php">
<input type="text" name="tag" placeholder="tag">
<input type="submit" value="ADD TAG">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/deletetag.php">
<input type="number" name="tag" placeholder="tag id">
<input type="submit" value="DELETE TAG">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/edittag.php">
<input type="number" name="id" placeholder="tag id">
<input type="text" name="tag" placeholder="tag">
<input type="number" name="weight" placeholder="tag weight">
<input type="submit" value="EDIT TAG">
</form>
<hr/>
<h1>CATEGORY</h1>
<form method="GET" action="/tutorial/ep8/rest/getcategories.php">
<input type="number" name="offset" placeholder="offset">
<input type="submit" value="GET CATEGORIES">
</form>
<br/>
<form enctype="multipart/form-data" method="POST" action="/tutorial/ep8/rest/addcategory.php">
<input type="text" name="title" placeholder="title">
<textarea name="description" placeholder="description"></textarea>
<input type="file" name="file" placeholder="cover">
<input type="submit" value="ADD CATEGORY">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/deletecategory.php">
<input type="number" name="category" placeholder="category id">
<input type="submit" value="DELETE CATEGORY">
</form>
<br/>
<form enctype="multipart/form-data" method="POST" action="/tutorial/ep8/rest/editcategory.php">
<input type="number" name="id" placeholder="category id">
<input type="text" name="title" placeholder="title">
<textarea name="description" placeholder="description"></textarea>
<input type="file" name="file" placeholder="cover">
<input type="submit" value="EDIT CATEGORY">
</form>
<hr/>
<h1>POST</h1>
<form method="GET" action="/tutorial/ep8/rest/getlatestpostsbycategory.php">
<input type="text" name="p" placeholder="category permalink">
<input type="submit" value="GET LATEST POSTS by CATEGORY PERMALINK">
</form>
<br/>
<form method="GET" action="/tutorial/ep8/rest/getpostbypermalink.php">
<input type="text" name="p" placeholder="post permalink">
<input type="submit" value="GET POST by PERMALINK">
</form>
<br/>
<form method="GET" action="/tutorial/ep8/rest/getpostsbytag.php">
<input type="text" name="t" placeholder="tag permalink">
<input type="number" name="offset" placeholder="offset">
<input type="submit" value="GET 5 POSTS by TAG PERMALINK">
</form>
<br/>
<form method="GET" action="/tutorial/ep8/rest/getpostssummaries.php">
<input type="number" name="offset" placeholder="offset">
<input type="submit" value="GET 5 POST">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/addpost.php">
<input type="text" name="title" placeholder="title">
<textarea name="summary" placeholder="summary"></textarea>
<textarea name="content" placeholder="content"></textarea>
<select name="tags[]" multiple>
<option value="tag-1">tag-1</option>
<option value="tag-2">tag-2</option>
<option value="tag-3">tag-3</option>
</select>
<select name="categories[]" multiple>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="submit" value="ADD POST">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/deletepost.php">
<input type="number" name="post" placeholder="post id">
<input type="submit" value="DELETE POST">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/editpost.php">
<input type="number" name="id" placeholder="post id">
<input type="text" name="title" placeholder="title">
<textarea name="summary" placeholder="summary"></textarea>
<textarea name="content" placeholder="content"></textarea>
<select name="tags[]" multiple>
<option value="tag-1">tag-1</option>
<option value="tag-2">tag-2</option>
<option value="tag-3">tag-3</option>
</select>
<select name="categories[]" multiple>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="submit" value="EDIT POST">
</form>
<hr/>
<h1>ROLE (admin only)</h1>
<form method="POST" action="/tutorial/ep8/rest/addrole.php">
<input type="text" name="role" placeholder="role">
<input type="submit" value="ADD ROLE">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/deleterole.php">
<input type="number" name="role" placeholder="role id">
<input type="submit" value="DELETE ROLE">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/editrole.php">
<input type="number" name="id" placeholder="role id">
<input type="text" name="role" placeholder="role">
<input type="submit" value="EDIT ROLE">
</form>
<hr/>
<h1>USER (admin only)</h1>
<form method="POST" action="/tutorial/ep8/rest/adduser.php">
<input type="text" name="username" placeholder="username">
<input type="password" name="password" placeholder="password">
<input type="number" name="role" placeholder="role id">
<input type="submit" value="ADD USER">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/deleteuser.php">
<input type="number" name="user" placeholder="user id">
<input type="submit" value="DELETE USER">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/edituser.php">
<input type="number" name="id" placeholder="user id">
<input type="text" name="username" placeholder="username">
<input type="password" name="password" placeholder="password">
<input type="number" name="role" placeholder="role id">
<input type="submit" value="EDIT USER">
</form>
<hr/>
<h1>MESSAGES</h1>
<form method="GET" action="/tutorial/ep8/rest/getmessages.php">
<input type="number" name="offset" placeholder="offset">
<input type="submit" value="GET LATEST MESSAGES">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/addmessage.php">
<input type="text" name="title" placeholder="title">
<textarea name="text" placeholder="text"></textarea>
<input type="submit" value="ADD MESSAGE">
</form>
<br/>
<form method="POST" action="/tutorial/ep8/rest/deletemessage.php">
<input type="number" name="message" placeholder="message id">
<input type="submit" value="DELETE MESSAGE">
</form>
<br/>
<?php endif; ?>
</body>
</html>
<?php require_once 'core/shutdown.php'; ?>