Best way to avoid code injection in PHP

前端 未结 10 1211
臣服心动
臣服心动 2020-12-01 05:29

My website was recently attacked by, what seemed to me as, an innocent code:



        
10条回答
  •  悲哀的现实
    2020-12-01 06:01

    @pek - That won't work, as your array keys are 0 and 1, not 'home' and 'page'.

    This code should do the trick, I believe:

    
    

    As you've a whitelist, there shouldn't be a need for file_exists() either.

提交回复
热议问题