# 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.
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
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
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
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;
$
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
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
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
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;
$
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
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;
* $
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
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
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
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'] = "./";
$
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, 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
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