Simple php news publishing system tutorial

Source: Internet
Author: User

Simple php news publishing system tutorial (first version) Lecture 1: Use phpmyadmin to create a database named yayu. Create a data table named news in this database. Next we will enter a key point, that is, to create fields under the news table.

So what is a field? It is a general term for a type of things. For example, all the press releases are represented by one term. (In my experience, fields created using phpmyadmin can be used in Chinese, but in practice, they can still be used in English, the best computer in the United States ). We use "time" for representation. There can be a lot of "posting time" in the field time. How can we differentiate these time? This can be used to query the content in other fields, for example, when we create a news title field as "title", the content in the title field is not the same according to common sense. Therefore, you can use a title to query the posting time. In fact, we can make each title or time content correspond to a number, that is, the field --

"Id": The field "id" is a default preferred field. Content in other fields can be repeated, but this field is an Arabic number that increases from 1. When setting this field, you must set the primary key, index, unique, and auto-increment. This auto-increment is automatically added. When content is added to any field, this field is automatically increased by 1, that is, any field corresponds to a unique id, such as 1, 2, 0 27 ......

Next we will talk about the establishment of some fields in news.

1. id: indicates the number of each news item. It is unique and the type is tingint. The length of the tingint type is not required. The system defaults to 4. in the "Extra" field, select auto-increment, and select the primary key.

2. author: it indicates the author (news publisher). Set the type to varchar. When setting the length of this field, if the authors are all Chinese, the maximum length of 8 bytes is (4 Chinese characters ), however, given that the author may be a foreigner and the number of 8 bytes is obviously too small, the same problem exists for other fields. Here we will set the length to 8.

3. title: indicates the news title. The type is varchar, the length is 60, and the attribute is primany key.

4. content: indicates the news content. The type is text. You do not need to set the length for this type.

5. source: indicates the news source. The type is varchar and the length is 60.

6. date: indicates the publication time. The type is datetime. You do not need to set the length. The attribute is primarykey.

The following describes the field types:

1. date: time and date type. The time and date types also include:

Required datetime: 0000-00-00 00:00:00

Expiry date: 0000-00-00

⊕ Timestamp: 00000000000000 (14 0, length depends on the display size)

Elapsed time: 00:00:00

Seasonal year: 0000

2. the conten t field indicates the news content. Because of its large capacity, the text type is used (up to 65535 bytes are supported)

3. The title field is set to primarykey. If no news item has the same posting time, the date field can also be used? Primany key, which makes it easier to sort and retrieve news in the future.

4. Although a text field belongs to a character type, its size cannot be specified. If the length is set, an error occurs in the SQL statement.

Now, the news data table is created.

Since not everyone can add news, Only Administrators can do it, so now let's create a data table users to store administrators.

1: id: tinyint type, auto-increment and primary key.

2: name: indicates the Administrator name. The type is varchar. The length is 8 and the attribute is primarykey.

3: password: indicates a password of the varchar type. The length is 32.

4: mail: Same as the mail address. The type is varchar and the length is 30.

Now, the two databases have been set up, and we will enter the development of the news program below.

Original php news system tutorial (first version) Lecture 2: Basics of news programs

I. Basics of Database Connection

To add, retrieve, modify, and delete news, you must first connect to the host, select a database, and send a request to the database. Otherwise, everything is on paper. The following describes three important MySQL statements: mysql_pconnect () (connect to the host), mysql_select_db () (select the data library), and mysql_query () (send requests to the database ).

1. mysql_pconnect ()

It is used to connect to the host.

Syntax: mysql_pconnect ("host to be logged in", "username at login", "password ");

For example, mysql_pconnect ("localhost", "root ","");

"Localhost" and "root" are all default host names and usernames under phpmyadmin, And the password is empty.

The same function also has mysql_connect (). The syntax is the same. The difference is that the former enables a long-Term connection and cannot be closed using the mysql_close () function, while the latter must be closed in time using mysql_close () after use. For a website, the former is better than the latter. This reduces the burden on the MySQL server to process and close connections.

After the function is successfully connected, a connection ID is returned. Therefore, this function is generally written as follows:

$ Link = mysql_pconnect ();

Speaking of this, add a function mysql_close (),

Syntax: mysql_close ("connection ID to close ");

For example, mysql_close ($ link );

Note: All () values are strings, and $ is not required.

