Joke Collection Website - Public benefit messages - Directory of typical modules for PHP development

Directory of typical modules for PHP development

Chapter 1 Environmental Construction

1. 1 PHP development environment and preparation 2

1.2 Installation of Apache+MySQL+PHP under Windows 2

1.2. 1 Install Apache server2

Install PHP 5 5

1.2.3 Install MySQL Server 5.

1.3 configuring Apache server and PHP 5 9

1.4 Set the execution environment of IIS+PHP under Windows 10.

Installation configuration of 1.5 under Linux 12

1.5. 1 Install Apache server 12

1.5.2 Install MySQL server 13

Install PHP 5 14

1.5.4 start/shut down the server 15

1.6 using the combination package under Windows 16

Chapter II PHP Foundation 17

2. 1 PHP variable 18

2. 1. 1 PHP variable 18

2. 1.2 PHP predefined variable 19

2.2 process control statement 19

2.2. 1 conditional control statement 19

2.2.2 Loop control statement 22

2.2.3 Interrupt and Continue Transfer Control Statement 26

2.3 Cookie and conversations 27

2.3. 1 Cookie management 27

2.3.2 Session Management 3 1

2.3.3 Comparison between Cookie and Session 32

2.4 PHP array 33

2.4. 1 what is array 33?

2.4.2 Declare Array 33

Traverse array 34

2.4.4 Conversion between String and Array 35

2.4.5 Counting the number of array elements 36

2.5 PHP date and time 36

2.5. 1 processing date and time 36

2.5.2 UNIX timestamp 40

2.5.3 System time zone setting 4 1

2.5.4 Date and time problems encountered in development 4 1

2.6 PHP string 42

2.6. 1 Difference between single quotation marks and double quotation marks 42

2.6.2 String connector 43

String operation 44

2.7 PHP file 45

2.7. 1 file processing 45

File upload 48

2.8 Object-oriented 48

2.8. 1 Basic concepts of object-oriented 48

PHP and object 49

Chapter 3 MySQL database foundation 57

3. 1 MySQL database 58

3. Introduction to1.1MySQL 58

3. 1.2 MySQL features 58

3. 1.3 Start MySQL server 58

3. 1.4 connecting and disconnecting MySQL server 59

3. 1.5 Stop MySQL server 6 1

3. 1.6 MySQL database backup and recovery 62

3.2 using MySQL command line 63

3.2. 1 MySQL database operation 63

MySQL Datasheet Operation 64

MySQL statement operation 68

3.3 phpMyAdmin graphic management tool 70

3.3. Introduction to1phpmyadmin 70

Installation and configuration of phpmyadmin 70

Operation database 72

Operation data table 74

3.3.5 Using SQL statement to operate data table 76

Managing data records 78

3.3.7 Generating and Executing MySQL Database Scripts 80

Chapter 4 Smarty Template 83

4. Introduction to1smarty84

4. 1. 1 What is Smarty 84?

4. 1.2 Smarty and MVC 84

4. Features of1.3 Smarty84

4.2 installation configuration of smarty84

Intelligent download and installation 84

4.2.2 The first intelligent program 85

4.2.3 Configure Smarty 86

4.3 Smarty template design 87

4.3. 1 smart template file 87

Note 87

Variable 87

4.3.4 Modifier (Variable Modifier) 90

4.3.5 Built-in function 9 1

4.4 Intelligent Programming 96

4.4. Common methods in1smarty96

4.4.2 Configuration variables of Smarty97

4.4.3 Smart Cache 98

4.5 Intelligent Application 99

4.5. 1 message board home page 99

4.5.2 Message 10 1.

4.5.3 View message 102

4.5.4 Modify message 104

Chapter V Registration and Login Verification Module 107

5. 1 Overview of Registration and Login Verification Module 108

5. 1. 1 user registration process 108

5. 1.2 User login process 108

5. 1.3 password recovery process 109

5.2 Hot Key Technologies 109

5.2. 1 SQL injection prevention technology 109

5.2.2 Ajax technology to achieve non-refresh verification 109

