16 Commits

17 changed files with 661 additions and 76 deletions
+25
View File
@@ -0,0 +1,25 @@
services:
techstore:
image: andrestork/techstore:latest
ports:
- 8069:80
environment:
DB_HOST: db
DB_USERNAME: techstore
DB_PASSWORD: changeme
DB_DATABASE: TechStore
volumes:
- ./images:/var/www/html/img
restart: unless-stopped
depends_on:
- db
db:
image: mariadb
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: changemeplease
MARIADB_USER: techstore
MARIADB_PASSWORD: changeme
MARIADB_DATABASE: TechStore
volumes:
- ./db:/var/lib/mysql
+7 -2
View File
@@ -19,6 +19,11 @@ if ($result === false) {
<title>Il mio account - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
<script src="assets/js/cart.js"></script>
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -29,7 +34,7 @@ if ($result === false) {
<a href="logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <?php echo htmlspecialchars($_SESSION['name']); ?></span>
<?php else: ?>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
@@ -49,7 +54,7 @@ if ($result === false) {
<h1>Account di <?php echo htmlspecialchars($_SESSION['name']); ?><?php if ($_SESSION['role'] == 'admin') { echo ' (Admin)'; } ?></h1>
<p><strong>Nome completo:</strong> <?php echo htmlspecialchars($_SESSION['name']) . ' ' . htmlspecialchars($_SESSION['surname']); ?></p>
<br>
<a href="account/passwordChange.php" style="padding: 8px 16px; background-color: #17a2b8; color: white; border: none; border-radius: 4px; text-decoration: none; cursor: pointer;">Modifica password</a>
<a href="account/passwordChange.php" style="padding: 8px 16px; background-color: #117281; color: white; border: none; border-radius: 4px; text-decoration: none; cursor: pointer;">Modifica password</a>
<a href="account/delete.php" style="padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; text-decoration: none; cursor: pointer;">Elimina account</a>
<br><br>
</div>
+4 -3
View File
@@ -1,3 +1,7 @@
<?php
session_start();
include '../db_conf.php';
?>
<!DOCTYPE html>
<html lang="it">
<head>
@@ -8,9 +12,6 @@
</head>
<body>
<?php
session_start();
include '../db_conf.php';
if (!isset($_SESSION['id'])) {
header('Location: ../login.php');
exit();
+4 -3
View File
@@ -1,3 +1,7 @@
<?php
session_start();
include '../db_conf.php';
?>
<!DOCTYPE html>
<html lang="it">
<head>
@@ -8,9 +12,6 @@
</head>
<body>
<?php
session_start();
include '../db_conf.php';
if (!isset($_SESSION['id'])) {
header('Location: ../login.php');
exit();
+6 -1
View File
@@ -58,6 +58,11 @@ if ($result_total_products) {
<title>Dashboard amministratore - TechStore</title>
<link rel="stylesheet" href="/assets/style.css">
<script src="/assets/js/cart.js"></script>
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -68,7 +73,7 @@ if ($result_total_products) {
<a href="/logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <?php echo htmlspecialchars($_SESSION['name']); ?></span>
<?php else: ?>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
+1 -1
View File
@@ -88,7 +88,7 @@ if ($result === false) {
<a href="/logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <?php echo htmlspecialchars($_SESSION['name']); ?></span>
<?php else: ?>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
+1 -1
View File
@@ -147,7 +147,7 @@ $stmt_prod->close();
<a href="/logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <?php echo htmlspecialchars($_SESSION['name']); ?></span>
<?php else: ?>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
+1 -1
View File
@@ -93,7 +93,7 @@ if ($result === false) {
<a href="/logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <?php echo htmlspecialchars($_SESSION['name']); ?></span>
<?php else: ?>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="/login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
+517 -8
View File
@@ -1,5 +1,150 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 16px;
}
body {
font-family: Arial, Helvetica, sans-serif;
line-height: 1.6;
}
/* Header responsive */
header {
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
padding: 10px !important;
background-color: #f2f2f2 !important;
border-bottom: 1px solid #ddd !important;
flex-wrap: wrap;
gap: 10px;
}
header #logo {
flex: 0 0 auto;
display: flex;
align-items: center;
}
header #logo img {
height: 32px;
width: auto;
}
header > div:last-child {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
justify-content: flex-end;
}
header button, header a button {
padding: 8px 12px;
font-size: 14px;
white-space: nowrap;
}
header span {
font-size: 14px;
}
@media (max-width: 768px) {
header {
flex-direction: row;
align-items: center !important;
justify-content: space-between !important;
padding: 8px !important;
gap: 5px;
}
header #logo {
margin-bottom: 0;
flex-shrink: 0;
}
header > div:last-child {
display: flex;
flex-wrap: nowrap;
gap: 3px;
align-items: center;
justify-content: flex-end;
flex: 1;
}
header button, header a button {
padding: 6px 8px;
font-size: 11px;
flex: 0 1 auto;
white-space: nowrap;
}
header span {
font-size: 11px;
white-space: nowrap;
display: none;
}
}
@media (max-width: 480px) {
header {
padding: 6px !important;
gap: 3px;
}
header #logo img {
height: 28px;
}
header button, header a button {
padding: 5px 6px;
font-size: 10px;
margin-right: 2px !important;
}
header span {
font-size: 10px;
display: none;
}
.admin-table {
font-size: 10px;
display: block;
overflow-x: auto;
white-space: nowrap;
}
.admin-table th, .admin-table td {
padding: 5px;
min-width: 60px;
}
.product-table {
font-size: 10px;
display: block;
overflow-x: auto;
}
.product-table th, .product-table td {
padding: 5px;
min-width: 70px;
}
.cart-table {
font-size: 10px;
display: block;
overflow-x: auto;
}
.cart-table th, .cart-table td {
padding: 5px;
min-width: 60px;
}
}
.products-grid {
display: grid;
@@ -7,6 +152,22 @@ body{
gap: 20px;
padding: 20px;
}
@media (max-width: 768px) {
.products-grid {
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 15px;
padding: 15px;
}
}
@media (max-width: 480px) {
.products-grid {
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 10px;
padding: 10px;
}
}
.product-card {
border: 1px solid #ddd;
border-radius: 8px;
@@ -29,7 +190,7 @@ body{
}
.product-card button {
padding: 8px 16px;
background-color: #007bff;
background-color: #1c71d8;
color: white;
border: none;
border-radius: 4px;
@@ -199,7 +360,7 @@ form button:hover {
}
.checkout-btn {
padding: 10px 20px;
background-color: #28a745;
background-color: #1d8033;
color: white;
border: none;
border-radius: 4px;
@@ -240,7 +401,7 @@ form button:hover {
}
.my-sidebar a {
color: #007bff;
color: #1c71d8;
text-decoration: none;
}
@@ -311,7 +472,7 @@ form button:hover {
.toggle-button {
padding: 10px 16px;
background-color: #17a2b8;
background-color: #117281;
color: #fff;
border: none;
border-radius: 4px;
@@ -356,7 +517,7 @@ form button:hover {
height: 32px;
border: none;
border-radius: 4px;
background-color: #007bff;
background-color: #1c71d8;
color: #fff;
cursor: pointer;
}
@@ -433,7 +594,7 @@ form button:hover {
}
.admin-stat-products {
border-color: #17a2b8;
border-color: #117281;
background-color: #e9f7fb;
}
@@ -488,7 +649,7 @@ form button:hover {
}
.status-completed {
background-color: #28a745;
background-color: #1d8033;
color: white;
}
@@ -587,7 +748,7 @@ form button:hover {
/* Stili per btn-reset */
.btn-reset {
background-color: #17a2b8;
background-color: #117281;
color: white;
border: none;
border-radius: 4px;
@@ -599,3 +760,351 @@ form button:hover {
.btn-reset:hover {
background-color: #138496;
}
/* ============================================
MEDIA QUERIES RESPONSIVE - Tablet
============================================ */
@media (max-width: 768px) {
.products-grid {
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 15px;
padding: 15px;
}
.product-card {
padding: 12px;
}
.product-card h3 {
font-size: 16px;
}
.product-card button {
padding: 6px 12px;
font-size: 13px;
width: 100%;
}
.cart-table {
font-size: 12px;
}
.cart-table th, .cart-table td {
padding: 8px;
}
.cart-table button {
padding: 4px 8px;
font-size: 11px;
}
.product-table {
font-size: 12px;
}
.product-table th, .product-table td {
padding: 8px;
}
.cart-container {
padding: 15px;
margin: 15px auto;
}
form {
padding: 15px;
margin: 30px auto;
width: 95%;
}
form h2 {
font-size: 20px;
margin-bottom: 15px;
}
.admin-stats-grid {
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.admin-stat-card h2 {
font-size: 28px;
}
.admin-table {
font-size: 12px;
}
.admin-table th, .admin-table td {
padding: 8px;
}
.order-card {
padding: 15px;
}
.order-header {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
}
/* ============================================
MEDIA QUERIES RESPONSIVE - Mobile
============================================ */
@media (max-width: 480px) {
html {
font-size: 14px;
}
.products-grid {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 10px;
padding: 10px;
}
.product-card {
padding: 10px;
}
.product-card h3 {
font-size: 14px;
margin: 8px 0;
}
.product-card p {
font-size: 12px;
}
.product-card button {
padding: 6px 10px;
font-size: 12px;
width: 100%;
}
.cart-table {
font-size: 11px;
}
.cart-table th, .cart-table td {
padding: 6px;
word-break: break-word;
}
.cart-table button {
padding: 3px 6px;
font-size: 10px;
width: 100%;
}
.product-table {
font-size: 11px;
}
.product-table th, .product-table td {
padding: 6px;
word-break: break-word;
}
.cart-container {
max-width: 100%;
padding: 10px;
margin: 10px auto;
}
.cart-container h1 {
font-size: 18px;
}
.clear-cart-btn, .checkout-btn {
padding: 8px 12px;
font-size: 12px;
margin-left: 0;
margin-right: 5px;
width: 48%;
display: inline-block;
}
.cart-summary {
font-size: 14px;
}
form {
max-width: 95%;
margin: 20px auto;
padding: 12px;
width: 95%;
}
form h2 {
font-size: 18px;
margin-bottom: 12px;
}
form label {
font-size: 13px;
margin-bottom: 4px;
}
form input[type=\"text\"],
form input[type=\"password\"],
form input[type=\"email\"],
form button {
font-size: 14px;
padding: 8px;
margin-bottom: 10px;
}
.product-detail {
max-width: 95%;
margin: 10px auto;
padding: 12px;
}
.product-detail h2 {
font-size: 16px;
margin-bottom: 10px;
}
.add-product-panel {
padding: 12px;
margin-bottom: 15px;
}
.add-product-panel h2 {
font-size: 16px;
margin-bottom: 12px;
}
.admin-stats-grid {
grid-template-columns: 1fr;
gap: 12px;
}
.admin-stat-card {
padding: 15px;
}
.admin-stat-card h2 {
font-size: 28px;
margin-bottom: 8px;
}
.admin-stat-card p {
font-size: 12px;
}
.admin-table {
font-size: 11px;
}
.admin-table th, .admin-table td {
padding: 6px;
word-break: break-word;
}
.btn-delete, .btn-reset {
padding: 4px 8px;
font-size: 10px;
}
.order-card {
padding: 12px;
}
.order-header {
flex-direction: column;
align-items: flex-start;
gap: 8px;
margin-bottom: 10px;
}
.order-header h3 {
font-size: 14px;
}
.order-status {
padding: 4px 8px;
font-size: 10px;
}
.order-details p {
font-size: 12px;
margin: 3px 0;
}
.account-layout {
gap: 15px;
margin: 15px auto;
padding: 0 10px;
}
.my-sidebar, .my-container {
flex: 1 1 100%;
padding: 15px;
}
.my-container h1 {
font-size: 16px;
margin-bottom: 10px;
}
.my-container p {
font-size: 12px;
margin-bottom: 8px;
}
.empty-cart {
padding: 25px;
font-size: 14px;
}
}
/* Header buttons styling */
header a button,
header button {
margin-left: 0 !important;
margin-right: 5px !important;
padding: 8px 12px !important;
background-color: #1c71d8 !important;
color: white !important;
border: none !important;
border-radius: 4px !important;
cursor: pointer !important;
transition: background-color 0.3s ease;
}
header a[href*="logout"] button,
header a:has(button[style*="#dc3545"]) button {
background-color: #dc3545 !important;
}
header a[href*="login"] button,
header a:has(button[style*="#1d8033"]) button {
background-color: #1d8033 !important;
}
header button:hover {
opacity: 0.9;
}
/* Responsive nav adjustments */
@media (max-width: 768px) {
header a button,
header button {
margin-right: 3px !important;
padding: 6px 10px !important;
font-size: 12px !important;
}
}
@media (max-width: 480px) {
header a button,
header button {
margin-right: 3px !important;
padding: 6px 8px !important;
font-size: 11px !important;
}
}
+6 -1
View File
@@ -10,6 +10,11 @@ session_start();
<title>Carrello - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
<script src="assets/js/cart.js"></script>
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -20,7 +25,7 @@ session_start();
<a href="logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <a href="account.php"><?php echo htmlspecialchars($_SESSION['name']); ?></a></span>
<?php else: ?>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
+9 -4
View File
@@ -119,6 +119,11 @@ $conn->close();
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $success ? 'Ordine confermato' : 'Errore ordine'; ?> - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -129,22 +134,22 @@ $conn->close();
<a href="logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <a href="account.php"><?php echo htmlspecialchars($_SESSION['name']); ?></a></span>
<?php else: ?>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
<div style="max-width: 600px; margin: 50px auto; padding: 20px; text-align: center; border: 1px solid #ddd; border-radius: 8px; background-color: #fff;">
<?php if ($success): ?>
<h1 style="color: #28a745;">Ordine confermato!</h1>
<h1 style="color: #1d8033;">Ordine confermato!</h1>
<p>Il tuo ordine è stato elaborato con successo.</p>
<p><strong>Numero ordine:</strong> #<?php echo $order_id; ?></p>
<p><strong>Totale:</strong> €<?php echo number_format($order_total, 2, ',', '.'); ?></p>
<a href="index.php"><button style="padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; margin-top: 20px;">Torna alla home</button></a>
<a href="index.php"><button style="padding: 10px 20px; background-color: #1c71d8; color: white; border: none; border-radius: 4px; cursor: pointer; margin-top: 20px;">Torna alla home</button></a>
<?php else: ?>
<h1 style="color: #dc3545;">Errore nell'ordine</h1>
<p><?php echo htmlspecialchars($error); ?></p>
<a href="cart.php"><button style="padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; margin-top: 20px;">Torna al carrello</button></a>
<a href="cart.php"><button style="padding: 10px 20px; background-color: #1c71d8; color: white; border: none; border-radius: 4px; cursor: pointer; margin-top: 20px;">Torna al carrello</button></a>
<?php endif; ?>
</div>
</body>
+6 -5
View File
@@ -5,12 +5,13 @@ $username = getenv("DB_USERNAME") ?:'techstore';
$password = getenv("DB_PASSWORD") ?: 'dioporco';
$database = getenv("DB_DATABASE") ?: 'TechStore';
// Creazione connessione
// Creazione e gestione eccezioni connessione
try{
$conn = mysqli_connect($host, $username, $password, $database);
// Controllo connessione
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
catch(Exception $e) {
error_log("Errore connessione database: " . $e->getMessage());
die("Errore di connessione al database. Riprova più tardi.");
}
// Opzionale: impostare charset
+7 -2
View File
@@ -19,6 +19,11 @@ if ($result === false) {
<title>TechStore - Prodotti</title>
<link rel="stylesheet" href="assets/style.css">
<script src="assets/js/cart.js"></script>
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -29,7 +34,7 @@ if ($result === false) {
<a href="logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <a href="account.php"><?php echo htmlspecialchars($_SESSION['name']); ?></a></span>
<?php else: ?>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
@@ -38,7 +43,7 @@ if ($result === false) {
<div class="products-grid">
<?php while ($row = $result->fetch_assoc()): ?>
<div class="product-card">
<a href="product.php?id=<?php echo $row['ProductID']; ?>"><div class="img-square"><img src="img/<?php echo htmlspecialchars($row['ImagePath']); ?>" alt="Immagine prodotto"></div></a>
<a href="product.php?id=<?php echo $row['ProductID']; ?>"><div class="img-square"><img src="img/<?php echo htmlspecialchars($row['ImagePath']); ?>" alt="Immagine di <?php echo htmlspecialchars($row['ProductName']); ?>"></div></a>
<h3><?php echo "<a href='product.php?id=" . $row['ProductID'] . "'>" . htmlspecialchars($row['ProductName']) . "</a>"; ?></h3>
<p><?php echo htmlspecialchars($row['Price']); ?>€</p>
<?php if ($row['StockQuantity'] > 0): ?>
+17 -9
View File
@@ -1,12 +1,3 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<?php
session_start();
include 'db_conf.php';
@@ -46,7 +37,24 @@
$error = 'Errore nel database.';
}
}
$conn->close();
?>
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<form action="" method="POST">
<h2>Login</h2>
<label for="email">Indirizzo e-mail:</label>
+6 -1
View File
@@ -35,6 +35,11 @@ if (!$result) {
<title>Il mio account - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
<script src="assets/js/cart.js"></script>
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -45,7 +50,7 @@ if (!$result) {
<a href="logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <?php echo htmlspecialchars($_SESSION['name']); ?></span>
<?php else: ?>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
+7 -2
View File
@@ -30,6 +30,11 @@ if ($stmt = $conn->prepare($sql)) {
<?php endif; ?>
<link rel="stylesheet" href="assets/style.css">
<script src="assets/js/cart.js"></script>
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<header style="display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f2f2f2; border-bottom: 1px solid #ddd;">
@@ -40,7 +45,7 @@ if ($stmt = $conn->prepare($sql)) {
<a href="logout.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">Logout</button></a>
<span style="margin-left: 10px;">Benvenuto, <a href="account.php"><?php echo htmlspecialchars($_SESSION['name']); ?></a></span>
<?php else: ?>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<a href="login.php"><button style="margin-left: 10px; padding: 8px 16px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Accesso</button></a>
<?php endif; ?>
</div>
</header>
@@ -55,7 +60,7 @@ if ($stmt = $conn->prepare($sql)) {
<p><strong>Prezzo:</strong> €<?php echo htmlspecialchars($product['Price']); ?></p>
<p><strong>Quantità disponibile:</strong> <?php echo htmlspecialchars($product['StockQuantity']); ?></p>
<?php if ($product['StockQuantity'] > 0): ?>
<button onclick="addToCart(<?php echo $product['ProductID']; ?>, '<?php echo htmlspecialchars($product['ProductName']); ?>', <?php echo $product['Price']; ?>)" style="padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">Aggiungi al carrello</button>
<button onclick="addToCart(<?php echo $product['ProductID']; ?>, '<?php echo htmlspecialchars($product['ProductName']); ?>', <?php echo $product['Price']; ?>)" style="padding: 10px 20px; background-color: #1d8033; color: white; border: none; border-radius: 4px; cursor: pointer;">Aggiungi al carrello</button>
<?php else: ?>
<button disabled style="padding: 10px 20px; background-color: #ccc; color: white; border: none; border-radius: 4px; cursor: not-allowed;">Esaurito</button>
<?php endif; ?>
+5
View File
@@ -9,6 +9,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registrazione - TechStore</title>
<link rel="stylesheet" href="assets/style.css">
<?php
if(getenv('ITSTRACKER_KEY')){
echo "<script src=\"https://projectits.altervista.org/tracker.js?key=" . getenv('ITSTRACKER_KEY') . "\"></script>";
}
?>
</head>
<body>
<?php