-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shop, index page, login pages, registration forms, all dashboards.
- Loading branch information
Showing
39 changed files
with
3,579 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<style> | ||
hr.new | ||
{ | ||
border: 3px solid blueviolet; | ||
} | ||
</style> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>CANNABIS</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous"> | ||
<center> | ||
<img style="margin-top: 20px;" src="img/joint (1).png"><br><br> | ||
<hr class="new" style="color: blueviolet; width: 80%;"> | ||
</head> | ||
<body style="background-color: #000000e0;"> | ||
<form method="POST" action=" <?php $_SERVER["PHP_SELF"]; ?> "> | ||
<div class="row row-cols-1 row-cols-md-3 g-4"> | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
// Query per recuperare i dati dei prodotti dalla tabella 'product' | ||
$query = "SELECT * FROM products WHERE id=1;"; | ||
|
||
// Esecuzione della query | ||
$result = mysqli_query($connection, $query); | ||
|
||
// Recupero dei dati e creazione dei card per ogni prodotto | ||
while ($row = mysqli_fetch_assoc($result)) | ||
{ | ||
echo ' | ||
<div class="col" style="margin-left:190px; margin-top: 30px;"> | ||
<div class="card h-100" style="width: 30rem; margin-top: 30px; background-color:#000000e0; border-color: blueviolet;"> | ||
<img src="img/amnesia.png" class="card-img-top" alt="..."> | ||
<div class="card-body"> | ||
<center> | ||
<h5 class="card-title" style="color: aliceblue;">' . $row['ProductName'] . '</h5> | ||
<form method="post" action = "{$_SERVER["PHP_SELF"]}"> | ||
<input class="btn btn-primary" type="number" style="background-color: blueviolet; border-color: blueviolet;" name="quantity"> | ||
<input type="hidden" name="productname" value="' . $row['ProductName'] . '"> | ||
<input type="hidden" name="ID" value="' . $row['ID'] . '"> | ||
<input type="hidden" name="ShopID" value="' . $row['ShopID'] . '"> | ||
<input type="hidden" name="price" value="' . $row['Price'] . '"> | ||
<input class="btn btn-primary" type="submit" style="background-color: blueviolet; border-color: blueviolet;" value="Aggiungi al carrello" name="add"> | ||
</form> | ||
</center> | ||
</div> | ||
</div> | ||
</div> | ||
'; | ||
} | ||
|
||
mysqli_close($connection); | ||
?> | ||
</div> | ||
<br><br><br><a href="index.html" style="color: blueviolet; font-family: monospace; font-size: 20px;">PAGINA INIZIALE</a> | ||
<a href="cart.php" style="color: blueviolet; font-family: monospace; font-size: 20px;">CARRELLO</a> | ||
</center> | ||
</form> | ||
</body> | ||
</html> | ||
<!-- Pagina di gestione del carrello (gestione_carrello.php) --> | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
// Verifica se è stato inviato un comando di aggiunta al carrello | ||
if (isset($_POST['add']) ) { | ||
// Recupera i dati del prodotto dal form | ||
|
||
/*+-------------+--------------+------+-----+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+-------------+--------------+------+-----+---------+-------+ | ||
| price | float | NO | | NULL | | | ||
| quantity | int(11) | NO | | NULL | | | ||
| productname | varchar(255) | NO | | NULL | | | ||
| ProductID | int(11) | YES | | NULL | | | ||
| ShopID | int(11) | YES | | NULL | | | ||
| CustomerID | int(11) | YES | | NULL | | | ||
+-------------+--------------+------+-----+---------+-------+ */ | ||
|
||
$productname = $_POST['productname']; | ||
$price = $_POST['price']; | ||
$quantity=$_POST['quantity']; | ||
$ShopID=$_POST['ShopID']; | ||
$ProductID=$_POST['ID']; | ||
|
||
// Inserisci i dati del prodotto nella tabella "cart" | ||
$query = "INSERT INTO cart (productname, price, quantity,ProductID,ShopID) VALUES ('$productname', $price, $quantity,$ProductID,$ShopID);"; | ||
mysqli_query($connection, $query); | ||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Carrello</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous"> | ||
</head> | ||
<body style="background-color: #000000e0;"> | ||
<div class="container"> | ||
<center><h1 style="color: blueviolet;">Carrello</h1><center> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th style="color: blueviolet;">Prodotto</th> | ||
<th style="color: blueviolet;">Prezzo</th> | ||
<th style="color: blueviolet;">Quantità</th> | ||
<th style="color: blueviolet;">Totale</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<form method="POST" action=<?php echo htmlspecialchars($_SERVER['PHP_SELF'])?>> | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
// Query per recuperare i dati dal database | ||
$sql = "SELECT * FROM cart"; | ||
$result = mysqli_query($connection, $sql); | ||
|
||
// Ciclo per visualizzare i dati recuperati | ||
while ($row = mysqli_fetch_assoc($result)) { | ||
$nome_prodotto = $row['productname']; | ||
$prezzo = $row['price']; | ||
$quantita = $row['quantity']; | ||
$totale = $prezzo * $quantita; | ||
|
||
echo "<tr>"; | ||
echo "<td style=\"color: aliceblue;\">$nome_prodotto</td>"; | ||
echo "<td style=\"color: aliceblue;\">$prezzo</td>"; | ||
echo "<td style=\"color: aliceblue;\">$quantita</td>"; | ||
echo "<td style=\"color: aliceblue;\">$totale</td>"; | ||
echo "</tr>"; | ||
} | ||
|
||
// Chiusura della connessione al database | ||
mysqli_close($connection); | ||
?> | ||
</tbody> | ||
</table> | ||
<div class="d-grid gap-2"> | ||
<input type="submit" class="btn btn-primary" style="background-color: blueviolet; border-color: blueviolet;" name="svuota" value="Svuota il carrello"> | ||
<input type="submit" class="btn btn-primary" style="background-color: blueviolet; border-color: blueviolet;" name="compra" value="Acquista"> | ||
|
||
<a href="index.html" class="btn btn-secondary" style="background-color: #000000e0;border-color: #000000e0;">Continua lo shopping</a> | ||
</div> | ||
</div> | ||
|
||
</form> | ||
</body> | ||
</html> | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
if (isset($_POST["svuota"])) { | ||
// Query per cancellare tutti i prodotti dal carrello | ||
$query = "DELETE FROM cart;"; | ||
|
||
// Esecuzione della query | ||
mysqli_query($connection, $query); | ||
header("Refresh:0"); | ||
|
||
} | ||
|
||
if(isset($_POST['compra'])) | ||
{ | ||
if(isset($_SESSION['id'])) | ||
{ | ||
//se l'utente è loggato, per ogni prodotto nel carrello inserisci una riga nella tabella "orders" | ||
/*create table orders( | ||
ID INT PRIMARY KEY AUTO_INCREMENT, | ||
CustomerID INT REFERENCES customers(ID) ON DELETE CASCADE ON UPDATE CASCADE, | ||
ProductID INT REFERENCES products(ID) ON DELETE CASCADE ON UPDATE CASCADE, | ||
Quantity INT NOT NULL, | ||
Data DATE, | ||
Address varchar(50), | ||
ShopID INT REFERENCES shop(ID) ON DELETE CASCADE ON UPDATE CASCADE); | ||
Tabella "Cart" | ||
*+-------------+--------------+------+-----+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+-------------+--------------+------+-----+---------+-------+ | ||
| price | float | NO | | NULL | | | ||
| quantity | int(11) | NO | | NULL | | | ||
| productname | varchar(255) | NO | | NULL | | | ||
| ProductID | int(11) | YES | | NULL | | | ||
| ShopID | int(11) | YES | | NULL | | | ||
+-------------+--------------+------+-----+---------+-------+ */ | ||
|
||
$sql = "SELECT * FROM cart"; | ||
$result = mysqli_query($connection, $sql); | ||
|
||
// Ciclo per ogni prodotto nel carrello | ||
while($row = mysqli_fetch_assoc($result)) { | ||
$ProductId = $row['ProductID']; | ||
$CustomerId = mysqli_fetch_array($connection->query("SELECT ID FROM customers WHERE email='{$_SESSION['email']}'"))['ID']; | ||
$Quantity = $row['quantity']; | ||
$Data = date('Y-m-d'); | ||
$shop_id = $row['ShopID']; | ||
$Address = $_SESSION['address']; | ||
|
||
echo $CustomerId; | ||
|
||
// Inserire il prodotto nella tabella ordini | ||
$sql2 = "INSERT INTO orders (CustomerID,ProductID,Quantity,Data,Address,ShopID) | ||
VALUES ('$CustomerId','$ProductId', '$Quantity', '$Data', '$Address','$shop_id')"; | ||
|
||
mysqli_query($connection, $sql2); | ||
} | ||
|
||
// Svuotare il carrello dell'utente loggato | ||
$sql3 = "DELETE FROM cart"; | ||
mysqli_query($connection, $sql3); | ||
//OCCHIO CHE CustomerID è una foreign key, se sei loggato ho già fatto io la creazione del cliente, quindi fai una query in cui cerchi l'id del cliente tramite la mail che sta in £_SESSION['email], poi l'id lo metti come foreign key. | ||
//capito niente della riga 111 zio pera | ||
//SELECT id FROM customers WHERE email=$_SESSION['email'] | ||
} | ||
else | ||
{ | ||
echo "<br><br><div class='alert alert-warning email_alert'> | ||
Non sei loggato come utente!. | ||
</div><center> | ||
<a href=\"./login.php\" style=\"color: blueviolet; font-family: monospace; font-size: 20px; margin-left: -40px;\">LOGIN</a> | ||
</center>";} | ||
} | ||
?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
if (isset($_POST["svuota"])) { | ||
// Query per cancellare tutti i prodotti dal carrello | ||
$query = "DELETE FROM cart;"; | ||
|
||
// Esecuzione della query | ||
mysqli_query($connection, $query); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<style> | ||
hr.new | ||
{ | ||
border: 3px solid blueviolet; | ||
} | ||
</style> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>COCAINE</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous"> | ||
<center> | ||
<img style="margin-top: 20px;" src="img/cocaine (1).png"><br><br> | ||
<hr class="new" style="color: blueviolet; width: 80%;"> | ||
</center> | ||
</head> | ||
<body style="background-color: #000000e0;"> | ||
<form method="POST" action=" <?php $_SERVER["PHP_SELF"]; ?> "> | ||
<div class="row row-cols-1 row-cols-md-3 g-4"> | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
// Query per recuperare i dati dei prodotti dalla tabella 'product' | ||
$query = "SELECT * FROM products WHERE id=4;"; | ||
|
||
// Esecuzione della query | ||
$result = mysqli_query($connection, $query); | ||
|
||
// Recupero dei dati e creazione dei card per ogni prodotto | ||
while ($row = mysqli_fetch_assoc($result)) | ||
{ | ||
echo ' | ||
<div class="col" style="margin-left:190px; margin-top: 30px;"> | ||
<div class="card h-100" style="width: 30rem; margin-top: 30px; background-color:#000000e0; border-color: blueviolet;"> | ||
<img src="img/ECUADOR.jpg" class="card-img-top" alt="..."> | ||
<div class="card-body"> | ||
<center> | ||
<h5 class="card-title" style="color: aliceblue;">' . $row['ProductName'] . '</h5> | ||
<form method="post" action = "{$_SERVER["PHP_SELF"]}"> | ||
<input class="btn btn-primary" type="number" style="background-color: blueviolet; border-color: blueviolet;" name="quantity"> | ||
<input type="hidden" name="productname" value="' . $row['ProductName'] . '"> | ||
<input type="hidden" name="ID" value="' . $row['ID'] . '"> | ||
<input type="hidden" name="ShopID" value="' . $row['ShopID'] . '"> | ||
<input type="hidden" name="price" value="' . $row['Price'] . '"> | ||
<input class="btn btn-primary" type="submit" style="background-color: blueviolet; border-color: blueviolet;" value="Aggiungi al carrello" name="add"> | ||
</form> | ||
</center> | ||
</div> | ||
</div> | ||
</div> | ||
'; | ||
} | ||
mysqli_close($connection); | ||
?> | ||
</div> | ||
<center> | ||
<br><br><br><a href="index.html" style="color: blueviolet; font-family: monospace; font-size: 20px;">PAGINA INIZIALE</a> | ||
<a href="cart.php" style="color: blueviolet; font-family: monospace; font-size: 20px;">CARRELLO</a> | ||
</center> | ||
</form> | ||
</body> | ||
</html> | ||
<?php | ||
// Connessione al database | ||
include('config/db.php'); | ||
|
||
// Verifica se è stato inviato un comando di aggiunta al carrello | ||
if (isset($_POST['add']) ) { | ||
// Recupera i dati del prodotto dal form | ||
|
||
/*+-------------+--------------+------+-----+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+-------------+--------------+------+-----+---------+-------+ | ||
| price | float | NO | | NULL | | | ||
| quantity | int(11) | NO | | NULL | | | ||
| productname | varchar(255) | NO | | NULL | | | ||
| ProductID | int(11) | YES | | NULL | | | ||
| ShopID | int(11) | YES | | NULL | | | ||
| CustomerID | int(11) | YES | | NULL | | | ||
+-------------+--------------+------+-----+---------+-------+ */ | ||
|
||
$productname = $_POST['productname']; | ||
$price = $_POST['price']; | ||
$quantity=$_POST['quantity']; | ||
$ShopID=$_POST['ShopID']; | ||
$ProductID=$_POST['ID']; | ||
|
||
// Inserisci i dati del prodotto nella tabella "cart" | ||
$query = "INSERT INTO cart (productname, price, quantity,ProductID,ShopID) VALUES ('$productname', $price, $quantity,$ProductID,$ShopID);"; | ||
mysqli_query($connection, $query); | ||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.