Function for filtering dangerous HTML code using PHP

# HTML published by users, filtering risks Code Function uh ($ Str) { $ Farr = array ( "// \ S +/", // filter unnecessary Spaces "/] *?)> /ISU ", // filter the code that may introduce malicious content or maliciously change the display layout.

PHP Ajax garbled

While Ajax supports utf8 All right, first add a header ("Content-Type: text/html; charset = UTF-8") on the PHP page ″); Tell the web page that this implementation code is UTF-8 Use $ test = iconv ('gbk', 'utf-8', $ test) to encode the content to

Gradually improve the performance of the PHP framework

I. What are the problems with the current framework? Currently, mainstream frameworks such as Zend framework and CakePHP all adopt the MVC pattern and implement URL routing allocation. For example. In this way, the corresponding usercontroller

Code for sending mails via SMTP in PHP

A recent project needs to use SMTP to send emails. The previous library class does not exist, and it is too complicated to install pear or use the net/SMTP class of pear. The core is extracted from discuz and slightly modified. Find the SMTP

PHP reads the code sorted by algorithm within 30 days

CopyCode The Code is as follows: $ Link = mysql_connect ("","","") Or die ("unable to connect to MySQL Database". mysql_error ()); Mysql_select_db ("duyounet", $ link ); Mysql_query ("set names 'gb2312 '", $ link ); $ Day30 = Time ()-60*60*24*30; $

Online staff function library implemented by PHP

// Add users Function adduser ($ username ){ Global $ dB; $ IP = getenv ('remote _ ADDR '); $ IP1 = getenv ('HTTP _ x_forwarded_for '); If ($ IP1! = "") & ($ IP1! = "Unknown") $ IP = $ IP1; $ Current_time = date ("Y-m-d h: I: s "); $ SQL = "Select

PHP numeric left-side auto-fill 0

CopyCode The Code is as follows: $ Sourcenumber = "1 "; $ Newnumber = substr (strval ($ sourcenumber + 1000), 1, 3 ); Echo "$ newnumber "; ?> At this time, the following error occurs: 001.If you want to increase the number of digits, you can

How to solve the cannot modify header information problem in PHP

Obviously, this is because of setcookie. I checked the Internet and explained the following: the cookie itself has some restrictions, for example: 1. The description of the call to setcookie must be placed before the tag 2. You cannot use echo

PHP xfocus anti-injection materials

There is not much technical content here. I just talked about it in a simple way. (The following operations are based on PHP + MySQL + Apache.) How to implement your own PHP Code Security and assurance Program And server security is a very

Php chinese letter/digit Verification Code

The same number in English Header ("Content-Type: image/PNG "); // Define the header and declare the image file, preferably PNG, without copyright concerns; // Generate a new four-digit integer Verification Code Session_start (); // enable session; $

PHP learning operator and operator priority

Arithmetic Operators Operator name result $ A + $ B addition $ A and $ B's and $ A-$ B subtraction $ A and $ B $ A * $ B multiplication $ the product of a and $ B $ A/$ B Division $ A divided by the operator of $ B $ A % $ B modulo $ A divided by

PHP class used to add watermarks to images

CopyCode The Code is as follows: /* * Function: PhP image watermark (watermarks support images or text) * Parameters: * $ Groundimage: Specifies the background image to be watermark. Currently, only GIF, JPG, and PNG formats are supported; * $

PHP regular email statement details

CopyCode The Code is as follows: If (eregi ("^ [_. 0-9a-z-] + @ ([0-9a-z] [0-9a-z-] + .) + [A-Z] {2, 3} $ ", $ email )){ Echo "your email has passed the preliminary check "; } ?> In this sentence, an eregi function is first applied, which is quite

JavaScript to implement PHP pseudo Paging

JS Code As follows: Copy code The Code is as follows: // Maximum data volume VaR Total = "100 "; // Display volume per page VaR pagesize = 10; // Total number of pages VaR pagenum = math. Ceil (total/pagesize ); // Generate navigation Function

Bplaced Germany can bind M 2 GB support FTP free PHP Space

Solution 1: 1 GB free space, 8 FTP accounts, 8 MySQL databases, and 8 PostgreSQL databases. Solution 2: 2 GB free space, 2 FTP accounts, 2 MySQL databases, and 2 PostgreSQL databases. Web: http://www.bplaced.net Click "sign up", select the free

Use PHP to forge the Referer code to break through the Network Disk and prohibit external connections

For example, the file http://img.namipan.com/downfile/da333ee178bdad6531d1ec1540cf86277c116b6300887600/02.Paid%20In%20Full.mp3 I put in the disk This address cannot be downloaded directly or played in the webpage player. Click Download To go to

Code for generating batch thumbnails in PHP

Disadvantages: Images with different lengths and widths will be stretched and deformed, so they cannot be intelligently cropped. If you need to intelligently crop images, study them on your own. $ Config = array (); $ Config ['path'] = "./"; $

Php code for converting Chinese characters to PinYin page 1/2

Copy codeThe Code is as follows: $ D = array ( Array (& quot; a & quot;,-20319 ), Array ("ai",-20317 ), Array ("an",-20304 ), Array (& quot; ang & quot;,-20295 ), Array ("ao",-20292 ), Array (& quot; ba & quot;,-20283 ), Array ("bai",-20265 ), Array

Introduce the factory mode in php design mode

Problem How can you easily create such a "complex" object, that is, the operation does not need to be pasted and copied? Solution Create a factory (a function or a class method) to create a new object. To understand the usefulness of the factory,

Php code for simple compression of English strings

PHP, adapted to the ciphertext after simple encryption on the post Copy codeThe Code is as follows: // Replacement: Encrypted replacement from the previous version Function compress_func ($ match) {return strlen ($ match [0]). $ match [0] {0

Total Pages: 12780 1 .... 10915 10916 10917 10918 10919 .... 12780 Go to: GO

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.