Skip to content

Commit

Permalink
Add docu
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Feb 18, 2024
1 parent 9396158 commit 4306adf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ext/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?php
// name of the database file (may also be a path)
define('DB_NAME', "dayon.db");
// minimal length of the tokens to be generated (33^N-1 variants)
define('TOKEN_MIN_LENGTH', 4);
// number of seconds after which the token will be purged
define('TOKEN_LIFETIME', 604800);
// maximum number of tokens that can be generated for a single IP
define('TOKEN_LIMIT', 700);
// 8<---8<---8<---
header('Content-type: text/plain');
if (isset($_GET['port'])) {
$port = clean($_GET['port'], 6);
Expand All @@ -15,7 +20,7 @@
}
}
} else if (isset($_GET['token'])) {
$token = clean($_GET['token'], 7);
$token = clean($_GET['token'], TOKEN_MIN_LENGTH * 2);
$pdo = new PDO('sqlite:'.DB_NAME);
echo readToken($token, $pdo),"\n";
updateToken($token, $_SERVER['REMOTE_ADDR'], $pdo);
Expand Down

0 comments on commit 4306adf

Please sign in to comment.