5.2.3 Verification code technology 1 1 1

5.2.4 Email activation technology 1 13

5.2.5 Use the keyboard to respond to the event and verify whether the information is legal 1 13.

5.2.6 Using Cookie technology to realize automatic login 1 15.

5.3 Registration and Login Verification Module 1 16

5.3. 1 database design 1 16

Database category 1 17

5.3.3 Implementation of registration function 1 19

5.3.4 Implementation of login function 125

5.3.5 Implementation and refresh of verification code 129

5.3.6 Implementation of Password Retrieval 130

5.4 program debugging 13 1

Chapter VI Upload and Download Module 133

6. 1 Overview of uploading and downloading modules 134

6.2 Hot Key Technologies 134

6.2. 1 php.ini configuration file 134

6.2.2 Upload Form Settings 135

6.2.3 Predefined variable $_FILES 135

6.2.4 File uploading function 136

6.2.5 Multi-file upload 137

6.2.6 File Download 137

6.3 Implementation Process 138

6.3. 1 database design 139

6.3.2 Realization of file upload function (including multi-file upload) 140

6.3.3 Implementation of File Download 142

6.4 program debugging 145

Chapter VII Paging Display Module 147

7. 1 Overview of Paging Display Module 148

7.2 Hot Key Technologies 148

7.2. 1 User-defined function replaces special characters in long text 148

7.2.2 User-defined function controls the output of extra-long text 149.

7.2.3 Create a connection database class 149

7.2.4 Creation of paging class 150

7.3 Paging module 15 1

7.3. 1 Install and configure Smarty templates 152

7.3.2 configuration and connection of adodb152

7.3.3 Page design of paging module 153

7.3.4 Program Development of Paging Module 154

7.4 Pagination display module 155

7.4. Realization of Paging Function for Long Text in1PHP155

7.4.2 Realization of Ajax Paging Function without Refresh 156

7.4.3 Implementation of PHP Paging Function 157

7.4.4 Implementation of Paging Function in PHP160

7.5 Program Debugging 162

Chapter 8 Website Quantity Analysis Module 163

8. 1 Overview of website statistical analysis module 164

8.2 Hot Key Technologies 164

8.2. 1 Prevention of double counting 164

8.2.2 Use the array_unique () function to obtain the IP traffic of the website in the current month 166.

8.2.3 Write the data in the array into the string 167.

8.3 Simple digital counter 167

8.4 Graphic digital counter 170

8.5 GD2 graphic counter 17 1

8.6 database digital counter 172

8.7 biscuit counter 174

8.8 Session number refresh counter 175

8.9 website counter analysis module 175

8.9. 1 Realization of counter function 176

8.9.2 Statistical Analysis of Website Visits 180

8.9.3 Use GD2 function to dynamically create a line chart 182.

8. 10 program debugging 184

Chapter 9 Message Module 185

9. 1 Message summary of this module 186

9. 1. 1 guestbook overview 186

9. 1.2 function structure of guest book 186

9. 1.3 guestbook system flow 187

9.2 Hot Key Technologies 187

9.2. 1 What is a sensitive word 187?

9.2.2 Filtering Sensitive Words 188

9.2.3 Adding Sensitive Words to Text File 189

9.2.4 Read the sensitive words 19 1 in the text file.

9.2.5 Verification code is verified on the current page 193.

9.2.6 Select all check boxes and deselect them 195.

9.3 Implementation Process 196

9.3. 1 MySQL database design 198

9.3.2 Define the database access class 198.

9.3.3 Implementation of message signature and sensitive word filtering 20 1

9.3.4 Realization of Echo of Paging Message and Host Information 203

9.3.5 Retrieval of message and reply information 207

9.3.6 Realization of reply function of moderator's message 2 10

9.3.7 Implementation of deleting messages and replying messages in batches 2 13

9.3.8 Realization of Moderators' Whispering Management Function 2 14

9.4 Program Debugging 2 15

Chapter 10 Search Engine Module 2 17

10. 1 search engine module overview 2 18

10. 1. 1 search engine definition 2 18

