Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
| 2 | // @description: Program used to upgrade the database after the implementation of issue #39. |
| 3 | |
| 4 | require_once(__DIR__."/../core.php"); |
| 5 | |
| 6 | if (php_sapi_name() != "cli") { |
| 7 | security::notFound(); |
| 8 | exit(); |
| 9 | } |
| 10 | |
| 11 | echo "========================\n"; |
| 12 | echo "2_ratelimitingsignin.php\n"; |
| 13 | echo "========================\n\n"; |
| 14 | |
| 15 | echo "[info] Adding new database schema...\n"; |
| 16 | if (!mysqli_query($con, "CREATE TABLE signinattempts ( |
| 17 | username VARCHAR(100) NOT NULL, |
| 18 | KEY username (username), |
| 19 | remoteip VARBINARY(16) NOT NULL, |
| 20 | KEY remoteip (remoteip), |
| 21 | remoteipblock VARBINARY(16) NOT NULL, |
| 22 | KEY remoteipblock (remoteipblock), |
| 23 | signinattempttime DATETIME NOT NULL, |
| 24 | KEY signinattempttime (signinattempttime) |
| 25 | )")) die("[fatal error] Couldn't add new database: ".mysqli_error($con)."\n"); |
| 26 | |
| 27 | echo "[info] Done\n"; |