Parcourir la source

token validity check

master
Robin Thoni il y a 9 ans
Parent
révision
7da6f13162
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4
    2
      status.php

+ 4
- 2
status.php Voir le fichier

5
 function check_token()
5
 function check_token()
6
 {
6
 {
7
   $token = check_table_field("Authorization", "tokens", "token");
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
     error(401, "Invalid token");
11
     error(401, "Invalid token");
10
-  return $token;
12
+  return $token['token'];
11
 }
13
 }
12
 
14
 
13
 function status_confirm($id)
15
 function status_confirm($id)

Chargement…
Annuler
Enregistrer