10. 1.2 search engine workflow 2 18

10.2 hotkey technology 2 18

Chinese word segmentation concept 10.2. 12 18

10.2.2 RMM word segmentation technology 2 19

10.2.3 Filter punctuation 222

10.2.4 Highlight query keyword 224.

10.2.5 search time 226

10.2.6 Block garbled characters when intercepting Chinese strings 227

10.2.7 Add Access Page to Favorites 227

10.3 implementation process 228

10.3. 1 RMM word segmentation query realization 228

10.3.2 implementation of secondary search function in query results 232

10.3.3 implementation of advanced search function 234

10.3.4 Realization of Internet query function of well-known websites 239

10.4 program debugging 243

Chapter 1 1 voting system module 245

1 1. 1 overview of voting system module 246

1 1.2 Key voting skills 246

1 1.2. 1 Dynamically generate voting topics and options 246

1 1. 2. 2 3D pie chart voting result analysis 249

1 1.2.3 voting result analysis histogram 250

1 1.2.4 Cookie voting limit 25 1

1 1.2.5 Session voting restrictions 252

1 1.2.6 Restrict repeated voting through IP 253.

1 1.2.7 e-mail address activation 254

1 1.3 simple voting system 255

1 1.3. 1 dynamically generate voting theme 256

1 1.3.2 dynamically add voting option content 256

1 1.3.3 voting subject content management 258

1 1.3.4 Implementation of voting function 259

1 1.4 Complex voting system 6 1

1 1.4. 1 database design 262

1 1.4.2 User Registration 262

1 1.4.3 User login 264

1 1.4.4 voting theme browsing 265

1 1.4.5 Submit the voting content 266

1 1.4.6 Refresh the voting results 270

1 1.5 program debugging 27 1

Chapter 12 Shopping cart module 273

12. 1 Overview of shopping cart module 274

12. 1. 1 shopping cart function overview 274

12. 1.2 shopping cart operation flow 274

12.2 hotkey technology 275

Installation configuration of 12. 2. 1 Smarty template 275

12.2.2 Smarty template dynamic-static separation 276

12.2.3 Session Creation of Shopping Cart 277

12.2.4 Judge whether there is the specified commodity 277 in the shopping cart through the array function.

12.2.5 Verify that the entered commodity quantity value is valid 278

12.3 implementation process 279

12.3. 1 Realizing the function of commodity display 279

12.3.2 Increase the realization of commodity functions 28 1

12.3.3 Implementation of deleting goods in shopping cart 282

12.3.4 Realization of the function of changing the quantity of goods in the shopping cart 283

12.3.5 Realization of the function of counting the quantity of goods in the shopping cart 284

12.3.6 Realizing the function of emptying the goods in the shopping cart 285

12.3.7 Implementation of order information filling function 286

12.3.8 Implementation of order generation function 288

12.4 Error Handling 289

Chapter 13 Online Payment Module 29 1

13. 1 Overview of online payment module 292

13.2 hotkey technology 293

13.2. 1 consignee information verification 293

13.2.2 Dynamically generate order number 295.

13.2.3 browser print 296

13.2.4 ICBC Payment 297

13.2.5 Alipay payment298

13.3 implementation process 299

13.3. 1 Realizing the function of commodity display 299

13.3.2 shopping cart function realization 30 1

13.3.3 Implementation of order printing and preview function 303

13.3.4 Implementation of order submission function 305

13.3.5 Implementation of Order Query Function 308

13.4 program debugging 309

Chapter 14 Chat Room Module 3 1 1

14. 1 chat room module overview 3 12

14.2 hotkey technology 3 12

14.2. 1 application framework layout chat room homepage 3 12

14.2.2 file operation technology

14.2.3 Timed refresh technology to delete silent users 3 16.

Scroll bar positioning technology in 14.2.4 scrolling display

14.2.5 mask refresh technology 3 17

14.2.6 monitoring client browser 3 19

14.3 Chatroom Module 3 19

14.3. 1 profile (config.php)3 19

14.3.2 common function file 320

