Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Text Filter</title>
- </head>
- <body>
- <form action="" method="post">
- <label for="input">Text : </label>
- <textarea name="inputText" id="input" cols="30" rows="5"></textarea>
- <br/>
- <label for="banList">banList : </label>
- <input type="text" name="bannedWords" id="banList"/>
- <br/>
- </form>
- <?php
- if (isset($_POST['inputText']) && isset($_POST['bannedWords'])) {
- $text = $_POST['inputText'];
- $bannedWords = explode(", ", $_POST['bannedWords']);
- foreach ($bannedWords as $bannedWord) {
- $text = str_replace($bannedWord , str_repeat('*' , strlen($bannedWord)), $text);
- }
- echo "<p>$text</p>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment