71 lines
1.4 KiB
PHP
71 lines
1.4 KiB
PHP
<?php
|
|
|
|
use services\Search;
|
|
|
|
require_once 'services/Search.php';
|
|
$search = new Search();
|
|
$username = null;
|
|
$data = $_GET;
|
|
if (!empty($data['username'])) {
|
|
$username = $data['username'];
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
<html lang="it">
|
|
<head>
|
|
|
|
<title>Cerca</title>
|
|
<style>
|
|
body {
|
|
font-family: "FreeSans";
|
|
padding: 20px;
|
|
}
|
|
|
|
table {
|
|
border-spacing: 0;
|
|
}
|
|
|
|
th {
|
|
border: 1px solid black;
|
|
padding: 10px;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
<h1>Cerca </h1>
|
|
<?php
|
|
$formRicerca = "<form><label><input type=\"text\" placeholder=\"username\" name=\"username\"></label><button type=\"submit\">Cerca</button></form>";
|
|
|
|
if (empty($username)) {
|
|
echo $formRicerca;
|
|
} else {
|
|
$result = Search::searchByUsername($username);
|
|
if ($result->num_rows == 0) {
|
|
echo "Utente " . $username . " non trovato";
|
|
echo $formRicerca;
|
|
} else {
|
|
$data = $result->fetch_assoc();
|
|
echo "
|
|
<table>
|
|
<tr>
|
|
<th>" . $data["ID"] . "</th>" .
|
|
"<th>" . $data["NOME"] . "</th>" .
|
|
"<th>" . $data["COGNOME"] . "</th>" .
|
|
"<th>" . $data["DATA_NASCITA"] . "</th>" .
|
|
"<th>" . $data["LUOGO_NASCITA"] . "</th>" .
|
|
"<th>" . $data["CF"] . "</th>" .
|
|
"</tr>
|
|
</table>
|
|
";
|
|
}
|
|
|
|
}
|
|
?>
|
|
|
|
|
|
</body>
|
|
</html>
|