This repository was archived by the owner on Jul 20, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,19 +88,19 @@ public function signIn() {
8888
8989 $ user = $ this ->accountModel ->getAccountByEmail ($ email );
9090
91- if ($ user && password_verify ($ password , $ user ['password ' ])) {
92- $ _SESSION ['user_id ' ] = $ user ['id ' ];
93- $ _SESSION ['user_first_name ' ] = $ user ['first_name ' ];
94- $ _SESSION ['user_last_name ' ] = $ user ['last_name ' ];
95- $ _SESSION ['user_email ' ] = $ user ['email ' ];
96-
97- $ role = $ this ->accountModel ->getAccountRole ($ user ['id ' ]);
91+ if ($ user && password_verify ($ password , $ user ->password )) {
92+ $ _SESSION ['user_id ' ] = $ user ->id ;
93+ $ _SESSION ['user_first_name ' ] = $ user ->first_name ;
94+ $ _SESSION ['user_last_name ' ] = $ user ->last_name ;
95+ $ _SESSION ['user_email ' ] = $ user ->email ;
96+ $ _SESSION ['user_phone ' ] = $ user ->phone ;
97+
98+ $ role = $ this ->accountModel ->getAccountRole ($ user ->id );
9899 if ($ role === 'admin ' ) {
99100 header ('Location: /admin ' );
100101 exit ;
101102 }
102103
103- $ _SESSION ['user_phone ' ] = $ user ['phone ' ];
104104 header ('Location: /account ' );
105105 exit ;
106106 }
@@ -161,6 +161,4 @@ public function updateAccount() {
161161 header ('Location: /account ' );
162162 exit ;
163163 }
164-
165-
166164}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public function __construct(PDO $dbConnection) {
1111
1212 public function viewProducts () {
1313 $ title = "View Products " ;
14- $ products = $ this ->productModel ->getAll ();
14+ $ products = $ this ->productModel ->getAllProducts ();
1515 require_once __DIR__ . "/../views/products.php " ;
1616 }
1717
@@ -28,7 +28,7 @@ public function viewSingleProduct() {
2828 exit ;
2929 }
3030
31- $ product = $ this ->productModel ->getById ($ id );
31+ $ product = $ this ->productModel ->getProductById ($ id );
3232
3333 if (!$ product ) {
3434 header ('Location: /products ' );
Original file line number Diff line number Diff line change 1919 }
2020 echo "
2121 <form method='POST' action='/cart'>
22- <input type='hidden' name='product' value=' " . $ product . "'>
22+ <input type='hidden' name='product' value=' " . $ product-> name . "'>
2323 <button type='submit' name='action' value='add'>Add to Cart</button>
2424 <button type='submit' name='action' value='remove'>Remove from Cart</button>
2525 <!-- Handle appearance of the button above with Js: make
2828 ?>
2929</main>
3030
31- <?php include 'partials/footer.php ' ; ?>
31+ <?php include 'partials/footer.php ' ; ?>
You can’t perform that action at this time.
0 commit comments