Use this files to understand and debug the level, both files in same dir
index.php
`“<?php
$login = (isset($POST[‘login’]) ? $POST[‘login’] : ”);
$password = (isset($POST[‘password’]) ? $POST[‘password’] : ‘’);
?>
<!DOCTYPE html>
Intermediate 6
<?php
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$file = file_get_contents(“users.xml”);
$doc->loadXML($file);
$xpath = new DOMXPath($doc);
$query = "//user[login/text() = '" . $login . "' and password/text() = '" . $password . "']";
$users = $xpath->query($query);
foreach($users as $user) {
echo '<p><strong>Welcome '.$user->childNodes[2]->textContent.'!</strong></p>';
foreach($user->childNodes as $node) {
echo $node->nodeName." - ".$node->nodeValue."<br />";
}
}
echo '<hr /><kbd>'.htmlentities($query).'</kbd>';
?>
</body>
```
users.xml
<?xml version="1.0" encoding="utf-8"?>
<users>
<user>
<login>test</login>
<password>test</password>
<realname>test</realname>
</user>
<user>
<login>bolofecal</login>
<password>ILikePie</password>
<realname>Bolo Fecal</realname>
</user>
<user>
<login>sandramurphylogin</login>
<password>hardpassword</password>
<realname>Sandra Murphy</realname>
</user>
<user>
<login>user</login>
<password>pass</password>
<realname>name</realname>
</user>
</users>