How to deny direct access to files in AJAX directory

前端 未结 3 1217
春和景丽
春和景丽 2021-01-16 05:46

I have several pages that call in content via jQuery .ajax. I dont want the content visible on the page so thats why I went with .ajax and not showing/hiding the content. I

3条回答
  •  甜味超标
    2021-01-16 06:27

    Make a temporary time-coded session variable. Check the variable in the php output file before echoing the data.

    OR, if you don't want to use sessions.. do this:

    $key = base64encode(time().'abcd');

    in the read file: base64decode explode by abcd read the time. Allow 5 seconds buffer. If the time falls within 5 seconds of the stamped request. You are legit.

    To make it more secure, you can change your encrypting / decrypting mechanism.

提交回复
热议问题