Port the code to PHP 8.5.

Replace the short open tags and the removed functions (mcrypt, mysql_error,
salt-less crypt). Decode the reCAPTCHA reply as JSON, turn off mysqli
exceptions, drop stripslashes(), and default missing input values.
Fix the misplaced continue in prune_images().
This commit is contained in:
tim
2026-09-25 21:18:58 +02:00
parent 15e81e17cc
commit 00829a0c0d
23 changed files with 145 additions and 130 deletions
+10 -10
View File
@@ -1,4 +1,4 @@
<?
<?php
if ( ! isset($_SERVER['HTTPS'])) {
header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
}
@@ -12,9 +12,9 @@ if (!isset($_SESSION['editor'])) {
open_db('open');
$table = "editors";
$username = $db->real_escape_string($_POST['username']);
$password = crypt($_POST['password']);
$email = $db->real_escape_string($_POST['email']);
$username = $db->real_escape_string($_POST['username'] ?? '');
$password = $db->real_escape_string(password_hash($_POST['password'] ?? '', PASSWORD_DEFAULT));
$email = $db->real_escape_string($_POST['email'] ?? '');
$query = "INSERT INTO $table SET".
"`username` = '".$username."', ".
"`password` = '".$password."', ".
@@ -39,18 +39,18 @@ if (!isset($_SESSION['editor'])) {
<script type="text/javascript" src="../utilities.js"></script>
<link rel="alternate" type="application/rss+xml" title="xxx.org.za RSS feed" href="/feed" />
</head>
<? flush(); ?>
<?php flush(); ?>
<body>
<div id="container">
<? include_once("../sidebar.inc.php"); ?>
<?php include_once("../sidebar.inc.php"); ?>
<main id="main">
<div id="maintext">
<H1>add editor</H1>
<? if ($added) { ?>
<?php if ($added) { ?>
<p>Added editor <?= $username ?></p>
<? } else { ?>
<?php } else { ?>
<form action="https://xxx.org.za<?= $_SERVER['REQUEST_URI'] ?>" method="post">
<div class="grid">
@@ -77,12 +77,12 @@ if (!isset($_SESSION['editor'])) {
</div><!-- .grid -->
</form>
<? } ?>
<?php } ?>
</div> <!-- .maintext -->
</main> <!-- .main -->
</div> <!-- .container -->
<? include_once("../bottombar.inc.php"); ?>
<?php include_once("../bottombar.inc.php"); ?>
</body>
</html>