其他分享
首页 > 其他分享> > 2019-2020-2 网络对抗技术 20175213吕正宏 Exp8 Web基础

2019-2020-2 网络对抗技术 20175213吕正宏 Exp8 Web基础

作者:互联网

2019-2020-2 网络对抗技术 20175213吕正宏 Exp8 Web基础

一、实验简述

1.实验要求

2.基础问题回答

什么是表单?

浏览器可以解析运行什么语言?

WebServer支持哪些动态语言?

二、实验步骤

1.Web前端:HTML

<html> 
<head> 
<title>Login</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> 
<body> 
    <h2 align="center">Login</h2> 
            <center> 
        <form action="login" method="post"> 
            <input placeholder="E-mail" name="Name" class="user" type="email"> 
            <br> 
            </br> 
            <input placeholder="Password" name="Password" class="pass" type="password"> 
            <br> 
            </br> 
            <input type="submit" value="Login"> 
    </form> 
            </center> 
</body> 
</html>

2.Web前端:javascipt

<html> 
<head> 
<title>Login</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
</head> 

<body> 
<h2 align="center">Login</h2> 
    <center> 
    <form action="login" method="post" name="form_login"> 
        <input placeholder="E-mail" name="Name" class="user" type="email" onfocus="if (this.value=='Your email') this.value='';" /> 
        <br> 
        </br> 
        <input placeholder="Password" name="Password" class="pass" type="password" onfocus="if (this.value=='Your password') this.value='';"/> 
        <br> 
        </br> 
        <input type="submit" value="Login" onClick="return validateLogin()"/> 
    </form> 
    </center> 
<script language="javascript"> 
    function validateLogin(){ 
        var sUserName = document.form_login.Name.value ; 
        var sPassword = document.form_login.Password.value ; 
        if ((sUserName =="") || (sUserName=="Your email")){ 
            alert("User Email!"); 
            return false ; 
        } 
        if ((sPassword =="") || (sPassword=="Your password")){ 
            alert("Password!"); 
            return false ; 
        } 
    } 
</script> 

</body> 
</html>

3.Web后端:MySQL基础

4.Web后端:编写PHP网页

<?php 
echo ($_GET["a"]); 
include($_GET["a"]); 
echo "Hello word! This is my php test page!<br>"; 
?>

<?php
$uname=$_POST["Name"];
$pwd=$_POST["Password"];
echo $uname;
$query_str="SELECT * FROM login where username='$uname' and password='$pwd';";
$mysqli = new mysqli("127.0.0.1", "lzh5213", "5213", "5213lzh");
$query_str1="use 5213lzh;";

/* check connection */if ($mysqli->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}
echo "connection ok!";
/* Select queries return a resultset */if ($result = $mysqli->query($query_str1))
echo"<br>Success into database!";
echo$uname;
if ($result = $mysqli->query($query_str)) {
    if ($result->num_rows > 0 ){
            echo "<br> {$uname}:Welcome!!! <br> ";
    } 
    else {
        echo "<br> login failed!!!! <br> " ; }
    /* free result set */
    $result->close();
}
$mysqli->close();
?>

5.最简单的SQL注入,XSS攻击测试

SQL注入

XSS攻击

三、心得体会

这次实验是有关于WEB的相关内容,因为上学期学习过刘念老师的Web编程课,所以本次实验操作起来相对比较容易。而且这次实验里的HTML和jsp的内容既熟悉又有新东西,因为是在linux系统下操作,所以也让我学习到了很多。
本次实验的内容也和我们的专业知识相关联,在今后的学习中也会对其有更深入的了解。

标签:Web,Exp8,表单,命令,html,2020,login,输入
来源: https://www.cnblogs.com/LZHNB/p/12938698.html