回答问题
(1)什么是表单
在网页中主要负责数据采集功能。一个表单有三个基本组成部分: 表单标签:这里面包含了处理表单数据所用CGI程序的URL以及数据提交到服务器的方法。 表单域:包含了文本框、密码框、隐藏域、多行文本框、复选框、单选框、下拉选择框和文件上传框等。 表单按钮:包括提交按钮、复位按钮和通常按钮;用于将数据传送到服务器上的CGI脚本或者取消输入,还能够用表单按钮来控制其余定义了处理脚本的处理工做。
(2)浏览器能够解析运行什么语言。
超文本标记语言:HTML
可扩展标记语言:XML
脚本语言:ASP、PHP、Script、JavaScript、VBScript、Perl、Python、ColdFusion、Java、JSP等。
(3)WebServer支持哪些动态语言
PHP、JSP。javascript
1.Web前端HTML
(1)Apache
安装
因为个人kali好像已有Apache
,因此就没有安装的过程,可是应该能够执行sudo apt-get install apache2
来安装
(2)Apache
启停php
service apache2 start
来启动apache
服务80
端口被占用,可执行netstat -tupln | grep 80
来查看占用80端口的其余进程,而后kill processID
来杀死该进程,而后从新开启apache
便可。service apache2 stop
来中止apache
服务Apache
127.0.0.1:80
,若是和下图同样,即说明可正常工做。127.0.0.1:80/20165228szk.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>登陆页面</title> <script language="javascript"> var movingID=null; var scrolling=false; function startMove() { var left=eval(bear.style.left.replace("px","")); if(left <document.body.scrollWidth-400) bear.style.left=left+1; else bear.style.left=1; movingID=setTimeout("startMove()",0.1); } function mysubmit() { if(document.form1.password.value=="" || document.form1.username.value=="") { alert("用户名、密码不能为空!"); window.location.href="login.html" } else form1.submit(); } </script> <style type="text/css"> a:link{color:#41506D;font-size:125%;text-decoration:none} a:visited{color:#41506D;font-size:125%;text-decoration:none} a:hover{color:#FFF200;font-size:125%;text-decoration:none} </style> </head> <body onload="startMove()" style="background-image: url(./login.png);background-repeat:no-repeat;topmargin:60;leftmargin:12 ;overflow-x:hidden;overflow-y:scroll;" > <br><br><br> <p align="right"> <a target=_parent href="index.jsp" >登 录</a> <a target=_parent href="addone.jsp" >注 册</a> </p> <form action="login.php" method="POST" name="form1"> <table style="background: url(./登陆.png);background-repeat:no-repeat;position:relative;left:300px;top:0px;border-collapse:collapse;"> <tr><th style="border:5px solid white;height:50px;width:230px;padding:0px;text-align:center;vertical-align:center;color:#41506D;font-size:150%;font-family:Microsoft YaHei UI;"> 帐 号 密 码 登 录 </th></tr> <tr> <td style="border:5px solid white;height:180px;width:230px;padding:0px;text-align:center;vertical-align:center;color:#41506D;"> <p style="position:absolute;left:27px;top:50px;font-size:130%;color:black;font-family:Microsoft YaHei UI;">用户名 </p> <input align="center" type="text" name = "username" style="position:absolute;left:100px;top:70px;height:35px;width:100px;font-size:130%;"/> <br><br> <p style="position:absolute;left:27px;top:100px;font-size:130%;color:black;font-family:Microsoft YaHei UI;">密 码 </p> <input align="center" type="password" name = "password" style="position:absolute;left:100px;top:120px;height:35px;width:100px;font-size:130%;"> <br> <input type = "button" value = "提交" onClick="mysubmit()" style="position:absolute;left:50px;top:190px;height:35px;width:150px;font-size:120%;"> </td> </tr> </table></form> <div id="bear" style="visibility:visible;position:absolute;left:1px;top:330px;z-index:1;width:400px;height:170px;overflow-x:hidden;overflow-y:hidden;"> </div> </body> </html>
2.Web前端javasciptcss
/etc/init.d/mysql start
便可开启MySQL服务mysqladmin -u root password "20165228"
,将root
的密码修改成20165228
。mysql -u root -p
以root
身份登陆MySQL,而后输入刚刚修改的密码。insert into mysql.user(Host,User,Password) values("localhost","szk",password("20165228"));
新建用户,用户名为szk,口令为20165228mysql
数据库内,执行use mysql;
使用该数据库。执行select user, password from user;
能够查询到用户、口令(密文)信息grant all privileges on *.* to 'szk' identified by '20165228' with grant option; FLUSH PRIVILEGES;
给新用户赋予权限create database 20165228szk;
可建立名为20165228szk的数据库。show databases;
可查看已有数据库的基本信息。use 20165228szk;
使用该数据库create table szk (username VARCHAR(20),password VARCHAR(20));
新建表insert into szk values('20165228','123456');
即向表中插入数据。select * from szk;
测试是否插入成功grant select,insert,update,delete on 20165228szk.* to szk@localhost identified by "20165228";
将对某数据库的全部表select
,insert
,update
,delete
权限授予当前主机localhost用户szk,其密码是20165228<?php $uname=($_POST["username"]); $pwd=($_POST["password"]); echo $uname; $query_str="SELECT * FROM szk where username='{$uname}' and password='{$pwd}';"; /* echo "<br> {$query_str} <br>";*/ $mysqli = new mysqli("127.0.0.1", "szk", "20165228", "20165228szk"); /* 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_str)) { if ($result->num_rows > 0 ){ echo "<br> Wellcome login Mr/Mrs:{$uname} <br> "; } else { echo "<br> login failed!!!! <br> " ; } /* free result set */ $result->close(); } $mysqli->close(); ?>
' or 1=1#
,密码随意,这时候的合成后的SQL查询语句为select * from users where username='' or 1=1#' and password=md5(''),#
至关于注释符,会把后面的内容都注释掉,而1=1是永真式,因此这个条件确定恒成立,因此可以成功登录:在登陆的用户名中输入:<img src="1.png" />szkun</a>
,读取/var/www/html
目录下的图片:
html
在运行MySQL时,总是忘记在命令结束时加;
,有时候从新打开MySQL不少次... 还有一个很神奇的是,昨天能好好解析php的浏览器,今天在html跳转action时居然提示php文件下载,很迷!最后发如今本地文件打开html时会出现该状况,经过apache打开时就能正常解析。前端
在上学期的网络安全编程课程中,咱们也学习了前端和后台的编写方法,而且演示过最简单的攻击,当时以为很神奇,但没有本身尝试过,此次实验中得以知足。java