2. mysql_select_db ()

It is used to select a database as the current database. Subsequent operations will be performed in this database. If this function is successfully executed, true is returned; otherwise, false is returned.

Syntax: mysql_select_db ("Database Name", "connection ID ");

The second parameter can be omitted. It will automatically find and connect to the last connection ID.

In this program, this statement is written as mysql_select_db ("yayu", $ link );

3. mysql_query ()

It is used to send a request string to the server.

Syntax: mysql_query ("The question string", connection ID );

The first parameter is a complete MySQL statement, and the second parameter can be omitted.

Before using this function, use mysql_select_db () to specify the database to be used.

When the query string is update, insert, or delete, the function returns true or false, indicating whether the query is successful. If the query string is a select statement, a result ID is returned, if an error occurs in select, false is returned.

After learning about the three important functions above, we can give orders to the database. What do we use to send orders? Let's take a look at four MySQL statements!

2. Basic knowledge of sending request statements to databases

They are: insert (insert data to the database), delete (delete data in the data table), select (retrieve data), and update (update data ).

1 insert (): insert data to the database.

Syntax A: insert into data table name (Field 1, Field 2 ,......) Values ("Content of Field 1 d", "2 content of field "...... )

Syntax B: insert into data table name set field 1 = "content of Field 1", Field 2 = "content of Field 2 ",......

The field name can be omitted for A, but the content of the values section must be the same as the field order defined in phpmyadmin.

See the example below:

A: insert into news (title, date, author, source, content) values ($ title, $ date, $ author, $ source, $ content)

Note: The above "$ ...... "Indicates the content of the field to be added. When it is defined: $ ...... = Content;

B: insert into news set title = $ title, author = $ author

Note: If the content is a number, "" can be omitted.

2 delete (): delete data from a data table

Syntax: delete from data table name where specified location limit number

If no "where specified location" exists, all data in the table is lost. "Limit number" indicates the maximum number of lines that can be deleted by the server.

Example: delete from news where id = $ id limit 1

3. select (): retrieve data

Syntax: select field name 1, Field 2 ,...... From data table name where location

To list the data of all columns in all records, you can use "*" to represent the field name.

Example: A: select id, author from news where id = $ id

B: select * from news where id = $ id

4 update (): update data

The syntax is almost the same as that of insert.

For example, update news set author = $ author, title = $ title where id = $ id

It is worth noting that when using the update statement, you must use the where clause. Otherwise, a large amount of data may be lost. For example:

Update news set author = "Bud rain"

This operation changes all the authors in the table to "bud rain.

Another positive example is to record the Administrator's table users. If there is a field named age, it is used to store the user's age. One year later, they will increase by one year, you can use the following statement:

Update users set age = age + 1

That's good. I have mastered most of the basics of the program now, and a few of them will be able to grasp it later in the example.

Now we are faced with the problem of writing algorithms.

Original php news system tutorial (first version) Lecture 3: news program algorithm (I) ------ Add news

I. Add news

Adding news is to add new data to the database.

The entire algorithm is as follows: the Administrator fills in the news content in the form, including: title, author, source, content, and the content of the other two fields (id, time) are completed on the server, of course, you have to write programs by yourself, but you can't help yourself manually. After submitting the form, use the MySQL statement to add them to the database.

The following describes the <input> label and <textarea> </textarea> label in the form.

<Input> label is a single-line text box. Commonly used attributes include name and type. The name attribute specifies the variable name, which represents the content in <input>. The type attribute specifies the nature of the content in <input>. If type = text, it is a general text. If type = password, the content in the "<input>" is displayed in black spots in the browser, so that the content cannot be accidentally seen by others, resulting in data security problems.

The <textarea> </textarea> label is a multiline text box. The common attribute is name.

In this program, the program is as follows:

<Input name = "author" type = "text" size = "40" maxlength = "20">

