myphp Posted January 10 Share Posted January 10 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']."')"); Quote Link to comment https://forums.phpfreaks.com/topic/317619-php-notice-undefined-index-data-in-repeated-log-errors/ Share on other sites More sharing options...
Barand Posted January 10 Share Posted January 10 The error is probably in the code that creates your $ipdetails array. Have you checked the contents of the array? echo '<pre>' . print_r($ipdetails, 1) . '</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/317619-php-notice-undefined-index-data-in-repeated-log-errors/#findComment-1614068 Share on other sites More sharing options...
myphp Posted January 12 Author Share Posted January 12 (edited) 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 January 12 by myphp Quote Link to comment https://forums.phpfreaks.com/topic/317619-php-notice-undefined-index-data-in-repeated-log-errors/#findComment-1614095 Share on other sites More sharing options...
Andou Posted January 16 Share Posted January 16 Yes, put it in the same file. Do you have an opening <?php tag at the beginning of the file? Quote Link to comment https://forums.phpfreaks.com/topic/317619-php-notice-undefined-index-data-in-repeated-log-errors/#findComment-1614152 Share on other sites More sharing options...
ginerjm Posted January 16 Share Posted January 16 And you should show us the exact line of code that you are adding as well as where you put it. Quote Link to comment https://forums.phpfreaks.com/topic/317619-php-notice-undefined-index-data-in-repeated-log-errors/#findComment-1614153 Share on other sites More sharing options...
Andou Posted January 16 Share Posted January 16 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. Quote Link to comment https://forums.phpfreaks.com/topic/317619-php-notice-undefined-index-data-in-repeated-log-errors/#findComment-1614154 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.