3. Home page news release, making updates easier for you (Part 2)
-----In the previous lecture, we have implemented the basic function of home page news release. In this lecture, we will add some bricks and mortar to it to make it more powerful. (A useful software is actually basic functions plus a number of auxiliary functions. These auxiliary functions are mainly for convenience, haha)
-----First of all, let’s clarify what convenience we want to obtain . We don’t want to forget to delete something from dozens of days ago, and the result is still published as news on the homepage (very embarrassing ^&^). If we embed a piece of code in the basic implementation, for example using filectime($filename), then under UNIX we can get the time in seconds from January 1, 1970 to the last time the file was modified (in WINDOWS The following returns the date and time when the file was generated), and the number of seconds in seconds from January 1, 1970 to the present can be obtained using $mynow=mktime(), subtraction, judgment, IF > the time we expect , Hehe, Sorry, unlink($newspath.$filename)...what? ! Where should this code be placed, you ask? What do you think, haha.
Maybe you don’t often surf the Internet on the same machine. What should you do when you get a new piece of news but are not next to your favorite machine? The ideal thing is to upload files on the home page. You may have a page (Admin?) that requires a password to enter (if you still cherish your website, this is necessary, it is best not to let others know the file name, haha). The following is a piece of file upload code that can be seen everywhere:
if(isset($upfile))
{
?>
The uploaded file information is as follows :
File storage path :
Original file name :
File size (bytes):
File type :
}
else
{
?>