@@ -25,6 +25,10 @@ discard block |
||
| 25 | 25 | // Constants for token durations |
| 26 | 26 | define("TOKEN_DURATION_ONE_DAY", 86400); |
| 27 | 27 | |
| 28 | +/** |
|
| 29 | + * @param string $type |
|
| 30 | + * @param integer $duration |
|
| 31 | + */ |
|
| 28 | 32 | function create_token($userid, $type, $duration) { |
| 29 | 33 | $token = random_string(); |
| 30 | 34 | $now = time(); |
@@ -37,6 +41,9 @@ discard block |
||
| 37 | 41 | return $token; |
| 38 | 42 | } |
| 39 | 43 | |
| 44 | +/** |
|
| 45 | + * @param string $type |
|
| 46 | + */ |
|
| 40 | 47 | function is_valid_token($userid, $token, $type) { |
| 41 | 48 | $boincToken = BoincToken::lookup_valid_token($userid, $token, $type); |
| 42 | 49 | if ( $boincToken == null ) { |