Friday, May 22, 2020

PHP Source Code Isnt Viewable; Only HTML Code

With many websites, you can use your browser or another program to view the documents source code. This is a common occurrence  by viewers who want to see how a website developer accomplished a feature on a website. Anyone can view all the HTML that was used to create the page, but even if the web page contains PHP code, you can only view the HTML code and the results of the PHP code, not the code itself. Why PHP Code Isnt Viewable All PHP scripts are executed on the server before the website is delivered to the site viewer. By the time the data gets to the reader, all that is left is the HTML code. This is why a person cant go to a .php website page, save the file and expect it to work. They can save the HTML and see the results of PHP scripts, which are embedded inside the HTML after the code is executed, but the script itself is safe from curious eyes. Here is a test: The result is  PHP Code Test, but the code that generates it isnt viewable. Although you can see that there must be PHP code at work on the page, when you view the document source, you only see PHP Code Test because the rest is just instructions for the server and is not passed on to the viewer. In this  test scenario, only the text is sent to the users browser. The end user never sees the code.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.