In "name =" author "," author "represents the content in" <input>. Similarly, this "author" can also be "title" or "Others". It is worth noting that this "author" is different from the field author. I mentioned two very similar concepts here: the Field author and the variable $ author (the above "author" is actually $ author, because it represents the content in "<input> ). Although they are almost identical, they are definitely not the same thing. Author is a field name in the data table news. PHP uses it to access data in MySQL with limited conditions. It cannot be replaced with other characters in the program; $ author is the variable symbol set by the user in this program. Its value is obtained from the name attribute of the corresponding element in "<input>. Since it is only a variable symbol, we can use any field, as long as it is consistent with the name attribute of the corresponding element in the form. The reason why we use the same character as the field name is that we don't have to remember another variable name.

Let's take a look at the content in the <textarea> </textarea> tab:

<Textarea name = "content" cols = "80" rows = "15" wrap = "HYSICAL">

The content in <textarea> </textarea> is used to obtain the content of the content field. Because there are too many content in this field, you can only use this label.

After filling in the content, we only need to submit the content. How can this process be implemented? Let's take a look at the following program:

<Input name = "submit" type = "submit" value = "submit News">
<Input type = "reset" name = "reset" value = "rewrite News">

Here, type = "submit"/type = "reset" represents the submission and rewriting of news respectively. The content of the value attribute is displayed on this button. Name = "reset"/name = "submit" has the same meaning as above.

The form element in HTML is specifically responsible for interactive operations by users. When you click the submit button, all the elements in the form will be submitted to the file indicated by the action in the form of variables for processing. The variable name is determined by the name attribute of the element. In this program, the Code is as follows:

<Form action = addnews. php method = post>

In this place, we put the data processing program on the same page (action = addnews. php). In the method attribute, we can make method = post. Here post is the method of passing values. Now we will discuss the following program on the page specified by action:

$ Author = $ _ POST ["author"];

Here, $ author is the variable name defined by us, and author is the name defined in the name attribute in the <input> label. POST is the value transfer method defined in <form>. $ _ POST [""] is used to collect the data obtained through this value transfer method.

The complete program is as follows:

If (@ $ _ POST ["submit"])
{
$ Author = $ _ POST ["author"];
$ Department = $ _ POST ["department"];
$ Title = $ _ POST ["title"];
$ Content = parsecontent ($ _ POST ["content"]);
$ Date = date ("y-m-d H: I ");
Mysql_query ("insert into news (title, date, author, department, content) VALUES ('$ title',' $ date', '$ author',' $ department ', '$ content ')");
}

For usage of the date () function, see other books. There are a total of five fields above, and there is another field id because we have selected auto-increment in the "Extra", so when the above data is inserted into the database, id is automatically added to 1.

Of course, before this program, you must first connect to the database, and all the following programs connected to the database are the same. You must first connect to the database.

Original php news system tutorial (first edition) Lecture 3: news program algorithm (ii) ------- display

2. Display news

After adding news, you can let others see the news.

The algorithm here is as follows: first display the news title and other additional content (such as the posting time) on the news homepage, which can output all the news titles in a loop. To view the specific news content, click the hyperlink of the news title to go to a new page to view the news.

Before starting this program, link the database.

When there are a lot of news, We Need To paging the news, and we have set each page to display 10 News.

The specific paging procedure is as follows:

$ Respage = mysql_query ("select count (*) FROM news;"); // $ num indicates the total number of records in the database.
While ($ row = mysql_fetch_row ($ respage ))
{
$ Num = $ row [0];
}
$ Recordnum = 10;
$ Pages = ceil ($ num/$ recordnum); // $ recordnum indicates the number of records displayed on each page, and $ pages indicates the total number of pages.
If (@ $ _ GET ["page"]) // obtain the parameter page in the url
{
// $ Current is the current page, $ pre is the previous page, and $ next is the next page, $ pre and $ next are the values of the connection parameter page on the previous and next pages.
// If the parameter in the url is 1, set the current page to the previous one, $ pre is also 1, and $ next is 2.
If ($ _ GET ["page"] = 1)
{
$ Current = 1;
$ Pre = 1;
$ Next = 2;
} Else {
// If the parameter in the url is not one (not the first page), set the value of the current page to the parameter obtained in the url, $ pre is the current page minus 1, and $ next is the addition of 1.
$ Current = $ _ GET ["page"];
$ Pre = $ current-1;
$ Next = $ current + 1;
}
} Else {
// If no parameter page exists in the url, set the current page to 1, $ pre = 1, $ next = 2
$ Current = 1;
$ Pre = '1 ';
$ Next = 2;
}
$ Now = ($ current-1) * $ recordnum;
$ Echopage = "<table width = 450 cellpadding = 0 cellspacing = 0> <tr> ";
$ Echopage. = "<td> <font>". $ pages. "page </font> </td> ";
$ Echopage. = "<td> <font> <a href =". $ _ SERVER ["HP_SELF"]. "? Page = 1> page 1 </a> <font> </td> <font> <a href = ". $ _ SERVER [" HP_SELF "]."? Page = ". $ pages."> last page </a> </font> </td> ";
$ Echopage. = "<td> <font> <a href =". $ _ SERVER ["HP_SELF"]. "? Page = $ pre> previous page </a> <a href = ". $ _ SERVER [" PHP_SELF "]."? Page = $ next> next page </a> </font> </td> ";
$ Echopage. = "<td> <font> to the <select name = 'topage' size = '1' onchange = 'window. location = "". $ _ SERVER ["PHP_SELF"]. "? Page = "+ this. value'> n ";
For ($ I = 1; $ I <= $ pages; $ I ++ ){
If ($ I = $ current)
$ Echopage. = "<option value = '$ I' selected> $ I </option> n ";
Else
$ Echopage. = "<option value = '$ I'> $ I </option> n ";
}
$ Echopage. = "</select> page </font> </td> ";
$ Echopage. = "</tr> </table> ";

I will not explain this procedure in detail. This is not the same as the news program algorithm. When we use it, we can write it after the output news title in this way:

Echo "<td align = 'center'>". $ echopage. "</td> ";

The reason is that $ echopage contains the program on which the page is selected.

Let's look at the following procedure:

1: $ SQL = "SELECT * FROM news order by id desc LIMIT $ now, $ recordnum ";

The "order by id desc" indicates that the evicted records are output in ascending order of numbers. In other words, the output of news is always first published. "LIMIT $ now, $ recordnum" limits the number of news outputs. The id size is between $ now and $ recordnum. For details, see $ now, for the value of $ recordnum, see the description of the paging program above (in bold and black ).

2: $ res = mysql_query ($ SQL );

This statement means to send a request to the server and save the returned result in $ res.

3: $ rows = fetch_assoc ($ res );

This statement splits the content of the query result $ res into an array rows. If $ res has no data, the function returns false. The fetch_assoc () function works the same way as mysql_fetch_row.

4: while ($ rows)
{
Echo "<tr> ";
Echo "<td align = 'left' valign = 'middle'> <a href = 'index. php? Id = ". $ rows ["id"]. "'target = _ blank> <font> ". $ rows ["title"]. "[". $ rows ["date"]. "] </font> </a> </td> ";
Echo "</tr> ";
}

While ($ rows) is the output of news in the ascending order of IDs. $ Rows ["title"], $ rows ["author"] is an array of content.

Next we will talk about how to view the content of each piece of news.

Let's take a look at the following in the above 4th programs:

<A href = 'index. php? Id = ". $ rows ["id"]. "'target = _ blank> <font> ". $ rows ["title"]. "[". $ rows ["date"]. "] </font> </a>

Where "href = 'index. php? Id = ". $ rows [" id "]." '"is the specific address of the $ rows [" id "] news. From the above, we can see that the program showing specific news is also in index. php. When you click this hyperlink, this program passes the parameter to the variable with the same name in the PHP file. Note that you can only pass parameters to dynamic pages, but not to static pages at the End of. htm.

So what are the parameters mentioned here? The above "index. php? Id = ". $ rows [" id "]."?" Is the start of the variable, "id" is the variable name, "". $ rows ["id"]. "" is the value of the variable. If you want to pass more parameters to the PHP file, separate them. For example:

Index. php? Id = ". $ rows [" id "]." & title = ". $ rows [" title "]."

In this program, the variable we get is "id". Now let's analyze this program!

1: First of all, we must ensure that this id has data in the database, so we can use the following statements to determine:

If (isset ($ _ GET ["id"]) {}

$ _ GET ["id"] Here is how to accept data from the address bar of the browser. Isset () is a function used to determine whether data exists.

2: if there is data, we will write the following program into the above.

$ SQL = "select * from news where id =". $ _ GET ["id"]. "";
$ Res = mysql_query ($ SQL );
$ Rows = fetch_assoc ($ res );
While ($ rows)
{
Echo "<table width = 750 cellpading = 1 cellspacing = 1 border = 0> ";
Echo "<tr> ";
Echo "<td colspan = '3' valign = 'middle' align = 'center'> <font size = '+ 1' color = red> <B> ". $ rows ["title"]. "</B> </font> </td> ";
Echo "</tr> <br> ";
Echo "<tr> ";
Echo "<td width = '000000' valign = 'middle' align = 'center'> <font color = red size = '2'> ". $ rows ["date"]. "". $ rows ["department"]. "". $ rows ["author"]. "</font> </td> ";
Echo "<tr> ";
Echo "<tr> ";
Echo "<td colspan = '3'> Echo "</tr> ";
Echo "<tr> ";
Echo "<td colspan = '3' valign = 'middle'> <font> ". $ rows ["content"]. "</font> </td> </tr> ";
Echo "<tr> ";
Echo "</table> ";
}

I believe that through the above explanation, you will be able to understand the above program.

Original php news system tutorial (first version) Lecture 5: news program algorithm (1) --- modify and delete

3. Modify and delete news

Like the program for viewing news, we should first list all news titles, and then select specific news for modification and deletion.

When listing news titles here, there is one more statement than the index. php program, that is, the output:

<A href = 'editnews. php? Id = ". $ rows [" id "]." 'target = _ self> modify </a>

By clicking this hyperlink, we will go to the specific program for modifying and deleting news.

The specific procedure is as follows:

If (@ $ _ GET ["id"])
{
$ Id = $ _ GET ["id"];
$ SQL = "SELECT * FROM news WHERE id = $ id ";
$ Res = mysql_query ($ SQL );
$ Row = fetch_assoc ($ res );
$ Edit = "<form method = post action = takeedit. php> ";
$ Edit. = "<table width = 800 cellpadding = 0 cellspacing = 0 border = 1> ";
$ Edit. = "<tr & gt; <td width = 150> <font> news by $ id </font> </td> & lt; td> <font> title: <input type = text name = title value = ". $ row ["title"]. "size = 80> </font> </td> </tr> ";
$ Edit. = "<tr> <td valign = top width = 150 border = 0> <font> author <input type = text name = author value = ". $ row ["author"]. "> <br> date: <br> ". $ row ["date"]. "</font> </td> <font size =-2> <textarea cols = 90 rows = 10 name = content> ". $ row ["content"]. "</textarea> </font> </td> </tr> </table> ";
$ Edit. = "<input type = hidden name = id value = $ id> ";
$ Edit. = "<input type = submit name = edit value = Modify> ";
$ Edit. = "<input type = submit name = delete value = delete> ";
$ Edit. = "</form> ";
Echo $ edit;
}

In the above "if (@ $ _ GET [" id "])", "@" indicates that an error message is returned when the function is disabled. In this way, when a program encounters an exception, the common user will not be able to see the inexplicable error information.

It is worth noting that we put the modifiable content in the attribute value, such as "value =". $ row ["title.

In the <form> label, set the action attribute to "action = takeedit. php". When a form is submitted, takeedit. php operates the database.

The statements in this example are all mentioned above. I don't believe you can understand them !!! The procedure is as follows:

If (@ $ _ POST ["edit"])
{
$ Author = $ _ POST ["author"];
$ Title = $ _ POST ["title"];
$ Content = $ _ POST ["content"];
$ Source = $ _ POST ["source"];
$ Date = date ("y-m-d H: I ");
Mysql_query ("UPDATE news SET author = '$ author', title =' $ title', content = '$ content', source = 'source ', date = '$ date' WHERE id = $ id ");
}
If (@ $ _ POST ["delete"])
{
Mysql_query ("delete from news WHERE id = $ id LIMIT 1 ");
}

Original php news system tutorial (first edition) Lecture 6: User Management

In this section, let's take a look at how to restrict the management of news programs to only the administrator. This includes registering an administrator. (phpmyadmin is recommended for this operation. After all, it cannot be used as an administrator), login, save the Administrator's information so that the system can identify him and ask him to operate and log out of the news.

In this lecture, I used annotations for programs to introduce relevant knowledge.

See the registered program below:

This program is divided into two parts: MYSQL and HTML (submit form ). The method for connecting the two parts is to set action = "register. php" in the <input> label when submitting the form ". Putting MYSQL in front is to avoid some PHP functions from allowing HTML output in front.

<?
If (@ $ _ POST ["submit"])
{
If (empty ($ name) | empty ($ password) | empty ($ repassword ))
// (Empty () function is used to determine whether the characters in it are null.
{
Echo "An error occurred while entering. Please <a href = 'register. php'> enter again </a> ";
}
If ($ password! = $ Repassword)
{
Echo "the two passwords are different. Please <a href = 'register. php'> enter them again </a> ";
}
// You can perform operations on the database based on the above judgment. The purpose of this operation is to reduce the burden on the server.
$ Link = mysql_connect ("localhost", "root ","");
Mysql_select_db ("yayu", $ link );
$ SQL = "SELECT id FROM users WHERE name = '$ name '";
$ Result = mysql_fetch_row (mysql_query ($ SQL ));
// The mysql_fetch_row () function stores all the data in an array, which is composed of numbers.
// Cited. Here, $ result is equivalent to 1 logic when data is returned.
// Check whether the user name submitted by the user is registered
If ($ result)
{
Echo "the same user name already exists. Please <a href = 'register. php'> enter another user name </a> ";
} Else {
// Add data to the database if everything is normal
$ SQL = "insert into users (name, password) values ('$ name',' $ password ')";
// Check whether user registration is successful
If (mysql_query ($ SQL, $ link ))
{
Echo "registration successful. Please log in immediately <a href = 'admin. php'> </a> ";
}
Else
{
Echo "registration failed. Please <a href = 'register. php'> try again </a> ";
}
}
} Else {
?>
<Center>
<H1 align = "center"> Registration <Form action = "register. php" method = "OST"> // The method for passing values is POST.
<P> code:
<Input name = "name" type = "text" value = "" size = "15">
<Br>
<Br>
Password:
<Input type = "password" name = "password" size = "15" maxlength = "50">
</P>
<P> re-enter the password:
<Input type = "password" name = "repassword" size = "15" maxlength = "50">
<Br>
<Br>
<Input type = "submit" name = "submit" value = "register">
<Input type = "reset" value = "Rewrite">
</P> </form>
</Center>
</Body>
</Html>
<?
}
?>

Let's look at the login and logout programs.

<?
If (@ $ _ POST ["submit"])
{
If (empty ($ _ POST ["username"])
Die ("Enter the user name ");
// The die () function is used here to prompt the user when the name is null.
Else
$ Username = $ _ POST ["username"];
// Record the user name.
If (empty ($ _ POST ["password"])
Die ("enter the password ");
Else
$ Password = $ _ POST ["password"];
$ Link = mysql_connect ("localhost", "root ","");
$ Selectdb = mysql_select_db ("yayu", $ link );
$ SQL = "select id, password, name from users where name = '$ username '";
$ Result = mysql_query ($ SQL) or die (mysql_error ());
While ($ pa = mysql_fetch_assoc ($ result ))
{// The mysql_fetch_assoc () function stores the returned data in an array. The subscript of the array corresponds to the field name //
$ Pwd = $ pa [password];
$ Userid = $ pa [id];
// Check whether the user name is correct
If (! $ Result)
{
Echo "wrong user name ";
Echo "<br> <a href = 'login1. php'> log on again </a> ";
Mysql_close ($ link );
Exit;
}
// Check whether the password is correct
If ($ pwd! = $ Password)
{
Echo "dear". $ username. "<br> ";
Echo "you entered the wrong password ";
Echo "<br> Please <a href = 'admin. php'> log on again </a> ";
Mysql_close ($ link );
Exit;
}
// If everything is normal, set the Cookie
Setcookie ("username", $ _ POST ["username"]);
Header ("Location: admin. php ");
}
If (@ $ _ GET ["action"] = "logout ")
{
Setcookie ("username ","");
Header ("Location: index. php ");
}
}
?>

In the above program, there is a very important thing, that is, Cookie.

Cookie is a small data packet stored by the Web server on the client. When the user connects to the Web server where the Cookie is placed again, the Web server can read it again to prevent data stored in the Cookie from being passed through the Cookie, the server can store specific information on the visitor's machine.

We can see a Cookie function setcookie () in the program, which is used to store the user name. Syntax: setcookie ("Custom username", "User Name ");

In a program that is occasionally written, "User Name" is used. When "User Name" is blank,

It is equivalent to logging out.

When the administrator needs to perform some client operations, the Cookie is required. Even if (@ $ _ COOKIE ["username"]) (is this method similar to POST)

For judgment. If username has a value, it is regarded as 1 in the logical volume.

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.