【仿写】[极客大挑战 2019]EasySQL

imtaieee / 2024-01-31 / 原文

index.html

<!DOCTYPE html>
<html>

<style>
                .slickButton3 {
                        margin-right:20px;
                        margin-left:20px;
                        margin-top:20px;
                        margin-bottom:20px;
                color: white;
                font-weight: bold;
                padding: 10px;
                border: solid 1px black;
                background: #111111;
                cursor: pointer;
                transition: box-shadow 0.5s;
                -webkit-transition: box-shadow 0.5s;
                }

                .slickButton3:hover {
                box-shadow:4px 4px 8px #00FFFF;
                }
                img {
                        position:absolute;
                        left:20px;
                        top:0px;
                }
                p {
                        cursor: default;
                }
                .input{
                        border: 1px solid #ccc;
                        padding: 7px 0px;
                        border-radius: 3px;
                        padding-left:5px;
                        -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
                        box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
                        -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
                        -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
                        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s
                }
                .input:hover{
                        border-color: #808000;
                        box-shadow: 0px 0px 8px #7CFC00;
                }                
        </style>


<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
        <meta charset="UTF-8">
        <title>用户登陆</title>
</head>
<body background="image/background.jpg" style="background-repeat:no-repeat ;background-size:100% 100%; background-attachment: fixed;" >
        <form action="http://127.0.0.1:10000/check.php" method="GET">
                <div>
                        </br></br></br></br>
                        <p style="font-family:arial;color:white;font-size:20px;text-align:center;font-family:KaiTi;">我是cl4y,是一个WEB开发程序员,最近我做了一个网站,快来看看它有多精湛叭!</p>
                        </br></br></br></br></br></br></br>
                        <p style="font-family:arial;color:white;font-size:20px;text-align:center;">用户名:</p>
                        <div align="center"><input type="text" name="username" style="text-align:center;" class="input" /></div>

                        <p style="font-family:arial;color:white;font-size:20px;text-align:center;">密  码:</p>
                        <div align="center"><input type="text" name="password" style="text-align:center;" class="input" /></div>

                        <div align="center">
                                <input type="submit" value="登录" class="slickButton3">
                        </div>
                </div>
        </form>

        <div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
</body>
</html>

check.php

<?php

    ini_set('display_errors',0);
    $mysql_server   = "localhost";
    $mysql_username = "root";
    $mysql_password = "root";
    $mysql_database = "TEST";

    $Error = <<<EOT
    <!DOCTYPE html>
    <html>
    
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <head>
        <meta charset="UTF-8">
        <title>check</title>
    </head>
    <div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
    
                    <body background='image/background.jpg' style='background-repeat:no-repeat ;background-size:100% 100%; background-attachment: fixed;'>
                        <br><br><br>
                        <h1 style='font-family:verdana;color:red;text-align:center;font-size:70px;'>NO,Wrong username password!!!</h1>
                    </body>
                    
    
    </html>
EOT;
    
    $Right = <<<EOT
    <!DOCTYPE html>
    <html>
    
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <head>
        <meta charset="UTF-8">
        <title>check</title>
    </head>
    <div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
    
                    <body background='image/background.jpg' style='background-repeat:no-repeat ;background-size:100% 100%; background-attachment: fixed;'>
                        <br><br><br>
                        <h1 style='font-family:verdana;color:red;text-align:center;'>Login Success!</h1><br><br><br>
                        </br>
                        <p style='font-family:arial;color:red;font-size:30px;text-align:center;'>flag: </p>
                        </br>
                        <p style='font-family:arial;color:#ffffff;font-size:30px;text-align:center;'>flag{462823ad-7c82-4b12-bb80-a1fbe824b98a}
    </p>
                    </body>
                    
    
    </html>
EOT;

    $conn = mysql_connect($mysql_server,$mysql_username,$mysql_password) or die("数据库链接错误");

    mysql_select_db($mysql_database,$conn);
    mysql_query("set names 'utf8'");
    
    $SQL = "SELECT * FROM account where username=\"".$_GET["username"]."\" and password=\"".$_GET["password"]."\";"; 
    echo $SQL;

    $result=mysql_query($SQL);
    if(mysql_fetch_row($result)!=0)
    {
        echo $Right;
    }
    else
    {
        echo $Error;
    }
?>