最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - How to not allow unauthorized access to json data for leaflet map - Stack Overflow

matteradmin3PV0评论

I have a map application using leaflet.js that pulls the map markers from a php page. I want to not allow people to be able to see those coordinates, to prevent them from copying them and sharing with other people for free. My problem is no matter what i have come up with so far, it seems like any skilled user can pull the data from a browser's devtools and then copy my markers and use them as they wish. Here is what I have done so far:

  1. A user must be logged in for the markers to display on the php page
  2. A one time token is created on the map page that then calls to the php page, once the token is used it is trashed, so if a user tries to copy the link from the javascript fetch() the token will be expired and not display the markers. But in devtools, they would be able to see what was outputed on the php page and just cut and paste, etc.
  3. I also have encoded the php page output using base64 and a one time key. This is then decoded on the map page. However any user could look into the javascript on the map page to see the one time key and then cut and paste everything into their one script to decode it.

I am missing any other options to keep these map marker data from being shared? Is there a way to tell devtools, not show the output of a certain page? Excited to hear your thoughts. Thanks!

Post a comment

comment list (0)

  1. No comments so far