14.3.3 User login verification 32 1

14.3.4 implementation of voice function 323

Implementation of User List Function 327

14.3.6 Implementation of public chat function and private chat function 329

14.3.7 Realization of automatically deleting dropped users 330

14.4 program debugging 33 1

Chapter 15 Forum Module 333

15. 1 forum module overview 334

15. 1. 1 system function description 334

1.2 database design 335

15.2 hotkey technology 336

15.2. 1 tree navigation menu 337

15.2.2 Post Top 338

15.2.3 Post Reference 339

15.2.4 afterset 340

15.2.5 Mask reply 34 1

15.2.6 connect to the remote MySQL database 342.

15.2.7 Non-refresh output of small note information 343

15.3 forum module design 344

Realization of the post publishing function of 15.3. 1 50000.100000000605

15.3.2 Implementation of post browsing function 347

15.3.3 Implementation of post reply function 35 1

15.3.4 Realization of posting function 354

15.3.5 Realization of station search function in 355

15.3.6 Set Job Category 356

15.3.7 Implementation of post management function 359

15.3.8 My Information Management

My friend manages 36 1

15. 3. 10 data backup and recovery 362

15.4 program debugging 363

Chapter 16 wishing wall module 365

16. 1 overview of wishing wall module 366

16. 1. 1 functional structure of wishing wall 46866

16. 1.2 system flow of wishing wall 366

16.2 hotkey technology 366

16.2. 1 DIV+CSS page style layout 366

16.2.2 to realize dragging and dropping DOM technology to move the wishing note 369.

16.2.3 Solving the Chinese garbled problem of PHP and Ajax 37 1

16. 2. 4 QQ number text box 372 prohibits Chinese input.

16.2.5 Classification and Selection of Emotional Patterns 373

16.2.6 Limit the length of comment content 374

16.2.7 Verify that the check code on the current page 375 is correct.

16.2.8 defines a random algorithm, which is used to generate the wish note within the specified range of 377.

16.2.9 Parsing IP to get the user's city 378

Talk to the wishing person through QQ 379.

16.3 implementation process 380

1 MySQL database design380

16.3.2 Sign the wishing note to realize the real-time preview of the note 38 1

16.3.3 After signing the wish note, the note will be placed at the top of 385.

16.3.4 When the specified comment is clicked, the comment will display 386.

16.3.5 Double-click the wishing note and it will be displayed at the top, blocking the whole page 387.

16.3.6 decimeter (by distance) displays the wishing note 388.

16.3.7 Search for the wishing note and highlight 395 at the top.

16.3.8 The wishing note ranks 397 according to the blessing value.

16.3.9 pray for others with Ajax refresh-free technology400

16.3. 10 The latest 10 Wish 40 1 is displayed by Ajax, and there is no refresh technology.

16.3. 1 1 application of Jpgraph graphic class library to realize the desired ratio 3D pie chart analysis of regional statistics 403

16.3. 12 statistical analysis of the number and proportion of people wishing by region by column chart 409

16.3. 13 Implementation of advanced search function for love wall list and wishing note 4 1 1

16.3. 14 mobile phone wishing note 4 15

16.3. 15 Close the wishing note 4 15

16.4 program debugging

Chapter 17 Blog Module 4 19

Blog overview 420

17.2 hotkey technology 420

17. 2. 1 MySQL Time and Date Type 420

17.2.2 database backup technology 42 1

17.2.3 using the "copy" command in JavaScript 422

The check box 422 is operated using JavaScript.

17.3 Blog 423

Database design 423

17.3.2 configuration file and common function file 426

Blog space personal homepage design 426

17.3.4 My article function realization 429

17.3.5 Implementation of article browsing function 430

17.3.6 Implementation of Item Management Module 432

17.3.7 Implementation of Friend Management Module 440

17.3.8 Implementation of Small Bill Management Module 4444

Implementation of user management module 446

17.4 program debugging 450

Chapter 18 online chess game module 45 1

18. 1 online chess game module overview 452

Overview 18. 1. 1 Chess 452

