How can I restrict access to some PHP pages only from pages within my website?

后端 未结 6 982
北海茫月
北海茫月 2020-12-16 05:08

I have in my website a PHP page which retrieves data from my database to be presented in my website. This page is called via AJAX. How can I restrict the access to it only f

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 05:56

    Alas, that's not possible. Anything Javascript can do, an 'abuser' can also do from his server. You can make it more difficult by obfuscating the javascript and protocol, making it harder to sniff. There are various free and non-free javascript obfuscators (also knows as "minimization") available. Obfuscating the protocol you can do by implementing a simple encryption scheme (making it more advanced won't help, as the key must always be embedded in your code anyway) for the data sent and received.

提交回复
热议问题