Browse Source

token validity check

master
Robin Thoni 9 years ago
parent
commit
7da6f13162
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      status.php

+ 4
- 2
status.php View File

@@ -5,9 +5,11 @@ require_once "misc/config.php";
5 5
 function check_token()
6 6
 {
7 7
   $token = check_table_field("Authorization", "tokens", "token");
8
-  if ($token === false)
8
+  $date = new DateTime($token["date"]);
9
+  $date->add(new DateInterval("P1D"));
10
+  if ($token === false || $date < new DateTime())
9 11
     error(401, "Invalid token");
10
-  return $token;
12
+  return $token['token'];
11 13
 }
12 14
 
13 15
 function status_confirm($id)

Loading…
Cancel
Save