View previous topic :: View next topic |
Author |
Message |
SXL WEB -
Joined: 13 Nov 2002 Posts: 28 Location: Elmira, NY - a small pleace from hell
|
Posted: Sat Nov 30, 2002 5:11 pm Post subject: Smut Stoper |
|
|
Dose any one know how to stop smut
i need a snippet of code. in php.
how to stop words from being used
ie.
i make a txt file full of words.
people go to my script. and try to use the word (f***)
it stops them from useing that word and replys "sorry but no vulgarity"
i want this to use many words not just the word f***.
so what ever word is in the txt file cant be used on my script. _________________
|
|
Back to top |
|
|
!Keys -
Joined: 23 Nov 2002 Posts: 156 Location: Holland, Enschede
|
Posted: Sat Nov 30, 2002 6:36 pm Post subject: |
|
|
so you want a code that if ppl type CENSORED (sorry :-)) it shows ****
in that case:
<?php
/*
---scheldwoorden.txt-------
bitch
CENSORED
dick
goddamn
---------------------------
*/
class rude
{
function replace_rude_language($filename, $text)
{
// Lees het bestand regel voor regel in, en zet het in een array
$ar_words = file ($filename) or die ("Kan het opgegeven scheldwoordenbestand niet vinden, controleer of het bestand bestaat.");
/* Bij deze for-lus wordt het enter teken gefilterd; het enter teken bestaat uit twee bytes, het
Cr en het Lf teken. Het Cr teken is ascii 10 en het Lf teken is ascii 13
*/
for ($j = 0; $j < count($ar_words); $j++)
{
$replace_temp = str_replace(chr(10), '', $ar_words[$j]);
$ar_words_minus_enter[$j] = str_replace(chr(13), '', $replace_temp);
}
/* Dit is de lul die al het werk doet, deze lul bekijkt of er in het bericht een woord staat
dat niet is toegestaan, als het woord niet is toegestaan worden de middelste letter vervangen
door sterretje. VB: eikel -> e***l of lul -> l*l of klootzak -> k******k
*/
for ($i = 0; $i < count($ar_words_minus_enter); $i++)
{
// Zet het aantal sterretjes weer op nul, voor het volgende woord
$star = "";
/* Bepaal hoeveel sterretjes er moeten komen
die min twee slaat op het eerste teken en het laatste teken, die twee moeten tenslotte wel zichtbaar
blijven.
*/
for ($k = 0; $k < (strlen($ar_words_minus_enter[$i]) - 2); $k ++)
{
$star = $star . "*";
}
/* Hier wordt het woord vervangen: eerst de eerste letter, daarachter geplakt komt het aantal sterretjes en
daarachter het laatste teken
*/
$replace_by = substr($ar_words_minus_enter[$i], 0, 1) . $star . substr($ar_words_minus_enter[$i], -1);
$text = str_replace($ar_words_minus_enter[$i], $replace_by, $text);
}
// Geef het resultaat terug aan de functie
return $text;
}
}
$rude = new rude;
echo $rude->replace_rude_language('scheldwoorden.txt', *****);
?> _________________ !Keys || MwM^computerware |
|
Back to top |
|
|
SXL WEB -
Joined: 13 Nov 2002 Posts: 28 Location: Elmira, NY - a small pleace from hell
|
Posted: Sat Nov 30, 2002 6:39 pm Post subject: OMG |
|
|
if i know it was that long. i would of not asked but thanks for the help.
ill add a thank you spot on the readme for ya. do you have a site url _________________
|
|
Back to top |
|
|
!Keys -
Joined: 23 Nov 2002 Posts: 156 Location: Holland, Enschede
|
Posted: Sat Nov 30, 2002 6:48 pm Post subject: |
|
|
My site url? i havn´t got one :P what do you mean? :roll:
my site, just some easy testsi still need a good design:
http://217.120.133.142/ _________________ !Keys || MwM^computerware |
|
Back to top |
|
|
SXL WEB -
Joined: 13 Nov 2002 Posts: 28 Location: Elmira, NY - a small pleace from hell
|
|
Back to top |
|
|
SXL WEB -
Joined: 13 Nov 2002 Posts: 28 Location: Elmira, NY - a small pleace from hell
|
|
Back to top |
|
|
!Keys -
Joined: 23 Nov 2002 Posts: 156 Location: Holland, Enschede
|
Posted: Sat Nov 30, 2002 7:04 pm Post subject: |
|
|
first of all: make the newest post all up (SELECT bla bla bla bla(mysql command) ASC (or DESC, i forgot))
and euhm, it doesnt work :( try http://www.hotscripts.com, you can always find good working scripts there, i´m just a lonely php guy :-) _________________ !Keys || MwM^computerware |
|
Back to top |
|
|
SXL WEB -
Joined: 13 Nov 2002 Posts: 28 Location: Elmira, NY - a small pleace from hell
|
Posted: Sun Dec 01, 2002 3:25 am Post subject: HE HE |
|
|
lol well thanks man, im a vary new persion to php. _________________
|
|
Back to top |
|
|
!Keys -
Joined: 23 Nov 2002 Posts: 156 Location: Holland, Enschede
|
Posted: Sun Dec 01, 2002 10:46 am Post subject: |
|
|
Wish i had GOOD and free websites in english, i only know dutch sites(http://www.phpfreakz.nl and http://www.jacqieline.com)
but hotscripts, you can find quite good scripts there _________________ !Keys || MwM^computerware |
|
Back to top |
|
|
SXL WEB -
Joined: 13 Nov 2002 Posts: 28 Location: Elmira, NY - a small pleace from hell
|
Posted: Thu Dec 05, 2002 10:02 pm Post subject: believe |
|
|
i believe i found away
$word = file("badwords.txt");
for($w=0;$w<count($word);$w++){
list($curse,$replacement,) = explode("|^|",$word[$w]);
$curse = str_replace("\\","\\\\\\\\",stripslashes($curse));
$replacement = str_replace("\\","\\\\\\\\",stripslashes($replacement));
$post = eregi_replace($curse,$replacement,$post);
} _________________
|
|
Back to top |
|
|
!Keys -
Joined: 23 Nov 2002 Posts: 156 Location: Holland, Enschede
|
Posted: Thu Dec 05, 2002 10:04 pm Post subject: |
|
|
$post = eregi_replace($theinput, thelinewhatitshouldbe);
is enough :roll: _________________ !Keys || MwM^computerware |
|
Back to top |
|
|
|