Libraryless. Click here for Pure Java version (1068L/7K/24K).
1 | !752 |
2 | |
3 | static O mainBot; |
4 | |
5 | static S cookieName = "deh-cookie"; |
6 | static int cookieDays = 32; |
7 | |
8 | static int cookieCounter = 1; |
9 | |
10 | p { |
11 | load("cookieCounter"); |
12 | } |
13 | |
14 | static synchronized S html() { |
15 | O cookies = call(mainBot, "getCookies"); |
16 | S cookie = cast call(cookies, "read", cookieName); |
17 | boolean isNew = false; |
18 | if (cookie == null) { |
19 | isNew = true; |
20 | cookie = "Cookie " + (cookieCounter++); |
21 | save("cookieCounter"); |
22 | call(cookies, "set", cookieName, cookie, cookieDays); |
23 | } |
24 | ret "Hello! Your " + (isNew ? "new " : "recurring ") + "cookie is: " + cookie; |
25 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002155 |
Snippet name: | Cookie-Based Session Test Bot |
Eternal ID of this version: | #1002155/1 |
Text MD5: | 8080fc083c985ff050fc95c2b599b5e8 |
Transpilation MD5: | e215f2cdfa55013e9b5384376de5406f |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-22 17:26:20 |
Source code size: | 586 bytes / 25 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 778 / 1328 |
Referenced in: | [show references] |