» » php » page 2

 
Sort articles by: Date | Most Rates | Most Views | Comments | Alphabet

Use PHP to paginate long articles

Author: bamboo06 on 6-10-2016, 12:28, views: 2832

8 When the article content expertise, in order to facilitate reading and page display content we usually paged to display. The general page processing is published in the background when the article will be submitted to generate multiple pages after the static file. In this paper, we will use examples to explain the dynamic use of PHP long page content paging.

Manual paging: the general content in the edit when adding special paging tags, such as {pages}, submitted, the PHP program will process page breaks according to the page break, generate a different static pages. This sort of paging method is accurate, but need to manually add page breaks, a heavy workload.
Automatic paging: PHP program will be set according to the page break the content of the page, and then generate a different static pages. The method is efficient and requires a high tag for handling different html tags.

Category: PHP Scripts

 

Use PHP to prevent duplicate submiting form

Author: bamboo06 on 23-06-2016, 00:26, views: 5415

5 We submit the form, a limit can not be ignored is to prevent users who repeatedly submit the form, because there may be a user continuously hits the submit button or a malicious attacker to submit the data, then we submit the data after processing, such as modifying or adding data to the database when they will get into trouble.
Use PHP to prevent duplicate submiting form

So how do you avoid duplicate submission form this phenomenon happen? We can see from many aspects, first from the front end to make restrictions. In the front-end javascript is disabled after a button is clicked, the disabled, this simple method of preventing multiple clicks the submit button, but the disadvantage is that if the user has disabled javascript script is invalid. Second, we can do after submitting the redirect page redirection, that is submitted after the jump to a new page, the main F5 avoid duplicate submissions, but there are drawbacks. Thirdly, it is made unique database index constraint. Fourth, it is to do the session token authentication.

Category: PHP Scripts

 

Use PHP to serialize data and JSON to formate data

Author: bamboo06 on 16-02-2016, 23:52, views: 3513

6 PHP's serialize a sequence of the variable, the variable type and returns a string expression with a structure, but JSON is a lighter, more user-friendly format for interfaces (AJAX, REST, etc.) for data exchange. In fact, both are in a string manner to reflect a data structure. So what difference does it have between them?
Use PHP to serialize data and JSON to formate data

We may see the contents of a database or stored in a text file with a long list of seemingly has a special meaning in the text string some old WEB system. We look carefully will find that it has a data type and structure information, but it is not easy to read manual, it is only suitable PHP program reads. PHP's serialize the array is serialized and stored. We assume that there is such an array:

Category: PHP Scripts / Javascript

 

Use PHP to achieve red envelopes

Author: bamboo06 on 29-12-2015, 00:43, views: 6729

0 Use PHP to achieve distributing red envelopes, and when we enter the number and total amount, PHP will be randomly assigned to each of these two values based on the amount, to ensure that everyone can receive a red envelope, it is to ask the various amount of red envelope, all of the total amount should be equal to the total amount of red envelopes.
Use PHP to achieve red envelopes

We first have to analyze the law.

Category: PHP Scripts / Javascript

 

POST data reception mode in PHP

Author: bamboo06 on 8-08-2015, 01:42, views: 6683

3 Typically the user to use the browser web form to submit data to the server post, we use PHP receiving user data POST to the server, and appropriate treatment. But in some cases, such as the user using the client software to send data to the server-side post php program, rather than using $ _POST to identify, then how should we handle it?
POST data reception mode in PHP

$ _POST Is an array variable is passed by way of HTTP POST method consisting of automatic global variable. Such as using $ _POST ['name'] you can receive a web form and web data asynchronously over the post, namely $ _POST can only receive a document type Content-Type: application / data x-www-form-urlencoded submitted.

Category: PHP Scripts

 

Use HTML5 + PHP + jQuery to change clothes by shaking your phone

Author: bamboo06 on 9-04-2015, 23:59, views: 4994

1 In the previous article, we use HTML5 to listen to the phone in order to achieve a shaking effect. Shake the phone can be applied to many scenarios, such as a shake to change the draw, shake songs, search. In this paper, I will tell you how to use HTML5 + PHP + jQuery to achieve the effect of mobile phone shaking to change clothes.
Use HTML5 + PHP + jQuery to  change clothes by shaking your phone

Category: PHP Scripts / Javascript / Mobile / HTML5

 

use jQuery + PHP to realize dynamic digital display of results

Author: bamboo06 on 28-12-2014, 01:45, views: 2579

3 We need a dynamic display of data in some applications, such as the current line number, the current transaction total, at current exchange rates, etc., need real-time refresh the front page for the latest data. This article will tell you with examples using jQuery and PHP to achieve dynamic digital display effect.
use jQuery + PHP to realize dynamic digital display of results

Category: PHP Scripts / Javascript

 

PHP Session and Cookie operation

Author: bamboo06 on 20-12-2014, 02:58, views: 3058

8 We need to use to track user information Session and Cookie, such as user login authentication, user browsing history record store shopping cart data, user session valid time limit. Today we come to understand how to operate under PHP is the Session and Cookie.
PHP Session and Cookie operation

PHP's $ _SESSION current user data can be stored, when the user visits WEB site, PHP will give users access to each create a session ID, the ID is a unique ID, saved on the client, and the user's session data is saved to the the service side, PHP can be stored for each different user information when the session expires, the user session information will be invalidated.

Category: PHP Scripts

 

Useful PHP functions collected

Author: bamboo06 on 5-12-2014, 03:10, views: 4507

3 Projects often require some headache functions, as developers should organize its own library, when you need it can be copied. The authors collected dozens of commonly used functions in PHP project, guaranteed to run properly, you just copy and paste into your project.
Useful PHP functions collected

Category: PHP Scripts

 

use PHP and JAVASCRIPT to judge visitor terminal - a computer or mobile phone

Author: bamboo06 on 2-12-2014, 02:29, views: 8320

5 When users use mobile phones and other mobile devices to access the site, we can detect a user terminal type program, if it is a mobile phone user, you guide the user to access the mobile phone screen adaptation sites. This article describes the use of PHP and javascript code separately to determine the user terminal type.
use PHP and JAVASCRIPT to judge visitor terminal - a computer or mobile phone

When users use mobile phones and other mobile devices to access the site, we can detect a user terminal type program, if it is a mobile phone user, you guide the user to access the mobile phone screen adaptation sites. This article describes the use of PHP and javascript code separately to determine the user terminal type.

Category: PHP Scripts / Javascript