Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1002155 // Cookie-Based Session Test Bot

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1068L/7K/24K).

!752

static O mainBot;

static S cookieName = "deh-cookie";
static int cookieDays = 32;

static int cookieCounter = 1;

p {
  load("cookieCounter");
}

static synchronized S html() {
  O cookies = call(mainBot, "getCookies");
  S cookie = cast call(cookies, "read", cookieName);
  boolean isNew = false;
  if (cookie == null) {
    isNew = true;
    cookie = "Cookie " + (cookieCounter++);
    save("cookieCounter");
    call(cookies, "set", cookieName, cookie, cookieDays);
  }
  ret "Hello! Your " + (isNew ? "new " : "recurring ") + "cookie is: " + cookie;
}

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: 777 / 1327
Referenced in: #1002157 - Cookie + IP-Based Double Visitor Counter Bot
#3000195 - Answer for stefanreich (>> y)
#3000196 - Answer for stefanreich (>> y)
#3000197 - Answer for stefanreich (>> program data sizes)
#3000198 - Answer for stefanreich (>> program data sizes)
#3000199 - Answer for stefanreich (>> program data sizes)
#3000200 - Answer for stefanreich (>> program data sizes)
#3000201 - Answer for stefanreich (>> list all files)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)