web安全学习笔记(13)

发布于:2024-05-10 ⋅ 阅读:(20) ⋅ 点赞:(0)

记一下第20-21节课的内容。PHP+HTML套模板做一个企业官网、BurpSuite安装与原理+VPN衔接

一、PHP+HTML套模板做一个企业官网

1、下载模板

下载Logistica - Shipping Company Website Template模板,并放到服务器的/template目录中,内容如下:

2.根据模板进行修改

我们先新建function.php和index.php,通过PHP代码来实现前后端的交互。并对index.html、service.html、contact.html、about.html进行一些修改,通过修改的过程,进一步了解HTML语言的相关语法,虽然不需要对HTML非常熟悉,但是也要大致知晓如何进行修改。

index.php内容如下:

<?php
require_once('./function.php');
session_start();

$a = !empty($_GET['a']) ? $_GET['a'] : 'index';
$b = !empty($_GET['b']) ? $_GET['b'] : 'index';
$c = !empty($_GET['c']) ? $_GET['c'] : 'index';
$t = !empty($_GET['t']) ? $_GET['t'] : 'index';
$f = $_SERVER['REQUEST_METHOD'];

switch ($a) {
    #网站首页
    case 'index':
        switch ($b) {
            #首页
            case 'index':
                require_once('./template/index.html');
            break;

            #关于我们
            case 'about':
                require_once('./template/about.html');
            break;

            #服务列表
            case 'service':
                $sql = "SELECT * FROM Service_Team";
                $result = Query($sql);
                $Service_Team ='';
                foreach ($result as $k => $v) {
                    $Service_Team .= '<div class="testimonial-item p-4 my-5">
                                        <i class="fa fa-quote-right fa-3x text-light position-absolute top-0 end-0 mt-n3 me-4"></i>
                                        <div class="d-flex align-items-end mb-4">
                                            <img class="img-fluid flex-shrink-0" src="'.$v['photo'].'" style="width: 80px; height: 80px;">
                                            <div class="ms-4">
                                                <h5 class="mb-1">'.$v['name'].'</h5>
                                                <p class="m-0">'.$v['profession'].'</p>
                                            </div>
                                        </div>
                                        <p class="mb-0">'.$v['remarks'].'</p>
                                    </div>';
                }
                



                require_once('./template/service.html');
            break;

            #联系我们
            case 'contact':
                switch ($f) {
                    #访问页面
                    case 'GET':
                        require_once('./template/contact.html');
                    break;
                    #接收留言
                    case 'POST':
                        # code...
                        break;
                    
                    default:
                        # code...
                        break;
                }
                
            break;    
                            
            default:
                # code...
            break;
        }
        break;
}

注意理解此处代码的含义:

这里是对service.html中的对应部分的代码复制过来,对其进行修改(即将要展现的东西换为我们在数据库中存储的内容),然后将service.html的对应内容也进行修改:

这样,在index.php中,通过引用function.php中我们自己定义的Query函数,与数据库进行连接,让页面展现出我们自己想展现的内容:

类似地,我们可以修改其他对应的部分,使这个模板能够实现我们想要的功能。而对于HTML文件的修改,要注重使用F12进行对照,来确定某个标签与网页之间元素的对应关系。

二、BurpSuite安装与原理

这里没有使用课程一致的burp,从吾爱破解上下载的burp,都一样可以使用。

这里下载firefox,并安装FoxyFroxy扩展,添加127.0.0.1:8080代理:

然后就可以使用burp进行抓包了。