47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
class User{
|
|
public $id;
|
|
public $name;
|
|
public $email;
|
|
|
|
function __construct($id, $name, $email){
|
|
$this->id = $id;
|
|
$this->name = $name;
|
|
$this->email = $email;
|
|
}
|
|
}
|
|
$file = fopen("data/clienti.csv", "r") or die("Non riesco a leggere il file, controlla che esista brutto rimbambito");
|
|
$utenti = [];
|
|
|
|
fgets($file);
|
|
while (($linea = fgets($file)) !== false) {
|
|
$campi = explode(",", $linea);
|
|
array_push($utenti, new User($campi[0], $campi[1], $campi[2]));
|
|
}
|
|
fclose($file);
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>TechStore</title>
|
|
</head>
|
|
<body>
|
|
<table>
|
|
<tr>
|
|
<th>ID Utente</th>
|
|
<th>Nominativo</th>
|
|
<th>Email</th>
|
|
<th>Link del cazzo</th>
|
|
</tr>
|
|
<?php
|
|
for($i=0; $i<count($utenti); $i++){
|
|
echo "<tr><td>" . $utenti[$i]->id . "</td><td>" . $utenti[$i]->name . "</td><td><a href=\"mailto:" . $utenti[$i]->email ."\">" . $utenti[$i]->email . "</a></td></tr>";
|
|
}
|
|
?>
|
|
|
|
</table>
|
|
</body>
|
|
</html>
|