瀏覽器能夠解析運行什麼語言。
超文本標記語言:HTML
可擴展標記語言:XML
腳本語言:ASP、PHP、Script、JavaScript、VBScript、Perl、Python、ColdFusion、Java、JSP等。javascript
WebServer支持哪些動態語言
PHP、JSP。php
一、安裝Apache
(已安裝)
二、Apache
css
service apache2 start
啓動服務netstat -tupln | grep 80
查詢80端口是否被佔用service apache2 stop
中止服務三、測試html
瀏覽器輸入127.0.0.1:80
前端
瀏覽器輸入127.0.0.1:80/5227zy.html
java
<!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>
一、Mysql
安裝(自帶)
二、啓動mysql
/etc/init.d/mysql start
開啓服務mysqladmin -u root password "5227"
,將root的密碼修改成5227執行mysql -u root -p
以root身份登陸MySQL
web
命令GRANT USAGE ON *.* TO 'zhuyue'@'localhost' IDENTIFIED BY '5227' WITH GRANT OPTION;
創建新用戶
sql
use mysql
使用數據庫;select user, password from user;
查詢用戶grant all privileges on *.* to 'szk' identified by '20165228' with grant option;
FLUSH PRIVILEGES;
給新用戶賦予權限create database zhuyue27;
建立zhuyue27
數據庫drop database zhuyue27;
能夠刪除數據庫
數據庫
zhuyue27
數據庫,執行create table zy (username VARCHAR(20),password VARCHAR(20));
新建表向表中插入數據insert into zy values('20165227','72256102');
命令grant select,insert,update,delete on zhuyue27.* to zhuyue@localhost identified by "5227";
將對某數據庫的全部表select
,insert
,update
,delete
權限授予當前主機localhost用戶zhuyue
,其密碼是5227
編寫PHP網頁,進行用戶認證login.php
<?php $uname=($_POST["username"]); $pwd=($_POST["password"]); echo $uname; $query_str="SELECT * FROM zy where username='{$uname}' and password='{$pwd}';"; /* echo "<br> {$query_str} <br>";*/ $mysqli = new mysqli("127.0.0.1", "zhuyue", "5227", "zhuyue27"); /* 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="zy.jpg" />zhuyue</ a>
,讀取/var/www/html目錄下的圖片: