Jump to content

myphp

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by myphp

  1. So I have to change this: return true; To what? .
  2. That is what am trying to do but I don't know how to change code below to return which exact $spam_keywords was match foreach ($keywords as $keyword) { if (strpos($uri, $keyword) !== false) { return true; } }
  3. Hi everyone, php newbe here. Can someone tell me how I can ECHO which keyword is found/matched when I run this code? $uri = $_SERVER['REQUEST_URI']; $spam_keywords = [ 'spamword1', 'spamword2', 'spamword3' // WILL BE A LOT MORE HERE ]; function checkKeywords($uri, $keywords) { foreach ($keywords as $keyword) { if (strpos($uri, $keyword) !== false) { return true; } } return false; } if (checkKeywords($uri, $spam_keywords)) { // HERE I NEED TO ECHO WHICH KEYWORD WAS MATCHED echo "<p>HOW TO ECHO WHICH KEYWORD WAS MATCHED?</p>"; } else { echo "keywords not found"; }
  4. 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
  5. 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']."')");
  6. myphp

    New member

    New member, looks to learn more about php and get help in areas 🙂 Thanks for having me
×
×
  • 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.