Źle to robisz.
Funkcja strpos zwraca na której pozycji jest słowo.
Jeśli na pierwszej to zwróci 0... Php przekonwetruje 0 do false.
A false da wynik z else.
I zwraca false jeśli nie istnieję.
Dlatego musisz sprawdzać czy funkcja nie zwróci false.
Dodatkowo lepiej zrób stripos zamiast strpos jeżeli chcesz uwzględnić także Kurde KURDE itd.
if (false!==stripos($_POST['text'], 'kurde')) {
echo 'Jest zakazane słowo!'; } else {
}
Nawet w manualu masz ostrzeżenie przed tym - lepiej tam sprawdzaj gdyby coś powinno działać a nie działa jak trzeba.
stripos();
Cytat
Returns the position of where the needle exists relative to the beginnning of the haystack string (independent of offset). Also note that string positions start at 0, and not 1.
Returns FALSE if the needle was not found.
Warning
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.