PHP filters illegal characters and filters HTML tags code such as js CSS a

Content ?if ($_post){InputNo action was made$a = $_post[' content '];echo $a;/*JS CSS A and other HTML tag code A JS dialog box pops up here.This will affect the security of the site and the user experience*/Functions for safe filtering$b =

PHP does not need a database Web site message Board Program

      title             Content                 . if ( $_post) {   $file = ' list.txt ';   $array = $_post;   $content = "title:". $array [' title ']. ' contents: '. $array [' content '].CHR (13);  if (file_exists

PHP Program Performance Optimization Special Recommendation

1. The difference between single and double quotes Most PHP developers (including me before) don't care much about their usage, but there's a big difference. The PHP engine allows the use of single and double quotes to encapsulate string variables,

PHP checkdate () to determine whether the date function

Definitions and usageThe Checkdate () function verifies a Gregorian high date. If the specified value is valid, the function returns True, otherwise it returns false. The date is legal in the following cases: Month between and including 1-12The

PHP Array Operation Instance Tutorial

PHP Array Operation Instance TutorialEach cell in the data array represents a row in a table. This is the typical way the database holds array data.The data in the example are as follows:Volume | Edition-------+--------67 | 286 | 185 | 698 | 286 | 66

PHP Get multi-checkbox checkbox value [multi-selection box]

checkbox in PHP to read the value in the array form Oh, we read these values in PHP post fetch is in an array form Oh, php Get checkbox value for multiple marquee $area _arr = Array ();if ($_get[' action ']== "submit") {$area _arr = $_post[' area ']

Comparison between PHP strtr and Str_replace

Comparison between PHP strtr and Str_replace Functions have the ability to replace characters. But the STRTR is 4 times times more than the str_replace performance. Specific circumstances, please Look at the following decomposition: The first is

PHP Explode implode usage

Explode (symbols, characters) The characters processed by explode will eventually be saved in an array form, so let's take a look at an example below. $t = ' 9,133, Dan County ^14,203, Changsha ^14,206, Hengyang '; $ar = Explode (', ', $a);

PHP serialize,unserialize function

PHP serialize,unserialize function We often see serialize,unserialize these two functions in PHP, so what are their roles? Serialize can convert any data into a stored character oh, and then unserialize restore, here we look at An instance.

PHP User Registration procedure [prevent Chinese registration]

Header ("content-type:text/html;charset=gb2312"); require_once (' inc/connect.php '); $xm = Isset ($_get[' txt '])? $_get[' txt ']: ' null '; $ta =isset ($_get[' tag '])? $_get[' tag ']:3; If ($ta ==1) {  if (Preg_match ("/^[". Chr (0XA1). -".

PHP Date function problem

Returns timestamp for 12:25:23 9-jul-2006echo Gmmktime (12,25,23,7,9,2006);?> Gmdate ($format, $ts) This function formats the UNIX time label as a date string that can be read artificially. This date string is represented as GMT (not local time).

PHP unlink Delete Files

Public Function Removepic ($pic) {if (@unlink ($this->path $pic) && @unlink ($this->path.str_replace ($this->pre_thumb, $this->pre_ Pic, $pic))) {$this->pic_count--;return true;}else{$this->reporterr ($this->aerr[6]);Return "!        F "; Delete

PHP switch and if else difference

Switch ($id) {Case 1:Return ' asp/';BreakCase 2:Return ' phper/';BreakCase 3:Return ' jsp/';BreakDefaultReturn ' rubbish/';} If Else implementation if ($systype = = 1 | | | $systype = 2 | | | $systype = 3 | | | $systype = 4) {return $sever;}elseif

PHP explode and implode usage and difference

function Htmltemplate ($tag) {$url = "file.txt";//file file contains the data I want to have and is bounded by .$content = file_get_contents ($url); Reading filesif (!empty ($content)) {$array = explode (' ', $content); to data processing and then

Php removes repeated data from the array.

The code is as follows:Copy code /*** Weight sorting for arrays* Difference from the array_unique function: it requires that val be a string, and this can be an array/object. ** @ Param unknown_type $ array to which arr is to be duplicated* @

PHP abstract classes, interfaces, and Application examples

Abstract class:It is used for inheritance and cannot be instantiated. It is used for standardization. Subclass must implement all abstract methods of the parent class.Interface:It can be understood as a stricter abstract class.First, like an

Simplest php code for deleting directories and files

Example The code is as follows:Copy code  // Delete all empty directories in the directoryArray_map ('rmdir', glob ('*', GLOB_ONLYDIR )); // Delete all files in the directoryArray_map ('unlink', array_filter (glob ('*'), 'is _ file '));?>

Simple php image uploads automatically add watermarks to images

This article mainly implements php image upload to automatically add watermarks to images. In the next article, I will provide code for adding text watermarks with php.It is actually very easy for php to add watermarks to images. It is not as

Detailed analysis of php json instance

JSON (json_encode) encoded in PHP)The PHP json_encode () function is used for JSON encoding in PHP. This function returns the value in JSON format. If it fails, FALSE is returned.Syntax:String json_encode ($ value [, $ options = 0]) parameter:Value:

Considerations for 301/404 redirection in php header

301 jump The code is as follows:Copy code Header ('http/1.1 301 Moved Permanently ');Header ('Location: http://www.abc.com/aaa /');Exit (); Do not miss the header ('http/1.1 301 Moved Permanently '); otherwise, no 301 is returned.404 error page

Total Pages: 12780 1 .... 4156 4157 4158 4159 4160 .... 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.