Jump to content

Bad words replacement

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Guest_Jaan_*

Guest_Jaan_*
  • Guests
It's like http://forum.codecal...tr_replace.html that tutorial. I hope it helps.

<?php

// Display your form
function form(){

echo "<form action='?act=show' method='post'>"
	."<textarea name='text' cols='50' rows='10'></textarea><br>"
	."<input type='submit' value='Show'>"
	."</form>";
	
}

function show(){

// Request your text
$text = $_REQUEST['text'];

// This will determine things what you want to replace
$bad_words = array("banana", "tomato", "grape");

// This will determine your text replacement
$fix = array("******", "******", "*****");
$content = str_replace($bad_words, $fix, $text);

// Show your text without bad words
echo $content;

}

switch($act){

default;
form();
break;

case "show";
show();
break;

}

?>

have fun

Example

#2
xXHalfSliceXx

xXHalfSliceXx

    Speaks fluent binary

  • Moderators
  • 1,694 posts
Very nice. I like it

Posted Image
Posted Image