Font size
WorksheetsHọc phần tốt nghiệp 2
Total questions: 100
Worksheet time: 50mins
<input type=”list”>
<input type=”dropdown”>
<list>
<select>
Trang web sau có thể bị tấn công bằng: <?php
$name = $_GET['name'];
echo 'Welcome $name<br>';
echo '<a href="http://examples.com/">Click to Download</a>';
?>
<input type=”submit”>
<input type=”reset”>
<input type=”password”>
<input type=”text”>
Kết quả của đoạn mã dưới đây là gì? <?php
Function 2myfunction()
{
Echo “KMA”;
}
2myfunction()
?>
Đoạn mã sau kết nối cơ sở sử dụng: <?php
$servername = "localhost";
$username = "username";
$password = "password";
$database="my_db";
$conn = new mysqli($servername, $username, $password, $database);
if ($conn->connect_error) {
die("Connection failed:" ".$conn->connect_error);
}
echo "Connected successfully";
?>
<scripting>
<script>
<js>
<javascript>
Đoạn mã để phần tử <div> sẽ chuyển sang màu đỏ khi ai đó di chuột qua
<div onmouseover="backgroundColor='red'">myDIV.</div>
<div onmouseover="this.style.backgroundColor='red'">myDIV.</div>.
<div onmouseover="Color='red'">myDIV.</div>
<div onmouseover="style.backgroundColor='red'">myDIV.</div>
Đoạn mã sau kết nối cơ sở sử dụng: <?php
$servername = "localhost";
$username="username";
$password="password";
$database="my_db";
$conn=mysqli_connect($servername,Susername,Spassword.$database);
if (!$conn) {
die("Connection failed: ". mysqli_connect_error());
}
echo "Connected successfully":
?>
Kết quả của đoạn mã dưới đây là gì? <?php
$a="25KMA";
$b=10;
$c=$a+$b;
echo "$c";
?>
Mã khai báo phía dưới để sử dụng Bootstrap CDN: <link href="/bootstrap.min.css" rel="stylesheet">
<script src="/bootstrap.bundle.min.js"></script>
<section>
<top>
<head>
<header>
Cả phần <head> và phần <body>
Phần <head>
Phần <body>
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5.0//EN" "http://www.w3.org/TR/html5/strict.dtd">
<!DOCTYPE HTML5>
<link rel="stylesheet" type="text/css" src="mystyle.css">
<stylesheet>mystyle.css</stylesheet>
<style src="mystyle.css">
<link rel="stylesheet" type="text/css" href="mystyle.css">
<list>
<ul>
<ol>
<dl>
<body bg="yellow">
<background>yellow</background>
<body style="background-color:yellow;">
Một <iframe> được sử dụng để hiển thị một trang web trong một trang web.
Không có thẻ <iframe>
Kết quả hiển thị của đoạn mã sau: <?php
$x = 5;
function myTest() {
echo “<p>Giá trị của biến x là: $x</p>";
$y=10;
}
myTest();
echo “Các giá trị của x, y là: $x và $y”;
?>
<script name=”xxx.js”>
<link href=”xxx.js”>
<script src=”xxx.js”>
<script href=”xxx.js”>
<form enctype="text/plain" action="index.php" method="post">
<form enctype="plain" action="index.php" method="post">
<form enctype="multipart/form-data" action="index.php" method="post">
<form enctype="application/upload-file" action="index.php" method="post">
Xem đoạn mã lệnh sau đây. Sau khi thực hiện đoạn mã trên kết quả hiển thị sẽ là gì? <?php
$str="It′s\"good\"";
echo strlen(addslashes($str));
?>
Xem đoạn mã lệnh sau đây. Sau khi thực hiện đoạn mã trên kết quả hiển thị sẽ là gì? <?php
$str='val1,val2,,val4,';
echo count(explode(',',$str));
?>
Xem đoạn mã lệnh sau đây. Sau khi thực hiện đoạn mã trên kết quả hiển thị sẽ là gì ? <?php
$a="hi,world";
$b = array_map("strtoupper", explode(",", $a));
foreach($b as $value) {
print "$value";
}
?>
Đoạn mã sau, in ra giá trị nào sau đây <?php
echo htmlentities("' OR '1' = '1");
?>
Đoạn mã sau, in ra giá trị nào sau đây <?php
echo htmlentities("<script>alert('Tấn công XSS!')</script>");
?>
<script>alert('Tấn công XSS!')</script>
<script>alert(“Tấn công XSS!”)</script>
\<script\>alert\(\'Tấn công XSS!\'\)\</script\>
Đoạn mã sau in ta giá trị nào sau đây <?php
$str = "<script>alert('Tấn công XSS!')</script>";
$newstr = filter_var($str, FILTER_SANITIZE_STRING);
echo $newstr;
?>
\<script\>alert\(\'Tấn công XSS!\'\)\</script\>
scriptalertTấn công XSS!script
<script>alert('Tấn công XSS!')</script>
Đoạn mã sau, in ra giá trị nào sau đây <?php
$str = "' OR '1' = '1";
$newstr = filter_var($str, FILTER_SANITIZE_STRING);
echo $newstr;
?>
Hãy cho biết đoạn mã lệnh dưới đây mô tả cách thức xác thực nào? <?php
if(!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate:Basic realm=“Nhập tên sử dụng và mật khẩu."');
header('HTTP/1.0 401 Unauthorized');
exit();
}
else if
(!isValid($_SERVER['PHP_AUTH_USER'],_SERVER['PHP_AUTH_PW„])) {
header('WWW-Authenticate:Basic realm="Tên sử dụng hoặc mật khẩu không đúng. Vui lòng nhập lại."');
header('HTTP/1.0 401 Unauthorized');
exit();
}
//Logic ứng dụng
…
?>
