I want to show the php file code on the webpage. how can I ensure security?

Source: Internet
Author: User
I want to display the php file code on the webpage. how can I achieve security? This post was last edited by taodala from 2012-11-0821: 58: 29. I have a website and want to get a function, is to browse the php files uploaded by netizens online. my current idea is to filter out & nbsp; & lt ;? Php & nbsp; prevents php files from being executed. is this safe? Why? ------ best solution --- how to ensure security when I want to display the php file code on the webpage
At the end of this post, I edited a website by taodala at 21:58:29 on January 8,. I want to use a function to browse the php files uploaded by netizens online. my current idea is to filter them out. ------ Best solution --------------------
How can I automatically post a post?
I want to say that as long as you don't need eval, you can simply output it.
Xss attacks are to be prevented. the simplest thing is to use htmlspecialchars to filter all characters into entity characters.
------ Other solutions --------------------
It is risky to filter only the two impressions. it is best to filter all and ensure security.
------ Other solutions --------------------
At the end of this post, xuzuning edited highlight_file at 22:22:29 on.
Highlight_string
Safe and beautiful
------ Other solutions --------------------
As long as you do not eval
------ Other solutions --------------------
Reference:
How can I automatically post a post?
I want to say that as long as you don't need eval, you can simply output it.
Xss attacks are to be prevented. the simplest thing is to use htmlspecialchars to filter all characters into entity characters.
Can I only filter these two results?

<(Less than) becomes <
> (Greater than) become>
------ Other solutions --------------------
You can directly output the results of file_get_contents (url). However, if there are special html tags, htmlspecialchars can be used. it is impossible to filter only the numbers greater than or less than the numbers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.