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:
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
$result = get_post_data(TRUE, TRUE);
|
||||
extract($result[0], EXTR_OVERWRITE);
|
||||
|
||||
@@ -12,7 +12,9 @@ if (isset($_POST['g-recaptcha-response'])) {
|
||||
$captcha_resp = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".urlencode(config('RECAPTCHA_SECRET'))."&response=".
|
||||
$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
|
||||
var_dump($captcha_resp);
|
||||
if ($captcha_resp.success==false) {
|
||||
// PHP 8 treats the bare word "success" as an undefined constant, so decode the JSON reply
|
||||
$captcha_json = json_decode((string)$captcha_resp);
|
||||
if (empty($captcha_json->success)) {
|
||||
$validate['captcha'] = 'The words you typed in the captcha were not correct. Please try again.';
|
||||
include('./write.inc.php');
|
||||
return;
|
||||
@@ -21,7 +23,7 @@ if (isset($_POST['g-recaptcha-response'])) {
|
||||
|
||||
echo '<p>Please review your submission. Once you\'ve finished, please click "Submit" at the bottom of the page, or click "Preview" to check it again.</p>';
|
||||
|
||||
if (is_uploaded_file($_FILES['upload']['tmp_name']) && !isset($validate['upload'])) {
|
||||
if (is_uploaded_file($_FILES['upload']['tmp_name'] ?? '') &&!isset($validate['upload'])) {
|
||||
$tmp_file = $_FILES['upload']['tmp_name'];
|
||||
$upload = getimagesize($tmp_file);
|
||||
$new_file = $_SERVER['DOCUMENT_ROOT'] . "/graphics" . $tmp_file;
|
||||
|
||||
Reference in New Issue
Block a user