Filter the dangerous HTML code in a form submission with PHP

PHP's HTML code to filter submission forms may have code that is exploited to introduce external dangerous content. For example, there are times when a user submits a form that contains HTML content, but this can cause the Display page layout to be

PHP paging the results of MySQL queries

function Pagesplit ($startPos, $rowsPerPage = ", $totalRows =") { $numPages = $totalRows/$rowsPerPage; $tenthPages = $rowsPerPage * 10; If ($startPos >= $tenthPages) { $back 10Position = $startPos-$tenthPages;

PHP converts kanji to pinyin

function Pinyin ($_string, $_code= ' gb2312 ') { $_datakey = "A|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao |ce|ceng|cha ". "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|

The making of PHP simple verification Code

$image =imagecreatetruecolor (100, 30); $white =imagecolorallocate ($image, 255, 255, 2); $red =imagecolorallocate ($image, 255, 0, 0); Imagefill ($image, 0, 0, $white); Munber Create $num = ""; for ($i =0; $

PHP Removal BOM Header

ord

Bom:byte order Mark UTF-8 BOM is also called UTF-8 signature, in fact, UTF-8 BOM has no effect on UFT-8, is to support UTF-16, UTF-32 added BOM, BOM signature means to tell the editor what encoding the current file, convenient for the editor to

PHP Regular expression method for getting all links to content

The examples in this article describe how PHP regular expressions get all links to content. Share to everyone for your reference. Specific as follows: Here are two methods for regular PHP links that can be used to get all the links to the content

PHP Gregorian to lunar calendar implementation code

a class code for converting PHP solar to lunar calendar A class for converting PHP solar to lunar calendar Class Calendar { #农历每月的天数 var $everyCMonth =array ( 0=>array (8,0,0,0,0,0,0,0,0,0,0,0,29,30,7,1),

Calculate distances in PHP based on latitude and longitude

This is a very useful distance calculation function that calculates the distance from location A to B using latitude and longitude. The function can return miles, kilometers, and oceans of three unit types of distance. function

PHP Web path fetching

Class Httptool { /** *//Get domain name or host address * #测试网址: http://localhost:8081/test/testurl.php?id=5 * Return to localhost:8081 */ Public Function GetHost () { Return $_server[' Http_host '];

Check URL, email and IP PHP code

function Is_valid_url ($url) { $p 1 = '/(HTTP|HTTPS|FTP): \/\/[a-z0-9-]+ (. [ a-z0-9-]+) * (: [0-9]+)? (\/.*)? $/i '; Return Preg_match ($p 1, $url); } function Is_valid_email ($email) { if (Filter_var ($email,

Gets the regular expression of a number in a string

!--? php $patterns = "/\d+/";//First type // $patterns = "/\d/"; The second type of $strs = "left:0px;top:202px;width:90px;height:30px"; Preg_match_all ($patterns, $strs, $arr); Print_r ($arr);

PHP Judge Access IP

Determine Access IPPHP code function GetIP () { if (! empty ($_server ["http_client_ip"])) { $CIP = $_server ["Http_client_ip"]; } else if (! empty ($_server ["http_x_forwarded_for"])) { $CIP = $_server

PHP 10 super-useful PHP code Snippets

10 super-useful PHP code Snippets [PHP] Code 1. Send SMS Call the Textmagic API. Include the Textmagic PHP Lib Require (' textmagic-sms-api-php/textmagicapi.php '); Set the username and password information

PHP download images based on URL

function Imagefromurl ($image, $rename) { $ch = Curl_init ($image); curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, curlopt_binarytransfer,1); $rawdata

PHP blocks multiple IPs from accessing your site

This code snippet allows you to prohibit certain IP addresses from accessing your website if (!file_exists (' Blocked_ips.txt ')) { $deny _ips = Array ( ' 127.0.0.1 ', ' 192.168.1.1 ', ' 83.76.27.9 ', ' 192.1

Use Imagebrick to turn PDFs into pictures

$pdf _file = './pdf/demo.pdf '; $save _to = './jpg/demo.jpg '; Make sure that Apache have permissions to write on this folder! (Common problem) Execute ImageMagick command ' convert ' and convert PDF to JPG with applied settings

PHP uses the GD library to implement a simple verification code

$img =imagecreatetruecolor (100, 40); $red =imagecolorallocate ($img, 255, 0, 0); $green =imagecolorallocate ($img, 0, 255, 0); $blue =imagecolorallocate ($img, 0, 0, 255); $white =imagecolorallocate ($img, 255, 255, 255);

PHP Chinese Pinyin Source code (GB2312 class library, about 6,000 characters supported)

ord

Recently a project using PHP as the front-end to provide data for the development language, in order to achieve the ability to sort alphabetically, the need to extract Chinese Hanyu Pinyin, this project wrote a Chinese pinyin script, script is

PHP Date processing code

echo "";echo Date ("Y-m-d", Strtotime ("Now"), "\ n";echo "";echo Date ("Y-m-d", Strtotime ("1 week Monday")), "\ n";echo "";echo Date ("Y-m-d", Strtotime ("1 week Sunday")), "\ n";echo "";echo Date ("Y-m-d", Strtotime ("+0 Week Monday")), "\

Compare full database Operations PHP class

Class Database { Private $hostname; Private $user; Private $pass; Private $dbname; Private $linkflag; Private $charset; function __construct () { $this->hostname= "localhost"; $this->user=

Total Pages: 5208 1 .... 4283 4284 4285 4286 4287 .... 5208 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.