Vulnerable-Web-Application/XSS/XSS_level4.php

31 lines
841 B
PHP
Raw Normal View History

2018-11-29 19:53:51 +00:00
<!DOCTYPE html>
<html>
<head>
<title>XSS 4</title>
</head>
<body>
2018-11-29 23:45:00 +00:00
<div style="background-color:#c9c9c9;padding:15px;">
<button type="button" name="homeButton" onclick="location.href='../homepage.html';">Home Page</button>
2018-11-29 23:45:25 +00:00
<button type="button" name="mainButton" onclick="location.href='xssmainpage.html';">Main Page</button>
2018-11-29 23:45:00 +00:00
</div>
<div align="center">
2018-11-29 19:53:51 +00:00
<form method="GET" action="" name="form">
<p>Your name:<input type="text" name="username"></p>
2018-11-29 23:34:23 +00:00
<input type="submit" name="submit" value="Submit">
2018-11-29 19:53:51 +00:00
</form>
2018-11-29 23:45:00 +00:00
</div>
2018-11-29 19:53:51 +00:00
<?php
if (isset($_GET["username"])) {
$values = array("script", "prompt", "alert", "h1");
$user = str_replace($values, " ",$_GET["username"]);
2018-12-08 22:57:34 +00:00
$user = preg_replace("/<(.*)[S,s](.*)[C,c](.*)[R,r](.*)[I,i](.*)[P,p](.*)[T,t]>/i", "", $_GET["username"]);
2018-11-29 19:53:51 +00:00
echo "$user";
}
?>
</body>
</html>