metasploitable3/chef/cookbooks/metasploitable/files/payroll_app/payroll_app.php

65 lines
1.7 KiB
PHP
Raw Normal View History

<?php
$conn = new mysqli('127.0.0.1', 'root', 'sploitme', 'payroll');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
2017-04-18 23:00:38 +02:00
<?php
if (!isset($_POST['s'])) {
?>
<center>
<form action="" method="post">
2017-04-18 23:00:38 +02:00
<h2>Payroll Login</h2>
<table style="border-radius: 25px; border: 2px solid black; padding: 20px;">
<tr>
<td>User</td>
<td><input type="text" name="user"></td>
</tr>
<tr>
2017-04-18 23:00:38 +02:00
<td>Password</td>
2017-04-18 23:02:52 +02:00
<td><input type="password" name="password"></td>
</tr>
2017-04-18 23:00:38 +02:00
<tr>
<td><input type="submit" value="OK" name="s">
</tr>
</table>
</form>
2017-04-18 23:00:38 +02:00
</center>
<?php
}
?>
<?php
if($_POST['s']){
$user = $_POST['user'];
$pass = $_POST['password'];
$sql = "select username, first_name, last_name, salary from users where username = '$user' and password = '$pass'";
if ($conn->multi_query($sql)) {
do {
/* store first result set */
2017-04-18 23:00:38 +02:00
echo "<center>";
echo "<h2>Welcome, " . $user . "</h2><br>";
echo "<table style='border-radius: 25px; border: 2px solid black;' cellspacing=30>";
echo "<tr><th>Username</th><th>First Name</th><th>Last Name</th><th>Salary</th></tr>";
if ($result = $conn->store_result()) {
while ($row = $result->fetch_assoc()) {
$keys = array_keys($row);
echo "<tr>";
foreach ($keys as $key) {
echo "<td>" . $row[$key] . "</td>";
}
2017-04-11 23:12:46 +02:00
echo "</tr>\n";
}
$result->free();
}
if (!$conn->more_results()) {
2017-04-18 23:00:38 +02:00
echo "</table></center>";
}
} while ($conn->next_result());
}
}
?>