Created
May 14, 2020 09:55
-
-
Save talentlessguy/defd9995ececf4c9465455acd6181217 to your computer and use it in GitHub Desktop.
Page view counter for KVDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- example KVdb script | |
-- HTML output | |
kvdb.header["content-type"] = "text/html" | |
-- read HTTP form variable and set key | |
if kvdb.var.slug then | |
local count = kvdb.get(kvdb.var.slug) | |
local action = kvdb.var.action | |
if action == "mutation" then | |
if count then | |
count = count + 1 | |
else | |
count = 0 | |
end | |
kvdb.set(kvdb.var.slug, count) | |
else | |
kvdb.say(count) | |
end | |
else | |
kvdb.say('View counter for <a href="https://v1rtl.site">v1rtl.site</a>') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment