Prevent external access to PHP scripts but allow AJAX

前端 未结 4 1452
挽巷
挽巷 2021-01-22 20:06

I\'ve read a lot about .htaccess rules, checking headers, using encryption etc.. but I haven\'t found exactly the answer I\'m after. I know that assuming the server is set up ri

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-22 20:20

    Try to catch if isset SERVER['HTTP_ORIGIN'] from the POST access, it must be identical to your domain. If so, then the POST is generated by yourselft website and it's safe to process it.

提交回复
热议问题