diff --git a/delete-product.php b/delete-product.php
new file mode 100644
index 0000000..63b7b19
--- /dev/null
+++ b/delete-product.php
@@ -0,0 +1,36 @@
+prepare("DELETE FROM bp_products WHERE bp_product_id = ?");
+ $sql->bind_param('i', $product_id);
+ $rs = $sql->execute();
+
+ if($rs) {
+ $response['success'] = true;
+ } else {
+ $response['success'] = false;
+ throw new Exception("Hi ha hagut un error al insertar el registre");
+ }
+
+
+ // if($rs) {
+ // echo ("El registre ha estat satisfactori");
+ // } else {
+ // echo ("Hi ha hagut un error al insertar el registre");
+ // }
+ } catch( Exception $e ) {
+ $response['message'] = $e->getMessage();
+ }
+
+ echo json_encode($response);
+ }
+ header("Location: ./my-products.php");
+
+ ?>
\ No newline at end of file
diff --git a/edit-product.php b/edit-product.php
new file mode 100644
index 0000000..00c31fa
--- /dev/null
+++ b/edit-product.php
@@ -0,0 +1,37 @@
+prepare("DELETE FROM bp_products WHERE bp_product_id = ?");
+ $sql->bind_param('i', $product_id);
+ $rs = $sql->execute();
+
+ if($rs) {
+ $response['success'] = true;
+ } else {
+ $response['success'] = false;
+ throw new Exception("Hi ha hagut un error al insertar el registre");
+ }
+
+
+ // if($rs) {
+ // echo ("El registre ha estat satisfactori");
+ // } else {
+ // echo ("Hi ha hagut un error al insertar el registre");
+ // }
+ } catch( Exception $e ) {
+ $response['message'] = $e->getMessage();
+ }
+
+ echo json_encode($response);
+ }
+ header("Location: ./my-products.php");
+
+
+ ?>
\ No newline at end of file
diff --git a/header.php b/header.php
index 07f8c4b..b13b153 100644
--- a/header.php
+++ b/header.php
@@ -12,9 +12,21 @@
Botiga php
-
+
-
Botiga php
+ Botiga php
@@ -62,7 +62,7 @@ include_once('parameters.php');
$bp_product_name
-
$bp_product_price €
+
" . number_format($bp_product_price,2,",",".") . " €
diff --git a/img/6_Barcelona.jpg b/img/6_Barcelona.jpg
new file mode 100644
index 0000000..695936e
Binary files /dev/null and b/img/6_Barcelona.jpg differ
diff --git a/img/banner (copy).jpg b/img/banner (copy).jpg
new file mode 100644
index 0000000..d988da5
Binary files /dev/null and b/img/banner (copy).jpg differ
diff --git a/img/banner.jpg b/img/banner.jpg
index d988da5..4a7106f 100644
Binary files a/img/banner.jpg and b/img/banner.jpg differ
diff --git a/img/banner_old.jpg b/img/banner_old.jpg
new file mode 100644
index 0000000..431e963
Binary files /dev/null and b/img/banner_old.jpg differ
diff --git a/insert-product.php b/insert-product.php
new file mode 100644
index 0000000..407840f
--- /dev/null
+++ b/insert-product.php
@@ -0,0 +1,41 @@
+prepare("SELECT bp_user_pass FROM bp_users WHERE bp_user_name = ?");
+ $sql->bind_param("s", $username);
+ $sql->execute();
+ $sql->bind_result($encryptedUserpass);
+ $sql->fetch();
+
+ return password_verify($userpass, $encryptedUserpass);
+ }
+ function userDetails($username, $con) {
+ $sql = $con->prepare("SELECT bp_user_id, bp_user_name, bp_user_addDate FROM bp_users WHERE bp_user_name = ?");
+ $sql->bind_param("s", $username);
+ $sql->execute();
+ $sql->bind_result($bp_user_id, $bp_user_name, $bp_user_addDate);
+ $sql->fetch();
+
+ return (array("bp_user_id"=>$bp_user_id, "bp_user_name"=>$bp_user_name, "bp_user_addDate"=>$bp_user_addDate));
+
+ }
+
+ ?>
\ No newline at end of file
diff --git a/login.php b/login.php
index 9af646c..407840f 100644
--- a/login.php
+++ b/login.php
@@ -8,8 +8,10 @@
if (loginCheck($username, $userpass, $con)) {
session_start();
- $_SESSION['userid']=userDetails($username, $con)['bp_user_id'];
- $_SESSION['username']=userDetails($username, $con)['bp_user_name'];
+ $userData = userDetails($username, $con);
+ $_SESSION['userid']=$userData['bp_user_id'];
+ $_SESSION['username']=$userData['bp_user_name'];
+ $_SESSION['useradddate']=$userData['bp_user_addDate'];
header("Location: ./my-products.php");
@@ -26,13 +28,13 @@
return password_verify($userpass, $encryptedUserpass);
}
function userDetails($username, $con) {
- $sql = $con->prepare("SELECT bp_user_id, bp_user_name FROM bp_users WHERE bp_user_name = ?");
+ $sql = $con->prepare("SELECT bp_user_id, bp_user_name, bp_user_addDate FROM bp_users WHERE bp_user_name = ?");
$sql->bind_param("s", $username);
$sql->execute();
- $sql->bind_result($bp_user_id, $bp_user_name);
+ $sql->bind_result($bp_user_id, $bp_user_name, $bp_user_addDate);
$sql->fetch();
- return (array("bp_user_id"=>$bp_user_id, "bp_user_name"=>$bp_user_name));
+ return (array("bp_user_id"=>$bp_user_id, "bp_user_name"=>$bp_user_name, "bp_user_addDate"=>$bp_user_addDate));
}
diff --git a/logout.php b/logout.php
new file mode 100644
index 0000000..452500a
--- /dev/null
+++ b/logout.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/my-products.php b/my-products.php
index 8703597..6fc5c54 100644
--- a/my-products.php
+++ b/my-products.php
@@ -5,8 +5,9 @@ session_start();
if (!isset($_SESSION['username'])) {
header("Location: ./home.php");
}
-$userid = $_SESSION['userid'];
-$username = $_SESSION['username'];
+$userId = $_SESSION['userid'];
+$userName = $_SESSION['username'];
+$userAddDate = $_SESSION['useradddate'];
//FILTER BUTTON
@@ -24,15 +25,46 @@ $username = $_SESSION['username'];
-
-
+
+
-
Botiga php
+ Botiga php
-
+
-
-
Products
+
+
+
My Products 🗊
+
+
+
User:
+
+
+
Account Creation:
+
+
+
Upload New Product ✚
+
+
+
+
+
+
+
+ ×
+ Upload New Product
+
+
+
+
prepare($sqlString);
} else {
- $sqlString = "SELECT bp_product_id, bp_product_name, bp_product_price, bp_product_img_01 FROM bp_products WHERE bp_product_owner = $userid";
+ $sqlString = "SELECT bp_product_id, bp_product_name, bp_product_price, bp_product_img_01 FROM bp_products WHERE bp_product_owner = $userId";
$sql = $con->prepare($sqlString);
}
@@ -78,7 +110,7 @@ $username = $_SESSION['username'];
$bp_product_name
-
$bp_product_price €
+
" . number_format($bp_product_price,2,",",".") . " €
diff --git a/productDetail.php b/productDetail.php
index 718a724..adf9a44 100644
--- a/productDetail.php
+++ b/productDetail.php
@@ -13,7 +13,7 @@ $sqlPString .= " FROM bp_products INNER JOIN bp_users WHERE bp_product_owner = b
$sqlP = $con->prepare($sqlPString);
$sqlP->bind_param("i", $product_id);
$sqlP->execute();
-$sqlP->bind_result($product_name, $product_info, $broduct_price, $product_category, $product_img_01, $product_img_02, $product_img_03, $product_addDate, $product_owner_name);
+$sqlP->bind_result($product_name, $product_info, $product_price, $product_category, $product_img_01, $product_img_02, $product_img_03, $product_addDate, $product_owner_name);
$sqlP->fetch();
@@ -27,7 +27,7 @@ $sqlP->fetch();
+
@@ -45,22 +45,28 @@ $sqlP->fetch();
-
-
-
-
-
-
$product_name
+
+
+
+
$product_name
-
+
+
+
" . number_format($product_price,2,",",".") . " €
+
+
+
Publisher: $product_owner_name
+
+
+
-
-
-
Publisher: $product_owner_name
-
-
+
+
");
diff --git a/register-page.php b/register-page.php
index ac64ed7..f7d33ae 100644
--- a/register-page.php
+++ b/register-page.php
@@ -2,18 +2,10 @@
include_once('header.php');
include_once('parameters.php');
- //FILTER BUTTON
-
-// if (isset($_POST['submit'])) {
-// $uid = $_POST['uid'];
-// $date = $_POST['date'];
-
-// $query = "SELECT * FROM uren WHERE DATUM(post_date)='$date'";
-// $respost = mysqli_query($mysqli, $query);
-// } else {
-// $query = "SELECT * FROM uren";
-// $respost = mysqli_query($mysqli, $query);
-// }
+session_start();
+if (!isset($_SESSION['username'])) {
+ header("Location: ./home.php");
+}
?>