Jump to content

Search the Community

Showing results for tags 'banned'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi, The following code seems to be echoing the array numbers. I actually need to echo the array value and not the numbers. Echo: Values of the matched banned words. Echo: Values of the non-matched banned words. So, how to correct the following code which shows results like this: Script 5a - No Match: (0) Script 5a - Banned: array(1) Script 5a - Banned: array(2) Script 5a - Banned: array(3) Script 5a - Banned: array(4) NOTE: "0" is being shown as "no match". But how come when "0" exists both in the content and banned words array ? <?php //script 5d: https://stackoverflow.com/questions/32522192/check-if-an-array-element-is-in-a-string $banned_words = array("0","1","2","3","4"); $content = "0,1,2,3,4,5,6,7,8,9"; for($i=0; $i < count($banned_words); $i++) { if(strrpos($content, $banned_words[$i]) != FALSE ) { echo "Script 5a - Banned: array($banned_words[$i])<br>"; // Place "break;" if you want it to stop after finding a match. }else{ echo "Script 5a - No Match: ($banned_words[$i])<br>"; } // Why is it echoing the array numbers instead of the array values ? } ?>
  2. Folks, Can you figure-out why the following script fails to find the banned words on the page when the banned words are listed in an array ? <?php /* ERROR HANDLING */ //declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); // 1). $curl is going to be data type curl resource. $curl = curl_init(); // 2). Set cURL options. curl_setopt($curl, CURLOPT_URL, 'https://www.buzzfeed.com/mjs538/the-68-words-you-cant-say-on-tv?utm_term=.xlN0R1Go89#.pbdl8dYm3X'); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); // 3). Run cURL (execute http request). $result = curl_exec($curl); $response = curl_getinfo( $curl ); if( $response['http_code'] == '200' ) { //Set banned words. $banned_words = array("Prick","Dick","Fag"); //Separate each words found on the cURL fetched page. $word = explode(" ", $result); //var_dump($word); for($i = 0; $i <= count($word); $i++){ foreach ($banned_words as $ban) { if (stripos($word[$i],$ban) !== FALSE){ echo "word: $word[$i]<br />"; echo "Match: $ban<br>"; }else{ echo "word: $word[$i]<br />"; echo "No Match: $ban<br>"; } } } } // 4). Close cURL resource. curl_close($curl); Remember the banned words exist on the page. And No. It is not because the banned words are not text but imgs as I checked the source code of the page and the banned words do exist as text. Check it out yourself, if you have any doubts. I hope it is not because this was set to false: curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); Setting it to "true", how-ever, shows a complete blank page. Why ? Must it not be set to "true" since the page is "httpS" anyway!
×
×
  • 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.