Two modes of interaction between PHP and JavaScript

How to make the front page of the page and Background CGI pages remain interactive for a long time. Here are two I make in practice The method used. Method One: Interact with cookies. Altogether there are three files,

HTML tags for filtering form submissions in PHP

Some of the post links submitted by robots in recent comments are spam comments. In order to reduce this unnecessary link content appears, actually can use PHP to delete form Post submitted HTML tags, so the machine submitted information will not

PHP prevents remote submission of form examples from outside the station

Example one, each time we open the Submit page to generate a token and then save in session, when the form is submitted we will determine whether the current token value and session is consistent, if it is a normal submission otherwise is invalid

PHP perfect for filtering HTML code functions

example, use the Strip_tags () function to filter all HTML The code is as follows Copy Code $str = ' href";echo Htmlspecialchars ($STR);echo Strip_tags ($STR);Output results areHref One problem with the above

PHP Verification upload File type

First Kind The code is as follows Copy Code function ($file _name, $pass _type=array (' jpg ', ' jpeg ', ' gif ', ' BMP ', ' png ')) {$yx _file = $pass _type;$KZM = substr (STRRCHR ($file _name, "."), 1);$is _img =

PHP $_post, $_get anti-injection program

?/*************************DescriptionDetermines whether the passed variable contains illegal characterssuch as $_post, $_getFunction:Anti-injection*************************/Illegal characters to filter The code is as follows Copy

PHP generates picture verification code

md5

At first, there was a php.ini to see if the GD library was turned on,Next, we will consider each detail of the image generation step.Send a generated image to the browserCreate_image ();Exit (); function Create_image (){Let ' s generate a totally

PHP encryption and decryption internal algorithm

function Passport_encrypt ($txt, $key) {Srand (Double) microtime () * 1000000);$encrypt _key = MD5 (rand (0, 32000));$ctr = 0;$tmp = ';for ($i = 0; $i $ctr = $ctr = = strlen ($encrypt _key)? 0: $ctr;$tmp. = $encrypt _key[$ctr]. ($txt [$i] ^ $encrypt

How to lock files under PHP

/**lock_thisfile: Get exclusive lock* @param $tmpFileStr file name used as a shared lock file (you can name one)* @param $locktype lock type, the default is False (Non-blocking, that is, if the lock fails to return false directly), set to True will

PHP Random Password generation

Generates random strings that can be used to generate passwords automatically.Characteristics:1. You can specify that the password contains numbers or characters, and the default is blending mode2. Specify the arbitrary password length, the default

Php iframe: code for uploading brushless new files

The other principle is very simple. It is implemented by using the target attribute and iframe of the form. Open the iframe and try again. If the result is returned, use js to determine whether the parameters returned after the php Tutorial is run

Php strtotime () and date () date decrease code

Because I need to update the release date of a batch of data at work, if I want to update the data for 30 days from 20110112 today, we found that the strtotime function and date in the php Tutorial can easily implement the code.The strtotime ()

Ajax php users do not need to log on to the instance

ajax php Tutorial: users can log on to an instance without any need Enter the user name Userlogin. Php file$ Uid = $ _ post ['uname'];$ Pwd = $ _ post ['upwd '];$ SQL = "select * from tabname where uid = '$ uid' and pwd =' $ pwd '";$ Query =

Php session use detailed instance code

Session_start (), session_register (), session_unregister (),Session_is_registered (), session_destroy function.Session_start (): Enables the session mechanism and calls it at the very beginning of the program file that requires the

Php file Upload class

Class upload {/*** Name attribute of the input field of an html form. The default value is 'file'*/Var $ file_field = 'file ';    /*** $ _ Files array*/Var $ file_array;    /*** Save path. The default value is the current path.*/Var $ save_path = '';

Difference between tempnam and tmpfile created by php

SyntaxTempnam (dir, prefix)*/Function dir_wriable ($ dir) // customize function extension to create a temporary file{$ Test = tempnam ("$ dir", "test_file"); // create a temporary fileIf ($ fp = @ fopen ($ test, "w") // if the file is successfully

Php iconv mb_convert_encoding encoding conversion function

Use the iconv function:Iconv ("UTF-8", "gb2312", "abc Sunshine 123 ");It is said that this is better, you can ignore the conversion error!Iconv ("UTF-8", "gb2312 // ignore", "abc Sunshine 123 ");For the usage of mb_convert_encoding, refer to the

Php Undefined variable and Undefined index

If this problem occurs, the variable is undefined. We only need to add a verification code, as shown in figure$ A = isset ($ _ get ['A'])? $ _ Get ['A']: 'variable undefined ';In this way, undefined variable and undefined index are not displayed for

Incorrect php date reading time

Incorrect php date reading time$ DateTime = date ("Y-m-d H: I: s ");Echo $ DateTime;Why is the printed date inconsistent with the system time on my server. I tested it locally.Configure php. iniYou can also set it to GMT in php. ini:Open php. ini to

Php testing performance code

Php testing performance codeFunction microtime_float (){List ($ usec, $ sec) = explode ("", microtime ());Return (float) $ usec + (float) $ sec );}Function echotime ($ name){Static $ t_start = 0;$ T_end = microtime_float ();If ($ name! = 'Start '){$

Total Pages: 12780 1 .... 6862 6863 6864 6865 6866 .... 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.