Jump to content

PHP Notice: Undefined index: data in.. repeated log errors


myphp

Recommended Posts

Keep getting these errors from an old unsupported extension I have installed.  I need the extension but hate these errors :(

Why does this keep happing sometimes but not with all my visitors?  Could it be that my database server is slow or blocking me sometimes or is there something wrong with this code here?

Thanks for any help in advance :)

 

2024-01-09 17:10:51 - PHP Notice:  Undefined index: data in ***/module/botblocker.php on line 149
2024-01-09 17:10:51 - PHP Notice:  Undefined index: data in ***/module/botblocker.php on line 162
2024-01-09 17:10:51 - PHP Notice:  Undefined index: data in ***/module/botblocker.php on line 166

Here is the PHP code

LINE 149

                if ($ipDetails['data']['totalReports'] > 0) {
                    foreach ($ipDetails['data']['reports'] as $reports) {
                        foreach ($reports['categories'] as $report) {
                            $categories[] = $report;
                        }
                    }
                }

LINE 162

                if ($ipDetails['data']['isWhitelisted'] || $ipDetails['data']['abuseConfidenceScore'] == 0 || $ipDetails['data']['totalReports'] == 0) {
                    $allowed = true;
                }

LINE 166

                $db->query("INSERT IGNORE INTO " . DB_PREFIX . "bot_blocker_abuseipdb(`ip`, `blocked`, `usage_type`, `domain`, `total_reports`, `ipversion`, `score`) VALUES ('".$ip."', '".($allowed ? 0 : 1)."', '".$ipDetails['data']['usageType']."', '".$ipDetails['data']['domain']."', '".$ipDetails['data']['totalReports']."', '".$ipDetails['data']['ipVersion']."', '".$ipDetails['data']['abuseConfidenceScore']."')");

 

Link to comment
Share on other sites

Sorry kinda of a newbee here...  Should I put the echo code in the same file?  Does it matter on what line I put it on?

PS.  Adding that code to the above php file just causes more errors and I do not see anything being printed when I visit the php file

Edited by myphp
Link to comment
Share on other sites

Pretty sure ginerjm got to it before I did, but just in case, make sure you have

<?php

 error_reporting(E_ALL);
 ini_set('display_errors', '1');

 

at the top of module/botblocker.php. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.