Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 193 van 286

Lennard

Lid · Topicstarter

Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Heel simpel, je zet er echo voor en ; er achter, dan krijg je dit:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<a href="javascript:addubb([/COLOR]hallo [COLOR= #DD0000],[/COLOR]bericht[COLOR= #DD0000]);" onClick="void(0)">klik er op</a><br />[/COLOR][COLOR= #007700];[/COLOR]


dan zie je aan de kleuren dat het nog niet helemaal klopt (een string hoort altijd helemaal rood te zijn), dus zet je voor alle in dat stukje nog een neer:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<a href="javascript:addubb(hallo ,bericht);" onClick="void(0)">klik er op</a><br />[/COLOR][COLOR= #007700];[/COLOR]


en aan de kleur te zien klopt het dan thumbsup
0
Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ah lennard bedankt thumbsup
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Lennard schreef:
Eerdere citaten tonen
Rogier schreef:
1812 bezoekers is best weinig, zon 60 p/dag.
Reken op een klikpercentage van 1% - 4% en een vergoeding van 4 cent. Dan kom je op 2 - 8 euro.

Ik heb wel eens gecasht bij daisycon met leads. Dat andere mensen enquêtes invullen.
Unieke bezoekers he, echte bezoekers is meestal een paar keer zoveel, en pageviews nog meer.
4598 bezoekers in november,
25023 pagina weergaves
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Dylanh schreef:
Eerdere citaten tonen
Lennard schreef:
Ja ik snap nu ook niet meer wat je wil yummie je wil alle woorden die in $words uit $_GET[r] verwijderen?
Ik wil woorden aanelkaar zetten

toevoeging op 6 december 2012, 15:05:49:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] aanelkaar[COLOR= #007700]([/COLOR][COLOR= #0000BB]$data[/COLOR][COLOR= #007700]) {[/COLOR]
    
    [COLOR= #0000BB]$return[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$return[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #0000BB]$words[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]scheld[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strtolower"]strtolower[/URL][COLOR= #007700]([/COLOR]aanelkaar[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]])),[/COLOR][COLOR= #0000BB]$words[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]JA[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]nee: [/COLOR][COLOR= #007700].[/COLOR]aanelkaar[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);
}[/COLOR]
?>


als ik nu scheld invoer werkt het maar als ik nou de scheld invoer werkt het niet meer, hoe kan ik dat oplossen?
Bericht bump.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat komt omdat je nu alle woorden aan elkaar plakt, en kijkt of dat aan elkaar geplakte woord in de $words array staat.

Vul je "sch eld" in:

in_array(scheld, array(scheld)) geeft TRUE

maar vul je bijvoorbeeld "scheld en" in:

in_array(schelden, array(scheld)) geeft FALSE

Want schelden staat niet in je array.
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Sjoerd schreef:
Dat komt omdat je nu alle woorden aan elkaar plakt, en kijkt of dat aan elkaar geplakte woord in de $words array staat.

Vul je "sch eld" in:

in_array(scheld, array(scheld)) geeft TRUE

maar vul je bijvoorbeeld "scheld en" in:

in_array(schelden, array(scheld)) geeft FALSE

Want schelden staat niet in je array.
Hoe moet ik het dan doen want:

als iemand jij bent een scheld

dan komt er dus
jijbenteenscheld

is het dan mogelijk om scheld uit de zin te halen?
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je alle scheldwoorden uit de zin wilt halen, kun je gewoon str_replace gebruiken.

$_GET[r] = str_replace($words, , $_GET[r]);

Of iets dergelijks..
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Sjoerd schreef:
Als je alle scheldwoorden uit de zin wilt halen, kun je gewoon str_replace gebruiken.

$_GET[r] = str_replace($words, , $_GET[r]);

Of iets dergelijks..
Ja, maar hoe kan ik dan doen als dat woord erin zit dat er dan een query uit word gevoerd?

toevoeging op 7 december 2012, 17:57:56:
Oh ik denk dat ik het al weet. Thanks!
0
Berichten
714
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Is 95 unieke bezoekers voor een website die 10 dagen bestaat veel?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Herculesje schreef:
Is 95 unieke bezoekers voor een website die 10 dagen bestaat veel?
95/10 = 9.5

Maak je reclame?
0
Berichten
714
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee maak geen reclame
Behalve me banner hieronder
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Herculesje schreef:
Nee maak geen reclame
Behalve me banner hieronder
ik vind het weinig, maar omdat hij 10 dagen bestaat is het niet echt gek.
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Oke ik weet het toch niet;

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// $return = str_replace(" ", "", $data);[/COLOR]
[COLOR= #0000BB]$words[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]scheld[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// de woorden[/COLOR]

[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);[/COLOR] [COLOR= #FF8000]// als er een . in staat vervangen door niks[/COLOR]


[COLOR= #0000BB]$main[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$words[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// als dat woord zonder punt erin staat vervangen door %scheld%[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$main[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Scheld woord[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geen[/COLOR][COLOR= #007700];
}[/COLOR]


?>


Als ik nu "scheld" invoer krijg ik Geen, als ik "s.cheld" invoer krijg ik ook Geen?

en als ik $main echo krijg ik Array.

Wat doe ik nu fout?

toevoeging op 8 december 2012, 13:29:13:
Ow, laat maar het moest natuurlijk met in_array()

toevoeging op 8 december 2012, 13:43:43:
Oke, nu snap ik het niet:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// $return = str_replace(" ", "", $data);[/COLOR]

[COLOR= #0000BB]$words[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]scheld[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// de woorden[/COLOR]

[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$words[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);[/COLOR]


[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$words[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]JA[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700]) {[/COLOR]
    
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]jah[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]];    

}[/COLOR][URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]nee<br>Words:[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$words[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]<br>Check:[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700];
    
}[/COLOR]


?>


Als ik nu hallo in typ staat er jah? terwijl hallo niet in de array staat?
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zou het zo doen:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] FilterScheldWoorden[COLOR= #007700]([/COLOR][COLOR= #0000BB]$string[/COLOR][COLOR= #007700]) {[/COLOR]

    [COLOR= #FF8000]// array met alle scheldwoorden[/COLOR]
    [COLOR= #0000BB]$scheldWoorden[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    
    [COLOR= #FF8000]// array met alle gevonden scheldwoorden[/COLOR]
    [COLOR= #0000BB]$gevondenScheldWoorden[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    
    
    [COLOR= #FF8000]// Voor elk scheldwoord een statement draaien[/COLOR]
    [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$scheldWoorden[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$scheldWoord[/COLOR][COLOR= #007700]) {[/COLOR]
    
        [COLOR= #FF8000]// zoek het scheldwoord[/COLOR]
        [COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strpos"]strpos[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$scheldWoord[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700]);[/COLOR]
    
        [COLOR= #FF8000]// controleer of het scheldwoord gevonden is[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pos[/COLOR] [COLOR= #007700]===[/COLOR] true[COLOR= #007700]) {[/COLOR]
        
            [COLOR= #FF8000]// als het gevonden is opslaan[/COLOR]
            [COLOR= #0000BB]$gevondenScheldWoorden[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #0000BB]$scheldWoord[/COLOR][COLOR= #007700];
            
        }[/COLOR]
        
        [COLOR= #FF8000]// verwijder $pos[/COLOR]
        [URL="http://www.php.net/unset"]unset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pos[/COLOR][COLOR= #007700]);
    
    }[/COLOR]

    [COLOR= #FF8000]// als er scheldwoorden gevonden zijn[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR]gevondenScheldWoorden [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    
        [COLOR= #FF8000]// return scheldwoorden[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$gevondenScheldWoorden[/COLOR][COLOR= #007700];
        
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    
        [COLOR= #FF8000]// anders return false[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700];
        
    }

}[/COLOR]

?>
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Maar waar moet ik dan de scheld woorden neer zetten? Ik heb al op lijn 5 en 8 geprobeerd maar dat werkt niet?
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren