Environmentally friendly website system based on php

Collect and follow to avoid getting lost

Article directory

  • 1. Project introduction
  • 2. Development environment
  • 3. Function introduction
  • 4. Core code
  • 5. Effect drawing
  • 6. Article Table of Contents

1. Project introduction

Environmental protection issues have always been a key issue of concern to our country. In recent years, our environmental awareness has gradually increased. This system is mainly to promote environmental protection, so that everyone can better understand and learn environmental protection knowledge, garbage classification and other issues.

The research goal of this system is to complete the design and development of the Hainan environmental protection website system with front-end and back-end interaction. This system is written using HTML5, CSS3 and JavaScrit, and the back-end uses PHP to interact with the front-end and database technologies. design. Through front-end and back-end technologies as a visual interface that directly interacts with users, various functions of the system are provided to users and administrators for use. Back-end management is supported by node.js and database technology, which includes database backup and maintenance of each data form. It accepts user requests and completes corresponding logical operations through the system website, thereby establishing data consistency and A library with strong integrity and good data security. By establishing the Hainan environmental protection website system, a platform for human protection of nature is built. People can not only understand the current environmental situation through the Hainan environmental protection website system, but also facilitate people-to-people communication on the platform, and better protect the environment. Run an effective promotional campaign.
This system mainly implements the Hainan environmental protection website system, and will implement login and registration functions, website homepage functions, environmental protection product functions, environmental protection activity functions, basic information query functions, environmental protection circle functions, etc.

2. Development environment

Development language: PHP
Framework: native php/thinkphp5
Server: Apache
Database: mysql 5.7
Database tool: Navicat 11
Running software: Xiaopi phpStudy
Browser: Google Chrome
—————-

3. Function introduction

(1) Login registration function: realize the login registration page function of users and administrators;
(2) Website homepage function: Click on the homepage to display the jump function of the corresponding page content.
(3) Environmentally friendly product function: realize the functions of adding, editing and deleting environmentally friendly products.
(4) Environmental protection activity function: realize the function of signing up for the activities issued in the environmental protection website system.
(5) Basic information query function: realize the query function of relevant information during the use of the website.
(6) Environmental circle function: the function of realizing information exchange between people in the system platform.

When designing this system, the detailed functions are determined. These functions are mainly obtained through research and analysis in the demand stage. The specific function modules are as follows, as shown in Figure 4-1.

4. Core code

Part of the code:

require_once("./config.php");
class CommonController{<!-- -->
public function __construct()
    {<!-- -->
        header("Access-Control-Allow-Origin: *");
        header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
        header('Access-Control-Allow-Headers:Origin,Content-Type,Accept,token,X-Requested-With,device');
    }
    //Public method file
    /**
     * Get the header token
     **/
    public function token(){<!-- -->
        $token = $_SERVER['HTTP_TOKEN'];
        if (!$token){<!-- -->
            return false;
        }
        return $token;
    }
    /**
     * Verify token and query user ID
     **/
    public function checkToken(){<!-- -->
        $token = $this->token();
        $uid = $_SESSION[$token];
        if (empty($uid)) return false;
        return $uid;
    }
    /**
     *curl request
     * post
     * */
    public function request_post($url = '', $param = '') {<!-- -->
        if (empty($url) || empty($param)) {<!-- -->
            return false;
        }
        $postUrl = $url;
        $curlPost = $param;
        $curl = curl_init();//Initialize curl
        curl_setopt($curl, CURLOPT_URL,$postUrl);//Catch the specified web page
        curl_setopt($curl, CURLOPT_HEADER, 0);//Set header
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//requires the result to be a string and output to the screen
        curl_setopt($curl, CURLOPT_POST, 1);//post submission method
        curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//Set whether to check the server-side certificate
        $data = curl_exec($curl);//Run curl
        curl_close($curl);
        return $data;
    }
    /**
     * Field accumulation
     * $tables data table
     * $id data id
     * $column field
     * $num accumulated value
     * */
    public function andone($tables,$id,$column,$num=1){<!-- -->
        $sqlcheck = "select `id`,`".$column."` from `".$tables."` where `id` =".$id;
        $dataCheck = table_sql($sqlcheck);
        $rows = 0;
        while($row = $dataCheck->fetch_assoc()) {<!-- -->
            $rows = $row[$column];
        }
        $sum = round($rows + $num);
        $sql = "update `".$tables."` set ".$column." = ".$sum." where `id` =".$id;
        table_sql($sql);
        return true;
    }
}

5. Renderings

Please add image description
Please add a picture description
Please add a picture description
Please add a picture description
Please add a picture description
Please add an image description
Please add image description
Please add image description
Please add a picture description

6. Article directory

Table of contents
Abstract I
Abstract II
Chapter 1 Project Overview 1
1.1 Problem description 1
1.2 Project Goals 1
1.3 Scope of project application 2
1.4 Norms and standards that the project should comply with 2
1.5 Stakeholders 2
Chapter 2 Requirements Analysis 3
2.1 Business requirements 3
2.1.1 Business process 3
2.1.2 Business Object 3
2.2 Functional requirements 4
2.2.1 Use case overview 4
2.2.2 Use case description 5
2.3 Non-functional requirements 8
2.4 Operating environment 9
Chapter 3 System Design 10
3.1 Technical route 10
3.2 Software architecture design 11
3.2.1 Functional structure 11
3.2.2 System architecture 11
3.3 Database design 12
3.3.1 Conceptual structural design 12
3.4.2 Detailed design of table 13
Chapter 4 System Implementation 19
4.1 Core function implementation 19
4.2 Key technical difficulties and solutions 25
Chapter 5 System Testing 27
5.1 Functional testing 27
5.2 Test summary 29
Chapter 6 Conclusion and Outlook 31
Reference 33
Acknowledgments 34