aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Zot
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-14 18:51:06 -0700
committerredmatrix <git@macgirvin.com>2016-04-14 18:51:06 -0700
commita8f7af20798de3bde73023c6e3f2b540e985767b (patch)
treec4c31417738b3d636e0615d4cfb3b0545ec358d4 /Zotlabs/Zot
parent7ae7fac2349555e9658b6c46dc6dd5316adff589 (diff)
downloadvolse-hubzilla-a8f7af20798de3bde73023c6e3f2b540e985767b.tar.gz
volse-hubzilla-a8f7af20798de3bde73023c6e3f2b540e985767b.tar.bz2
volse-hubzilla-a8f7af20798de3bde73023c6e3f2b540e985767b.zip
provide general purpose verification class, remove include/session.php (no longer used)
Diffstat (limited to 'Zotlabs/Zot')
-rw-r--r--Zotlabs/Zot/Verify.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/Zotlabs/Zot/Verify.php b/Zotlabs/Zot/Verify.php
new file mode 100644
index 000000000..1192202db
--- /dev/null
+++ b/Zotlabs/Zot/Verify.php
@@ -0,0 +1,42 @@
+<?php
+
+namespace Zotlabs\Zot;
+
+
+class Verify {
+
+ function create($type,$channel_id,$token,$meta) {
+ return q("insert into verify ( type, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
+ dbesc($type),
+ intval($channel_id),
+ dbesc($token),
+ dbesc($meta),
+ dbesc(datetime_convert())
+ );
+ }
+
+ function match($type,$channel_id,$token,$meta) {
+ $r = q("select id from verify where type = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
+ dbesc($type),
+ intval($channel_id),
+ dbesc($token),
+ dbesc($meta)
+ );
+ if($r) {
+ q("delete from verify where id = %d",
+ intval($r[0]['id'])
+ );
+ return true;
+ }
+ return false;
+ }
+
+ function purge($type,$interval) {
+ q("delete from verify where type = '%s' and created < %s - INTERVAL %s",
+ dbesc($type),
+ db_utcnow(),
+ db_quoteinterval($interval)
+ );
+ }
+
+} \ No newline at end of file