Skip to content

Commit 455904f

Browse files
committed
Default expiry date on form tokens
1 parent 9386296 commit 455904f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Returns the decryped output as a string using [defuse/php-encryption](https://gi
2929
### encrypt($input, $key = false)
3030
Encrypt a string, if no key is given one will be generated for you (Recommended) using [defuse/php-encryption](https://github.com/defuse/php-encryption)'s library.
3131

32-
### getFormToken('form_token_id', $_POST['form_token'], $limit = false)
32+
### getFormToken('form_token_id', $form_token, $limit = 300)
3333
Verify a form token for the given id. The $limit is optional andm ust be given in seconds, if the limit is 300 and the token is used after 300 seconds it will be considered invalid.
3434

3535
### password_hash($password)

src/SecureFuncs.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function encrypt($input, $key = false)
5656
* @param $limit_time
5757
* @return md5hash
5858
*/
59-
public static function getFormToken($id, $token, $limit_time = false)
59+
public static function getFormToken($id, $token, $limit_time = 300)
6060
{
6161
$valid = false;
6262
// Check if isset
@@ -74,6 +74,7 @@ public static function getFormToken($id, $token, $limit_time = false)
7474
}
7575
}
7676
unset($_SESSION['formtoken'][$id]);
77+
unset($_SESSION['formtoken_time'][$id]);
7778
return $valid;
7879
}
7980

0 commit comments

Comments
 (0)