18. 1.2 layout chessboard 452

18. 1.3 chess rules 453

18.2 hotkey technology 453

18.2. 1 What is Ajax 453?

Advantages of Ajax 453

18.2.3 screen checkerboard information garbled 454

18.2.4 Rule Algorithm of Game 455

18.2.5 automatically quit the game room without playing chess for 30 minutes 46 1

18.3 implementation process 46 1

18.3. 1 automatic installation database 46 1

18.3.2 Create a game room 463

18.3.3 Change player name 465

18.3.4 Copy the game website to friends 466

18.3.5 chess game mode 467

18.3.6 Information Prompter 47 1

18.3.7 Ajax chat function without refreshing 473

18.3.8 Exit the game room 474

18.3.9 End the game 475

18.4 program debugging 475

Chapter 19 SMS sending module 477

19. 1 SMS sending module overview 478

19.2 hotkey technology 479

1 Web service technology 479

Socket programming technology 479

19.2.3 mobile phone number extraction 480

19.2.4 Add mobile phone number 48 1 in batches.

19.2.5 Submit mobile phone number format 483 through JavaScript verification.

19.2.6 birthday reminder 484

19.3 socket programming to send SMS 486

19.4 network service sends SMS 487

19.4. 1 the design of the database50000.00000000015

19.4.2 Realization of birthday reminder function 488

19.4.3 Implementation of the function of extracting common phrases 490

19.4.4 implementation of the short message sending function of webservice491

19.5 program debugging 494

Chapter 20 E-mail module 495

20. 1 e-mail module overview 496

20. 1. 1 email profile 496

20. 1.2 basic principles of e-mail 496

20.2 Hot Key Technologies 497

20.2. Installation and configuration of1SMTP server 497

20.2.2 installation and configuration of pop3 server 499

20.2.3 Loading of IMAP E-mail System Functions 500

20.2.4 Do not refresh to get the e-mail address 502

20.2.5 Delete e-mail address without refreshing 504

20.2.6 Ajax no refresh statistics email number 504

20.3 email module 505

20.3. 1 Realization of the function of logging in to the mail server 505

20.3.2 Realization of sending e-mail function 507

20.3.3 Implementation of the function of viewing unread emails 5 10

20.3.4 Implementation of Receiving Mail 5 14

20.3.5 Implementation of email content checking function 5 16

20.3.6 Realization of the function of downloading attachments 5 18

20.3.7 Implementation of deleting mail function 5 19

20.3.8 Realization of searching e-mail function 520

20.4 Program Debugging 522

Chapter 2 1 Podcast Module 523

2 1. 1 podcast module overview 524

2 1. 1. 1 podcast overview 524

2 1. 1.2 podcast source 524

2 1. 1.3 podcast website content classification 524

2 1. 1.4 The development prospect of podcasting. 265438.66868666666

2 1. 1.5 Podcast Module Function Structure 525

2 1.2 Key Technologies of Hotspots 526

2 1.2. 1 Smarty 526.

2 1.2.2 control player window state 527

21.2.3aAjax No Refresh Notes 528

2 1.2.4 Generate RSS subscription file 529

2 1.2.5 More related video search 53 1

2 1.3 Podcast Module 532

Database 2 1.3. 1 Podcast 532

2 1.3.2 Realization of online game function533

2 1.3.3 the realization of the click ranking function 536

2 1.3.4 video download function realization 5338

2 1.3.5 Create a podcast personal homepage 539

Realization of the function of uploading video files on 21.3.6.50000.000000000605

2 1.3.7 on-site subscription 545

2 1.3.8 subscription management 546

2 1.3.9 Dynamically create video file types 549

Realization of upload video management function of 21.3.10.50000.000000000005

2 1.4 program debugging 552

Chapter 22 Online Music Module 555

22. 1 Overview of online music module 556

22.2 Hot Key Technologies 557

22.2. 1 embedded tag 557

22.2.2 Object Label 557

22.2.3 lyrics synchronization technology 558

22.2.4 Create a file in .m3u format 560

