Detecting specific words in a textarea submission

前端 未结 3 1046
深忆病人
深忆病人 2021-01-26 07:07

I have a new feature on my site, where users can submit any text (I stopped all HTML entries) via a textarea. The main problem I still have though is that they could type \"htt

3条回答
  •  滥情空心
    2021-01-26 07:28

    You must use strpos more the once. With your way you evaluate the or statement with returns true / false and pass it to strpos.

    This way it should work:

    if (strpos($entry, "http://") !== false || strpos($entry, "https://") !== false || strpos($entry, ".com") !== false)
    

提交回复
热议问题