Session on setting up a personal website in PHP (1). Read the session on setting up a personal website in PHP (1). here we will share with you some experiences in setting up a personal website. Sorry, please correct me! Is it cool to edit and debug win98 locally? First, run OmnihttpdProffesinalV2.06 and install PHP4beta3. If you are familiar with HTML, "> <LINKh will share with you the experience in setting up a personal website. Sorry, please correct me!
1. edit the debugging environment
Win98 local editing and debugging, cool? First, run Omnihttpd Proffesinal V2.06 and install PHP4beta3. If you know HTML better, EditPlus is recommended! Otherwise, you have to use DreamWeaver first. Connect to the database? Fortunately, MySQL also has the For WIN32 version.
2. first, a counter
Your counters are always better than others! The counter source code introduced today is always the kind of refresh that will take a long time, so it is a bit self-deceiving. However, let's analyze how it works first. Below is an example of a simple counter:
If (file_exists ($ countfile ))
{$ Fp = fopen ($ countfile, "r + ");
$ Count = fgets ($ fp, 5); $ count + = 1; rewind ($ fp );
Fputs ($ fp, $ count, 5 );
Fclose ($ fp );
}
Else
{
$ Fp = fopen ($ countfile, "w ");
$ Count = "1 ";
Fputs ($ fp, $ count, 5 );
Fclose ($ fp );
};
?>
This counter has an external number, which is called "long _ ^" when it is flushed. So how can we make the counter more authentic? PHP4 gives us a simple way to use SESSION-level variables. When you enter the page, first check whether the COUNT in the SESSION exists and is equal to the value you want. Otherwise, the COUNT is equal to the first, and then call the COUNT process. after the SESSION ends, you can say to COUNT: byeBye!
But what should I do if it is not PHP4? Do you still remember the cookie? We can assume that a person's request to your web page does not belong to a new user within 15 minutes (or within another period of time), so that you can make a counting process in INC, when each page is referenced, the visitor sends the access time to the cookie upon first entry. When each page is accessed, the last cookie access time value will be checked. If the difference is greater than 15 minutes, it will be counted; otherwise, the time will be refreshed. (You don't even know how to use cookies, do you? Haha, we recommend a book "PHP core programming", which is in Tsinghua version. it is enough to query functions. every function has an example:-D)
However, the counter just now has no appearance at all. it is estimated that you are not satisfied. change the image. Make a set of 0.jpg, 1.jpg ...... 9. jpg. Didn't I just read a string? After the combined outputs, the graphic counter will not come out?
Well, the counters for individual users are already perfect.
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.