22.2.5 Ajax deletes files in .m3u format without refreshing 56 1.

22.2.6 JavaScript is applied to realize the functions of selecting all, deselecting and deselecting 562.

22.3 Implementation process 563

22.3. 1 connect MySQL database 563 through ADODB.

22.3.2 Realization of the function of uploading audio files 565

22.3.3 Realization of the online audition function/kloc-0 /46866.66866868686

22.3.4 Realization of the function of playing music continuously in a loop 569

22.3.5 Realization of Playlist Function573

22.3.6 Realization of Music Download Function 574

22.3.7 Collecting and playing music from other websites 575

22.3.8 Realization of search function in the station576

22.3.9 Administrator Permission Settings 579

22.4 program debugging 58 1

Chapter 23 Electronic Album Module 583

23. 1 Overview of electronic photo album module 584

23.2 Hot Key Technologies 584

23.2. 1 CSS filtering technology 584

23.2.2 Obtaining the uploaded picture information 587

23.2.3 Thumbnail Technology588

23.2.4 Add text 59 1 to the picture by using GD library technology.

23.2.5 Applying the positioning technology in Javascript to realize layer dragging 592

23.3 Implementation process 594

Database design 594

23.3.2 Public * * * Functions and Documents 595

23.3.3 album category management 596

23.3.4 Implementation of Album List 600

23.3.5 Realization of Picture Browsing Function 602

23.3.6 Implementation of Modify Picture Function 608

23.3.7 Realization of album making function 6 12

23.3.8 Realizing the function of appreciating photo albums 6 17

23.4 Program Debugging 620

Chapter 24 RSS reader module 62 1

24. 1 RSS reader module overview 622

24. 1. 1 RSS overview 622

24. 1.2 RSS history 622

24. 1.3 element 622 of RSS 2.0

24.1.4 development trend of RSS 624

24.2 Hot Key Technologies 624

24.2. 1 Create an RSS file 624

24.2.2 Judging whether the specified file exists 626

24.2.3 Automatically obtain the contents of newspaper clippings 627

24.2.4 The tree navigation menu outputs the channel group and channel 628.

24.2.5 Ajax reads subscription information without refreshing 629

24.2.6 Assign a value to the drop-down list through the html_options function 630.

24.3 RSS reader 63 1

24.3. 1 Realization of adding channel group function 63 1

24.3.2 Realization of adding channel function 633

24.3.3 Dynamically output the contents of channel groups and channels 635

24.4 Create a website that supports RSS reading 636

24. 4. 1 Create a website that supports RSS reading 636

24.4.2 Dynamically create RSS files 637

24.5 program debugging 639

Chapter 25 Weather Forecast Module 64 1

25. 1 synopsis of weather forecast module 642

25. 1. 1 weather forecast summary 642

25. 1.2 aging classification of weather forecast 642

25. 1.3 the development of weather forecast .58666.666666666686

25. 1.4 Common symbols for weather forecast 643

25. 1.5 Various functions of weather forecast 644

25.2 Hot Key Technologies 644

25.2. 1 XML technology 644

25.2.2 Apply IFRAME floating frame tag to access the data of candlestick 646.

25.2.3 Use the array to traverse the names of major cities in China.

25.2.4 Write the obtained weather forecast information into the XML file 65 1.

25.3 Use Iframe framework to directly obtain the weather forecast of Wentianwang 653.

25.4 Query the weather forecast and index forecast of cities in the next five days.

25.5 Obtain the urban weather forecast of China Meteorological Bureau for the next 72 hours.

25.6 program debugging 660

Chapter 26 Website Publishing 663

26. 1 domain name registration 664

26. 1. 1 domain naming rules 664

26. 1.2 domain name classification 664

26. 1.3 Register the paid domain name 665

26. 1.4 Register a free domain name 665

26.2 Register Virtual Hosts 666

26.2. 1 What is a virtual host 666

26.2.2 Register a paid virtual host 666

26.2.3 Register a free virtual host 667

26.3 Publish the website to the personal server 667

26.4 Publish the website to FTP server 668