If you have never been familiar with PHP, let's take a look at it first. of course, even if you already know something about PHP, a PHP4 Application Manual still needs it ,:). In addition, an HTML syntax manual is of course indispensable ....
If you have never been familiar with PHP, let's take a look at it first. of course, even if you already know something about PHP, a PHP4 Application Manual still needs it ,:). In addition, an HTML syntax manual is of course indispensable .......... This article is a successor to 'learning PHP forms process'. if you are not familiar with php processing forms, read the previous article ----------- how to process PHP forms through an instance.
After learning about the processing of the previous form, do you want to develop a small program with confidence? OK. Let's start with something really useful! A usable PHP voting program. In this article, we will learn the application of cookie techniques, PHP array control and File Processing. How? Are you ready? Let's go!
Before starting a specific program design, let's take a look at several important concepts and functions that need to be used below:
The first is cookie. we need to use it to prevent repeated voting on the same machine.
So what is cookie? If your English is good enough and you want to eat cookies of the original flavor, try them first. Otherwise, you will only have to hide them for you ..... (Not good. don't flat me ,:))
Cookie originally meant cookies in American languages. of course we don't want to eat them now. here, cookies refer to ASCII files with many restrictions. It is sent to the user by the server to record some information about the user during browsing. The file size of Cookies is limited to 4 K. Cookies are very useful. for example, if some websites you have visited record the number of times you have been there, most of them use cookies. Here we use it to record whether the visitor has voted.
In PHP, we can easily use the setcookie function to apply cookies. cookies are actually part of the HTTP header. Therefore, the setcookie function must be called before any other information is output to the browser. To put it simplyUse this function before marking ....... The following is an example of setcookie usage. it is from the PHP4 Chinese manual of Starling's eldest brother. you can refer to our specific usage in the program later.
Setcookie
Send Cookie information to the browser.
Syntax: int setcookie (string name, string value, int expire, string path, string domain, int secure );
Return value: integer
Function type: Network System
Content clarification
This function sends a small message string to the browser along with the Header. Before sending the HTML material, the cookie is actually a part of the header. Except the first name, this function can be omitted. Parameter name indicates the cookie name. value indicates the cookie value. If this parameter is null, the cookie material in the browser is canceled. expire indicates the cookie validity period; path indicates the cookie's coherent path. domain indicates the cookie's website. secure is valid only during secure https transmission. The expire time pattern is as follows:
Wdy, DD-Mon-yyyy hh: MM: SS GMT
GMT: Greenwich Mean Time
Application model
Dante@mpath.com (27-May-1999) provided by the setcookie () and header () model.