0

I just wanted to say I got all my information from this document for the most part. Making modifications as I learn. https://developers.google.com/maps/documentation/javascript/mysql-to-maps

Now I echo'd my information from sql database.. and read the file as a myfile.php.. Problem is.. if I go to www.mywebsite.com/myfile.php.. I can see all the results of my sql database.

How do I hide this information from view, but can call upon it?

7
  • There are a lot of options. I would say this is an opinionated question. ... Be that as it may, what do you mean by but can call upon it? ... Do you have a second script that will then handle the echo'd results? Commented Apr 16, 2020 at 3:56
  • myfile2.php will access myfile.php in this case. but myfile.php is acting or echoing the XML results.. but as i said. if i access myfile.php it shows the echo XML results. Im trying to hide this from users directing themselves to that file.. and only have it shown if accessed when needed. Commented Apr 16, 2020 at 4:08
  • Have you considered getting rid of myfile.php and doing all your db stuff from myfile2.php? Commented Apr 16, 2020 at 4:22
  • Have myfile.php check the referrer URL and only return data if it is the correct referrer. This is no guarantee that somebody won't fake the referring URL, but it will prevent the casual surfer from getting your data. Commented Apr 16, 2020 at 5:28
  • I myfile.php is just supposed to fetch the DB results, then you should put that code into a function, and have it return the results from the function (as a string, maybe), instead of echoing them directly. Then myfile2.php can include myfile.php in its script, and call your function whenever it needs to read the results. Then you can echo them from myfile2.php whenever it's needed. And that way, if someone accesses myfile.php directly, the function will not have been called so the results will not echo. Sounds like you need to learn about functions, and object-oriented programming too. Commented Apr 16, 2020 at 7:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.