Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 20-11-2005, 15:20   #1 (permalink)
Neuer User
 
Registriert seit: Oct 2005
Beiträge: 12
problem mit @ im Array

Hallo, ich hab da ein problem mit nem array.
und zwar habe ich einen badword filter gebaut der so geht

ein user gibt text in txt feld ein und will senden, vor dem absenden wird der eingegebene text geprüft ob wöter drinn vor kommen die nicht erlaubt sind wegen spam ect.

das geht auch alles wunderbar die zu prüfenden wörter kommen per array:

badWords = ["@", "mail", "pisse", "hure", "arsch", "sex"];

es geht alles nur das @ wird so nicht gefiltert ?
mike0815 ist offline   Mit Zitat antworten
Alt 20-11-2005, 15:26   #2 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
sollte weiterhelfen

kleiner inArray proto für euch
__________________
gruß bloba

2 x onkel² b_d
bloba ist offline   Mit Zitat antworten
Alt 20-11-2005, 15:39   #3 (permalink)
Neuer User
 
Registriert seit: Oct 2005
Beiträge: 12
ne hilft mir nicht weiter
mike0815 ist offline   Mit Zitat antworten
Alt 20-11-2005, 15:58   #4 (permalink)
using namespace
 
Benutzerbild von artjom
 
Registriert seit: May 2002
Ort: Hamburg underground
Beiträge: 657
wie is denn dein suchalgorythmus?
gruß
__________________
artjom.com -|- Melom
Einen PC beschleunigen? Klar, mit 9,81 m/s^2!
artjom ist offline   Mit Zitat antworten
Alt 20-11-2005, 16:04   #5 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
hätte dir abet weiterhelfen soll... siehe:

PHP-Code:
String.prototype.changer = function(fil) {
    var 
this;
    var 
irb;
    for (
i in fil) {
        
"x";
        for (
r=0r<fil[i].lengthr++) {
            
a.split(fil[i]).join(b);
        }
    }
    
a.indexOf("x");
    
== -trace("nix drin") : trace("was gefunne");
    
trace(t);
    return 
a;
};
word = ["tunichgut""@"];
my "Hallo du tunichgut Email ist hallo@ff.de ";
trace(my.changer(word)); 
__________________
gruß bloba

2 x onkel² b_d
bloba ist offline   Mit Zitat antworten
Alt 20-11-2005, 16:04   #6 (permalink)
Neuer User
 
Registriert seit: Oct 2005
Beiträge: 12
PHP-Code:
    badWords = ["@""mail""pisse""hure""arsch""sex"]; 
            
compareWholeWords true;
            
str Message.text;
            
origWords str.split(" ");
    
// loop through the array to compare each word
    
for(var eachWord=0eachWord<origWords.lengtheachWord++) {
        
// loop through each bad word   //this.badWords.length
        
for(var curseIndex=0curseIndex badWords.lengthcurseIndex++){
            if (
this.compareWholeWords) {
                if (
origWords[eachWord].toUpperCase() == badWords[curseIndex].toUpperCase()) {
                    
// here's where the action should take place when a match is made
                    // in this case, replace the word with a starred out version of the word
                     // leaving the first letter as-is
                    
origWords[eachWord] = origWords[eachWord].substr(0,1);
                    for (var 
letterIndex=0letterIndex badWords[curseIndex].length-1letterIndex++) {
                        
origWords[eachWord] += "*";
                    }
                }
            } else {
                var 
checkWord origWords[eachWord].toUpperCase();
                var 
compareTo badWords[curseIndex].toUpperCase();
                var 
foundAt checkWord.indexOf(compareTo,0);
                
trace("foundAt = " foundAt);
                if (
foundAt >= 0) {
                    
// here's where the action should take place when a match is made
                    // in this case, replace the word with a starred out version of the word
                     // leaving the first letter as-is
                    
var formattedCurse badWords[curseIndex].substr(0,1);
                    for (var 
letterIndex=0letterIndex badWords[curseIndex].length-1letterIndex++) {
                        
formattedCurse += "-";
                    }
                    
// reassemble the word with its replacements
                    
var newWord origWords[eachWord].substring(0,foundAt) + formattedCurse origWords[eachWord].substr(foundAt+badWords[curseIndex].length);                    origWords[eachWord] = newWord;
                }
            }
        }
    }
    
// reassemble the original string with the new replacements
    
returnString origWords.join(" "); 
mike0815 ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 04:28 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele