Update to support PHP 8

pull/5/head
Skylar Ittner 2 years ago
parent 1c725e7170
commit 97929c6731

@ -1,14 +1,17 @@
<?php
require __DIR__ . '/required.php';
use Medoo\Medoo;
header("Content-Type: application/json");
// Oldest session allowed
$session_min_date = date("Y-m-d H:i:s", strtotime("-" . SESSION_EXPIRE_MINUTES . " minutes"));
// Delete old sessions
$old_sessions = $database->select("sessions", "sid", ["timestamp[<]" => $session_min_date]);
$database->delete("scrambled_answers", ["sid" => $old_sessions]);
$database->delete("sessions", ["sid" => $old_sessions]);
foreach ($old_sessions as $sid) {
$database->delete("scrambled_answers", ["sid" => $sid]);
$database->delete("sessions", ["sid" => $sid]);
}
switch ($VARS['action']) {
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];
// 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();
// Save the answer data
$scrambled_insert = [];

24
composer.lock generated

@ -1,23 +1,23 @@
{
"_readme": [
"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"
],
"content-hash": "3d60b6d6d1ba750afa45d307e067f006",
"packages": [
{
"name": "catfan/medoo",
"version": "v1.4.4",
"version": "v1.7.10",
"source": {
"type": "git",
"url": "https://github.com/catfan/Medoo.git",
"reference": "bcabbef4d8355d52fc4d19f17463e5e816c9ef44"
"reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/catfan/Medoo/zipball/bcabbef4d8355d52fc4d19f17463e5e816c9ef44",
"reference": "bcabbef4d8355d52fc4d19f17463e5e816c9ef44",
"url": "https://api.github.com/repos/catfan/Medoo/zipball/2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
"reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
"shasum": ""
},
"require": {
@ -31,7 +31,7 @@
"ext-pdo_oci8": "For Oracle version 8 database",
"ext-pdo_pqsql": "For PostgreSQL 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",
"autoload": {
@ -49,10 +49,11 @@
"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",
"keywords": [
"database",
"database library",
"lightweight",
"mariadb",
"mssql",
@ -63,7 +64,11 @@
"sql",
"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": [],
@ -73,5 +78,6 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

Loading…
Cancel
Save