Update to support PHP 8

This commit is contained in:
Skylar Ittner 2021-11-22 18:41:45 -07:00
parent 1c725e7170
commit 97929c6731
2 changed files with 27 additions and 18 deletions

View File

@ -1,14 +1,17 @@
<?php <?php
require __DIR__ . '/required.php'; require __DIR__ . '/required.php';
use Medoo\Medoo;
header("Content-Type: application/json"); header("Content-Type: application/json");
// Oldest session allowed // Oldest session allowed
$session_min_date = date("Y-m-d H:i:s", strtotime("-" . SESSION_EXPIRE_MINUTES . " minutes")); $session_min_date = date("Y-m-d H:i:s", strtotime("-" . SESSION_EXPIRE_MINUTES . " minutes"));
// Delete old sessions // Delete old sessions
$old_sessions = $database->select("sessions", "sid", ["timestamp[<]" => $session_min_date]); $old_sessions = $database->select("sessions", "sid", ["timestamp[<]" => $session_min_date]);
$database->delete("scrambled_answers", ["sid" => $old_sessions]); foreach ($old_sessions as $sid) {
$database->delete("sessions", ["sid" => $old_sessions]); $database->delete("scrambled_answers", ["sid" => $sid]);
$database->delete("sessions", ["sid" => $sid]);
}
switch ($VARS['action']) { switch ($VARS['action']) {
case "ping": case "ping":
@ -41,7 +44,7 @@ switch ($VARS['action']) {
$access_question = $database->select('access_questions', ['acqid', 'acqtext'], ["LIMIT" => [mt_rand(0, $access_count - 1), 1]])[0]; $access_question = $database->select('access_questions', ['acqid', 'acqtext'], ["LIMIT" => [mt_rand(0, $access_count - 1), 1]])[0];
// Save the session data // Save the session data
$database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "acqid" => $access_question['acqid'], "expired" => 0, "#timestamp" => "NOW()", "ipaddr" => getUserIP()]); $database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "acqid" => $access_question['acqid'], "expired" => 0, "timestamp" => Medoo::raw("NOW()"), "ipaddr" => getUserIP()]);
$sid = $database->id(); $sid = $database->id();
// Save the answer data // Save the answer data
$scrambled_insert = []; $scrambled_insert = [];

24
composer.lock generated
View File

@ -1,23 +1,23 @@
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3d60b6d6d1ba750afa45d307e067f006", "content-hash": "3d60b6d6d1ba750afa45d307e067f006",
"packages": [ "packages": [
{ {
"name": "catfan/medoo", "name": "catfan/medoo",
"version": "v1.4.4", "version": "v1.7.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/catfan/Medoo.git", "url": "https://github.com/catfan/Medoo.git",
"reference": "bcabbef4d8355d52fc4d19f17463e5e816c9ef44" "reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/catfan/Medoo/zipball/bcabbef4d8355d52fc4d19f17463e5e816c9ef44", "url": "https://api.github.com/repos/catfan/Medoo/zipball/2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
"reference": "bcabbef4d8355d52fc4d19f17463e5e816c9ef44", "reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -31,7 +31,7 @@
"ext-pdo_oci8": "For Oracle version 8 database", "ext-pdo_oci8": "For Oracle version 8 database",
"ext-pdo_pqsql": "For PostgreSQL database", "ext-pdo_pqsql": "For PostgreSQL database",
"ext-pdo_sqlite": "For SQLite database", "ext-pdo_sqlite": "For SQLite database",
"ext-pdo_sqlsrv": "For MSSQL database on Windows platform" "ext-pdo_sqlsrv": "For MSSQL database on both Window/Liunx platform"
}, },
"type": "framework", "type": "framework",
"autoload": { "autoload": {
@ -49,10 +49,11 @@
"email": "angel@catfan.me" "email": "angel@catfan.me"
} }
], ],
"description": "The lightest PHP database framework to accelerate development", "description": "The lightweight PHP database framework to accelerate development",
"homepage": "https://medoo.in", "homepage": "https://medoo.in",
"keywords": [ "keywords": [
"database", "database",
"database library",
"lightweight", "lightweight",
"mariadb", "mariadb",
"mssql", "mssql",
@ -63,7 +64,11 @@
"sql", "sql",
"sqlite" "sqlite"
], ],
"time": "2017-06-02T15:25:04+00:00" "support": {
"issues": "https://github.com/catfan/Medoo/issues",
"source": "https://github.com/catfan/Medoo"
},
"time": "2020-02-11T08:20:42+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@ -73,5 +78,6 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [] "platform-dev": [],
"plugin-api-version": "2.0.0"
} }