From 86042acca2f45f1153104941a17677ae01c91c9d Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 18 May 2015 00:42:16 +0200 Subject: PHPify everything and add user login --- categories.php | 32 ++++++++++++++++++++----- contact.html | 23 ------------------ contact.php | 35 +++++++++++++++++++++++++++ index.html | 24 ------------------- index.php | 36 ++++++++++++++++++++++++++++ login.html | 41 -------------------------------- login.php | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ productdetails.php | 14 +++++++++-- products.php | 15 ++++++++++-- 9 files changed, 192 insertions(+), 98 deletions(-) delete mode 100644 contact.html create mode 100644 contact.php delete mode 100644 index.html create mode 100644 index.php delete mode 100644 login.html create mode 100644 login.php diff --git a/categories.php b/categories.php index 2ef44df..f141e3e 100644 --- a/categories.php +++ b/categories.php @@ -1,3 +1,6 @@ + @@ -9,25 +12,42 @@

Categories

-
+find(); foreach( $categories as $category ){ - echo "
getId()}\">{$category->getName()}
"; - echo "
{$category->getDescription()}
"; + echo ""; + echo ""; + echo ""; + if(isset($username)) + { + echo ""; + echo ""; + } + echo ""; } ?> - +
getId()}\">{$category->getName()}{$category->getDescription()}getId()}\">EditgetId()}\">Delete
diff --git a/contact.html b/contact.html deleted file mode 100644 index 89b609f..0000000 --- a/contact.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -Contact Us - - - -

Contact us

- -
-

Name: SomeCompany Ltd.
Telephone: +1-555-6383
Address: SomeStreet in Alamo

-
-
- - - \ No newline at end of file diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..85fc9dc --- /dev/null +++ b/contact.php @@ -0,0 +1,35 @@ + + + + + +Contact Us + + + +

Contact us

+ +
+

Name: SomeCompany Ltd.
Telephone: +1-555-6383
Address: SomeStreet in Alamo

+
+
+ + + \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 205eeb2..0000000 --- a/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - -Home - - - -

Home

- -
-

This site will rock your chair. The best products from all over the world. - Furniture the like you have never seen. Contact us a get our catalog or login a order direct from our categories.

-
-
- - - \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..c7eb711 --- /dev/null +++ b/index.php @@ -0,0 +1,36 @@ + + + + + +Home + + + +

Home

+ +
+

This site will rock your chair. The best products from all over the world. + Furniture the like you have never seen. Contact us a get our catalog or login a order direct from our categories.

+
+
+ + + \ No newline at end of file diff --git a/login.html b/login.html deleted file mode 100644 index 4455b0e..0000000 --- a/login.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - -User - - - -

Customer login

- -
-
-

User

-
- -
-
- -
-
 
- - -
-
-
- - - \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..bbe1897 --- /dev/null +++ b/login.php @@ -0,0 +1,70 @@ +findOneByUsername($username); + if ( !is_object($user) ) + { + header('Location: login.php'); + } + if($user->checkPassword($password)) + { + $_SESSION['username'] = $username; + } + header('Location: .'); + } +?> + + + + +User + + + +

Customer login

+ +
+
+

User

+
+ +
+
+ +
+
 
+ + +
+
+
+ + + \ No newline at end of file diff --git a/productdetails.php b/productdetails.php index 63ba451..44f3e04 100644 --- a/productdetails.php +++ b/productdetails.php @@ -1,4 +1,5 @@

getName(); ?>

diff --git a/products.php b/products.php index 1591799..5827254 100644 --- a/products.php +++ b/products.php @@ -1,4 +1,5 @@ getProducts();

getName(); ?>

-- cgit v1.2.3-70-g09d2