generated from francesco/deploy-dinamico
Aggiunte pagine "actors" e "genres"
All checks were successful
Deploy / trigger (push) Successful in 2s
All checks were successful
Deploy / trigger (push) Successful in 2s
This commit is contained in:
99
file/actors/index.php
Normal file
99
file/actors/index.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
if (isset($_GET['s'])) {
|
||||
highlight_file("index.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// Tutti gli attori
|
||||
|
||||
// Questi valori vengono letti automaticamente
|
||||
$host = getenv('DB_HOST'); // Sarà "local_db"
|
||||
$db = getenv('DB_NAME'); // Sarà "nomerepository-nomeutente"
|
||||
$user = getenv('DB_USER'); // Uguale al nome DB
|
||||
$pass = getenv('DB_PASS'); // Password generata casualmente ad ogni deploy
|
||||
$charset = 'utf8mb4';
|
||||
|
||||
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
|
||||
|
||||
try {
|
||||
$pdo = new PDO($dsn, $user, $pass);
|
||||
} catch (\PDOException $e) {
|
||||
throw new \PDOException($e->getMessage(), (int) $e->getCode());
|
||||
}
|
||||
|
||||
// Collegamento al DB effettuato
|
||||
|
||||
$query = "SELECT * FROM attori";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->execute();
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Attori - The NoSpace Cinema</title>
|
||||
<!--- www.francescomancuso.it -->
|
||||
<link rel="stylesheet" href="../style.css">
|
||||
<link rel="icon" href="../favicon.png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<div class="container">
|
||||
<a href="../" style="text-decoration: none;">
|
||||
<div>
|
||||
<img src="../logo.png">
|
||||
<h4>The NoSpace Cinema</h4>
|
||||
</div>
|
||||
</a>
|
||||
<div>
|
||||
<a href=".?s" style="font-size:16px">Vedi sorgente pagina</a>
|
||||
<a href="../search/" class="button">Tutti i film</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="container">
|
||||
<div class="hero">
|
||||
<div>
|
||||
<h1>Tutti gli attori</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<div class="container">
|
||||
<div class="grid films">
|
||||
<?php
|
||||
$test = true;
|
||||
while ($row = $stmt->fetch()) {
|
||||
$test = false;
|
||||
?>
|
||||
<div class="attore">
|
||||
<img src="../attore-list.png">
|
||||
<h5><?php echo $row['nome']; ?> <?php echo $row['cognome']; ?></h5>
|
||||
<span>Nato/a il <?php echo date("d M Y", strtotime($row['data_nascita'])); ?></span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
// Nessun risultato...
|
||||
if ($test) {
|
||||
echo "<div class=\"container\">Nessun attore trovato!</div>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<div class="container">
|
||||
<span>Realizzato da Francesco Giuseppe Mancuso - classe 5E - www.francescomancuso.it</span>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user