diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..14bc68c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject/private/
\ No newline at end of file
diff --git a/connection.php b/connection.php
index 82c04fb..9d2e0f3 100644
--- a/connection.php
+++ b/connection.php
@@ -7,8 +7,10 @@ class DB {
//Singleton Design Pattern
public static function getInstance() {
if (!isset(self::$instance)) {
- $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
- self::$instance = new PDO('mysql:host=localhost;dbname=php_mvc', 'root', '', $pdo_options);
+ $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
+
+ self::$instance = new PDO('mysql:host=localhost;dbname=blogjazz', 'root', '', $pdo_options);
+
}
return self::$instance;
}
diff --git a/controllers/authentication_controller.php b/controllers/authentication_controller.php
new file mode 100644
index 0000000..2659200
--- /dev/null
+++ b/controllers/authentication_controller.php
@@ -0,0 +1,35 @@
+
\ No newline at end of file
diff --git a/controllers/contactus_controller.php b/controllers/contactus_controller.php
new file mode 100644
index 0000000..c95ad49
--- /dev/null
+++ b/controllers/contactus_controller.php
@@ -0,0 +1,28 @@
+getMessage();
+ }
+ }
+
+ public function create() {
+ if ($_SERVER['REQUEST_METHOD'] == 'GET') {
+
+ require_once('views\products\signup.php'); // takes it to the form that they need to sign up
+
+
+ }else{ Authentication::insertAdmin();
+ $stmt = Authentication::all();
+
+ }
+ }
+
+
+
+ public function login() {
+ if ($_SERVER['REQUEST_METHOD'] == 'GET') {
+
+ require_once('views\products\login.php');
+ } else {
+
+ Authentication::login();
+
+ // $row=Authentication::all();
+ }
+ }
+
+}
diff --git a/controllers/subscribe_controller.php b/controllers/subscribe_controller.php
new file mode 100644
index 0000000..942be31
--- /dev/null
+++ b/controllers/subscribe_controller.php
@@ -0,0 +1,26 @@
+
- MVC Skeleton
+
+
+ GITS ABROAD
+
email = $email;
+ $this->password = $password;
+ $this->passwordconf = $passwordconf;
+ }
+
+ public function insertAdmin() {
+
+
+
+ $db = Db::getInstance();
+
+ if (isset($_POST["signup-btn"])) {
+ $email = $_POST["email"];
+ $password = $_POST["password"];
+ $passwordconf = $_POST["passwordconf"];
+
+
+ if (empty($email)) {
+ die("Email Required");
+ }
+
+ if (empty($password)) {
+ die("Password Required");
+ }
+ if ($password !== $passwordconf) {
+ die("The two password do not match");
+ }
+
+
+ $sql = $db->prepare("SELECT count(*) FROM admin_login WHERE email = :email");
+ $sql->execute(array('email' => $email));
+ $row = $sql->fetch();
+ $count = $row[0];
+
+ if ($count > 0) {
+ die("Email address already exists, please login.");
+ }
+
+ $passwordhash = password_hash($password, PASSWORD_DEFAULT);
+
+ $sql = $db->prepare("INSERT INTO admin_login (email, password) VALUES (:email, :password)");
+ $sql->bindParam(':email', $email);
+ $sql->bindParam(':password', $passwordhash);
+
+
+ if (isset($_POST['email']) && $_POST['email'] != "") {
+ $filteredEmail = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ if (isset($_POST['password']) && $_POST['password'] != "") {
+
+ $filteredPassword = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ $email = $filteredEmail;
+ $password = $filteredPassword;
+ $sql->execute();
+
+ header("location:index.php");
+ }
+ }
+
+ public function login() {
+
+
+ $db = Db::getInstance();
+
+ if (isset($_POST['login-btn'])) {
+ $email = trim($_POST['email']);
+ $password = trim($_POST['password']);
+ if ($email != "" && $password != "") {
+
+
+
+ try {
+ $query = $db->prepare("SELECT adminID, email, password FROM admin_login WHERE email = :email");
+ $query->bindParam(':email', $email);
+ $query->execute();
+
+ $row = $query->fetch(PDO::FETCH_ASSOC);
+
+
+
+ if ($row === FALSE) {
+ die('Incorrect email / password combination!');
+ } else {
+ $validpassword = (password_verify($password, $row['password']));
+
+ if ($validpassword) {
+ $_SESSION['email'] = $_POST['email'];
+
+ header("location:?controller=blog&action=readAllAdminUser");
+ } else {
+ echo "Invalid email and password!";
+ }
+
+
+ }
+ } catch (PDOException $e) {
+ echo "Error : " . $e->getMessage();
+ }
+ }
+ }
+ }
+
+}
diff --git a/models/blog.php b/models/blog.php
new file mode 100644
index 0000000..438e101
--- /dev/null
+++ b/models/blog.php
@@ -0,0 +1,245 @@
+
+blogID = $blogID; //pass all in
+ $this->adminID = $adminID;
+ $this->categoriesID = $categoriesID;
+ $this->countryID = $countryID;
+ $this->title = $title;
+ $this->body = $body;
+ $this->blogDate = $blogDate;
+ }
+
+ public static function all() {
+ $list = [];
+ // this part under is just instansiating the connector to make the connection between the database-DB class in connection.php
+ $db = Db::getInstance();
+ $req = $db->query('SELECT * FROM blog'); //change
+ // we create a list of Product objects from the database results
+ foreach ($req->fetchAll() as $blog) { //change to blog
+ $list[] = new Blog($blog['blogID'], $blog['adminID'], $blog['categoriesID'], $blog['countryID'], $blog['title'], $blog['body'], $blog['blogDate']);
+ }
+ return $list; //come back to make it only show body and title and blog date.
+ }
+
+ public static function find($blogID) {
+ $db = Db::getInstance();
+ //use intval to make sure $id is an integer
+ $blogID = intval($blogID);
+ $req = $db->prepare('SELECT * FROM blog WHERE blogID = :blogID');
+ //the query was prepared, now replace :id with the actual $id value
+ $req->execute(array('blogID' => $blogID));
+ $blog = $req->fetch();
+ if ($blog) {
+ return new Blog($blog['blogID'], $blog['adminID'], $blog['categoriesID'], $blog['countryID'], $blog['title'], $blog['body'], $blog['blogDate']);
+ } else {
+ //replace with a more meaningful exception
+ throw new Exception('Could not find blog');
+ }
+ }
+
+ //changed until this point
+ //change the below, still victorias code.
+
+// public static function update($blogID) {
+// $db = Db::getInstance();
+// $req = $db->prepare("Update blog set title=:title, body=:body where blogID=:blogID");
+// $req->bindParam(':blogID', $blogID);
+// $req->bindParam(':title', $title);
+// $req->bindParam(':body', $body);
+//
+//// set name and price parameters and execute
+// if (isset($_POST['title']) && $_POST['title'] != "") {
+// $filteredTitle = filter_input(INPUT_POST, 'title', FILTER_SANITIZE_SPECIAL_CHARS);
+// }
+// if (isset($_POST['body']) && $_POST['body'] != "") {
+// $filteredBody = filter_input(INPUT_POST, 'body', FILTER_SANITIZE_SPECIAL_CHARS);
+// }
+// $title = $filteredTitle;
+// $body = $filteredBody;
+// $req->execute();
+//
+////upload product image if it exists
+// if (!empty($_FILES[self::InputKey]['title'])) {
+// Blog::uploadFile($title);
+// }
+// }
+
+ //add product when you run blog and you see ad product its this
+
+ public static function add() { //create
+ $db = Db::getInstance();
+
+
+
+ if (isset($_POST['submit'])) {
+
+ $title = ($_POST["title"]);
+ $body = ($_POST["body"]);
+ $blogDescription = ($_POST["blogDescription"]);
+
+ if ($_POST['country'] == 'Vietnam') {
+ $country = 2;
+ }
+ if ($_POST['country'] == 'Poland') {
+ $country = 1;
+ }
+ if ($_POST['country'] == 'USA') {
+ $country = 3;
+ }
+ if ($_POST['country'] == 'Italy') {
+ $country = 4;
+ }
+ if ($_POST['country'] == 'Turkey') {
+ $country = 5;
+ }
+
+ if ($_POST['categories'] == 'Restaurants') {
+ $categories = 1;
+ }
+ if ($_POST['categories'] == 'Trips') {
+ $categories = 2;
+ }
+ if ($_POST['categories'] == 'Kids') {
+ $categories = 3;
+ }
+ if ($_POST['categories'] == 'Nightlife') {
+ $categories = 3;
+ }
+ if ($_POST['categories'] == 'Tips') {
+ $categories = 2;
+ }
+
+
+ date_default_timezone_set('UTC');
+ $date = date("Y-m-d");
+ }
+
+ $req = $db->prepare("Insert into blog(categoriesID, countryID, title, body, blogDate, blogDescription) values (:ab , :aa, :a, :b, :d, :c)");
+ $req->bindParam(':a', $title);
+ $req->bindParam(':b', $body);
+ $req->bindParam(':c', $blogDescription);
+ $req->bindParam(':aa', $country);
+ $req->bindParam(':ab', $categories);
+ $req->bindParam(':d', $date);
+// $req->bindParam(':blogDate', $date);
+// set parameters and execute
+ //model communicates wtith the database
+
+ if (isset($_POST['title']) && $_POST['title'] != "") {
+
+ $filteredTitle = filter_input(INPUT_POST, 'title', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ if (isset($_POST['body']) && $_POST['body'] != "") {
+ $filteredBody = filter_input(INPUT_POST, 'body', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ $title = $filteredTitle;
+ $body = $filteredBody;
+
+ $req->execute();
+
+
+ //header("location:index.php?controller=blog&action=readAllAdminUser");
+
+//executes the query
+//all this is making sure that if someone writes a name and it isn't empty then post to database
+//everytime someone created a new prodicut its assigning name variable to filtered name
+//upload product image
+
+// Blog::uploadFile($blogID); //link to add as the code is enabling them to upload pics and error handlers are here look below
+// }
+ }
+const AllowedTypes = ['image/jpeg', 'image/jpg'];
+const InputKey = 'myUploader';
+//die() function calls replaced with trigger_error() calls
+//replace with structured exception handling
+
+ public static function uploadFile($blogID) {
+
+ if (empty($_FILES[self::InputKey])) {
+ //die("File Missing!");
+ trigger_error("File Missing!");
+ }
+
+ if ($_FILES[self::InputKey]['error'] > 0) {
+ trigger_error("Handle the error! " . $_FILES[InputKey]['error']);
+ }
+
+
+ if (!in_array($_FILES[self::InputKey]['type'], self::AllowedTypes)) {
+ trigger_error("Handle File Type Not Allowed: " . $_FILES[self::InputKey]['type']);
+ }
+
+ $tempFile = $_FILES[self::InputKey]['tmp_name'];
+ $path = "C:/xampp/htdocs/finalProject/views/images/img";
+ //$path = "/Applications/XAMPP/xamppfiles/htdocs/finalProject/views/images/img";
+ $destinationFile = $path . $blogID . '.jpeg';
+
+ if (!move_uploaded_file($tempFile, $destinationFile)) {
+ trigger_error("Handle Error");
+ }
+
+ //Clean up the temp file
+ if (file_exists($tempFile)) {
+ unlink($tempFile);
+ }
+ }
+
+ public static function remove($blogID) {
+ $db = Db::getInstance();
+ //make sure $id is an integer
+ $blogID = intval($blogID);
+ $req = $db->prepare('delete FROM blog WHERE blogID = :blogID');
+ // the query was prepared, now replace :id with the actual $id value
+ $req->execute(array(':blogID' => $blogID));
+ }
+
+
+ public static function update($blogID) {
+ $db = Db::getInstance();
+ $req = $db->prepare("Update blog set title=:title, body=:body where blogID=:blogID");
+ $req->bindParam(':blogID', $blogID);
+ $req->bindParam(':title', $title);
+ $req->bindParam(':body', $body);
+
+// set name and price parameters and execute
+ if(isset($_POST['title'])&& $_POST['title']!=""){
+ $filteredTitle = filter_input(INPUT_POST,'title', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ if(isset($_POST['body'])&& $_POST['body']!=""){
+ $filteredBody = filter_input(INPUT_POST,'body', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+$title = $filteredTitle;
+$body = $filteredBody;
+
+$req->execute();
+
+
+ //header("location:finalProject/index.php?controller=blog&action=readAllAdminUser");
+
+
+//upload product image if it exists
+ if (!empty($_FILES[self::InputKey]['title'])) {
+ Blog::uploadFile($title);
+ }
+
+ }
+
+
+
+
+
+}
+
diff --git a/models/contactus.php b/models/contactus.php
new file mode 100644
index 0000000..1800ab0
--- /dev/null
+++ b/models/contactus.php
@@ -0,0 +1,85 @@
+ contactID=$contactID;
+ $this-> firstName=$firstName; //All the below is items for
+ $this-> surname=$surname;
+ $this-> email=$email;
+ $this-> dates=$dates;
+ $this-> body=$body;
+
+
+ }
+
+ /*public static function all() {
+ $list = [];
+ // this part under is just instansiating the connector to make the connection between the database-DB class in connection.php
+ $db = Db::getInstance();
+ $req = $db->query('SELECT * FROM contact_us');
+ // we create a list of contactus objects from the database results
+ foreach ($req->fetchAll() as $contact) {
+ $list[] = new Contact ($contact['contactID'], $contact['blogID'], $contact['subscriptionsID'], $contact['responseID'], $contact['firstName'], $contact['surname'], $contact['email'], $contact['dates'], $contact ['body']);
+ }
+ return $list;
+ }
+
+ /*public static function find($contactID) {
+ $db = Db::getInstance();
+ //use intval to make sure $id is an integer
+ $blogID = intval($blogID);
+ $req = $db->prepare('SELECT * FROM contactus WHERE contactID = :contactID');
+ //the query was prepared, now replace :id with the actual $id value
+ $req->execute(array('contactID' => $contactID));
+ $blog = $req->fetch();
+ if ($contact) {
+ return new Contact($contact['contactID'], $contact['blogID'], $contact['subscriptionsID'], $contact['responseID'], $contact['firstName'], $contact['surname'], $contact['email'], $contact['dates'], $contact ['body']);
+ } else {
+ //replace with a more meaningful exception
+ throw new Exception('Could not find contact');
+
+ }} */
+ public static function add() { //create
+ $db = Db::getInstance();
+ $req = $db->prepare("Insert into contact_us(contactID, firstName, surname, email,dates, body) values (:contactID,:firstName,:surname, :email, :dates, :body)");
+ $req->bindParam(':contactID', $contactID);
+ $req->bindParam(':firstName', $firstName);
+ $req->bindParam(':surname', $surname);
+ $req->bindParam(':email', $email);
+ $req->bindParam(':dates',$dates);
+ $req->bindParam(':body', $body);
+// set parameters and execute
+
+ //model communicates with the database
+
+ if(isset($_POST['firstName'])&& $_POST['firstName']!=""){
+ $filteredFirstName = filter_input(INPUT_POST,'firstName', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ if(isset($_POST['surname'])&& $_POST['surname']!=""){
+ $filteredSurname = filter_input(INPUT_POST,'surname', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ if(isset($_POST['email'])&& $_POST['email']!=""){
+ $filteredEmail = filter_input(INPUT_POST,'email', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+ if(isset($_POST['body'])&& $_POST['body']!=""){
+ $filteredBody = filter_input(INPUT_POST,'body', FILTER_SANITIZE_SPECIAL_CHARS);
+ }
+$firstName = $filteredFirstName;
+$surname = $filteredSurname;
+$email = $filteredEmail;
+$body = $filteredBody;
+$req->execute();
+header("location:index.php"); ;
+ }
+}
+
diff --git a/models/product.php b/models/product.php
index 5bcf732..4ec69ae 100644
--- a/models/product.php
+++ b/models/product.php
@@ -14,8 +14,9 @@ public function __construct($id, $name, $price) {
public static function all() {
$list = [];
+ // this part under is just instansiating the connector to make the connection between the database-DB class in connection.php
$db = Db::getInstance();
- $req = $db->query('SELECT * FROM product');
+ $req = $db->query('SELECT * FROM blog');
// we create a list of Product objects from the database results
foreach($req->fetchAll() as $product) {
$list[] = new Product($product['id'], $product['name'], $product['price']);
@@ -65,14 +66,18 @@ public static function update($id) {
}
}
+ //add product when you run blog and you see ad product its this
public static function add() {
$db = Db::getInstance();
- $req = $db->prepare("Insert into product(name, price) values (:name, :price)");
+ $req = $db->prepare("Insert into product() values (:name, :price)");
$req->bindParam(':name', $name);
$req->bindParam(':price', $price);
// set parameters and execute
+
+ //model communicates wtith the database
+
if(isset($_POST['name'])&& $_POST['name']!=""){
$filteredName = filter_input(INPUT_POST,'name', FILTER_SANITIZE_SPECIAL_CHARS);
}
@@ -82,9 +87,11 @@ public static function add() {
$name = $filteredName;
$price = $filteredPrice;
$req->execute();
-
+//executes the query
+//all this is making sure that if someone writes a name and it isn't empty then post to database
+//everytime someone created a new prodicut its assigning name variable to filtered name
//upload product image
-Product::uploadFile($name);
+Product::uploadFile($name); //link to add as the code is enabling them to upload pics and error handlers are here look below
}
const AllowedTypes = ['image/jpeg', 'image/jpg'];
@@ -109,7 +116,7 @@ public static function uploadFile(string $name) {
}
$tempFile = $_FILES[self::InputKey]['tmp_name'];
- $path = "C:/xampp/htdocs/MVC_Skeleton/views/images/";
+ $path = "/Applications/XAMPP/htdocs/MVC_Skeleton/views/images/";
$destinationFile = $path . $name . '.jpeg';
if (!move_uploaded_file($tempFile, $destinationFile)) {
diff --git a/models/s.php b/models/s.php
new file mode 100644
index 0000000..3177d86
--- /dev/null
+++ b/models/s.php
@@ -0,0 +1,120 @@
+email = $email;
+$this->password = $password;
+}
+
+public function findEmail($email) {
+$db = Db::getInstance();
+$sql = $db->prepare("SELECT * FROM admin_login WHERE email = :email");
+$sql->execute(array('email' => $email));
+$row = $sql->fetch();
+if ($row) {
+return new Auth($count['email']);
+} else {
+//replace with a more meaningful exception
+throw new Exception('Email already exist, please login');
+}
+}
+
+public function insertAdmin() {
+$errors = array();
+
+$db = Db::getInstance();
+
+if (isset($_POST["signup-btn"])) {
+$email = $_POST["email"];
+$password = $_POST["password"];
+
+//validation
+
+if (empty($email)) {
+$errors["email"] = "Email Required";
+die();
+}
+
+if (empty($password)) {
+$errors["password"] = "Password Required";
+die();
+}
+
+$sql = $db->prepare("INSERT INTO admin_login (email, password) VALUES (:email, :password)");
+$sql->bindParam(':email', $email);
+$sql->bindParam(':password', $password);
+$password = password_hash($password, PASSWORD_DEFAULT);
+
+if (isset($_POST['email']) && $_POST['email'] != "") {
+$filteredEmail = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_SPECIAL_CHARS);
+}
+if (isset($_POST['password']) && $_POST['password'] != "") {
+$filteredPassword = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_SPECIAL_CHARS);
+}
+$email = $filteredEmail;
+$password = $filteredPassword;
+$sql->execute();
+
+header("location:index.php");
+}
+}
+
+public function login() {
+
+
+$db = Db::getInstance();
+
+if(isset($_POST['login-btn'])) {
+$email = trim($_POST['email']);
+$password = trim($_POST['password']);
+if($email != "" && $password != "") {
+
+
+try {
+$query = $db->prepare("SELECT count(*) FROM admin_login WHERE :email='$email' AND :password='$password' AND email<>'' AND password <> '' LIMIT 1");
+$query->bindParam(':email', $email);
+$query->bindParam(':password', $password);
+$query->execute();
+$count = $query->rowCount();
+$row = $query->fetch(PDO::FETCH_ASSOC);
+
+
+if($count == 1 &&!empty($row)) {
+$_SESSION['email'] = $_POST['email'];
+$session['password'] = $_POST['password'];
+//redirect
+header("location:index.php");
+
+
+ } else {
+ echo "Invalid username and password!";
+ }
+ } catch (PDOException $e) {
+ echo "Error : ".$e->getMessage();
+ }
+ } else {
+ echo "Both fields are required!";
+ }
+}
+//if ($row >=1) {
+// echo "Username already exist in the database";
+// header("location:views/pages/blogpost.php");
+//} else {
+//throw new Exception('Wrong email and password, please login');
+
+}
+}
+
+
+
+
diff --git a/models/subscribe.php b/models/subscribe.php
new file mode 100644
index 0000000..f8de400
--- /dev/null
+++ b/models/subscribe.php
@@ -0,0 +1,63 @@
+
+ $subscriptionsID;
+ $this-> $firstName;
+ $this-> $surname;
+ $this-> $email;
+
+ }
+
+ public static function add() { //create
+ $db = Db::getInstance();
+ $req = $db->prepare("Insert into subscriptions(email) values (:email)");
+ //$req->bindParam(':subscriptionsID', $subscriptionsID);
+ //$req->bindParam(':firstName', $firstName);
+ //$req->bindParam(':surname', $surname);
+ $req->bindParam(':email', $email);
+
+// set parameters and execute
+
+ //model communicates with the database
+
+ /* if(isset($_POST['subscriptionsID'])&& $_POST['subscriptionsID']!=""){
+ $filteredsubscriptionsID = filter_input(INPUT_POST,'subscriptionsID', FILTER_SANITIZE_SPECIAL_CHARS);
+ /* }
+ if(isset($_POST['firstName'])&& $_POST['firstName']!=""){
+ $filteredFirstName = filter_input(INPUT_POST,'firstName', FILTER_SANITIZE_SPECIAL_CHARS);
+ /* }
+ if(isset($_POST['surname'])&& $_POST['surname']!=""){
+ $filteredSurname = filter_input(INPUT_POST,'surname', FILTER_SANITIZE_SPECIAL_CHARS); */
+ //}
+ if(isset($_POST['email'])&& $_POST['email']!=""){
+ $filteredEmail = filter_input(INPUT_POST,'email', FILTER_SANITIZE_SPECIAL_CHARS);
+
+ }
+
+//$subscriptionsID = $filteredsubscriptionsID;
+//$firstName = $filteredFirstName;
+//$surname = $filteredSurname;
+$email = $filteredEmail;
+
+$req->execute();
+
+if ($req->execute()) {
+ include("views/subscribe/thank_you.php");
+
+ echo "";
+ // header("location:index.php");
+ }
+}
+}
+
+
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..e1ecb19
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,9 @@
+include.path=${php.global.include.path}
+
+php.version=PHP_70
+
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=false
+web.root=.
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..6e2a81f
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+
+
+ org.netbeans.modules.php.project
+
+
+ finalProject
+
+
+
diff --git a/routes.php b/routes.php
index ec4fa8f..b9e6de3 100644
--- a/routes.php
+++ b/routes.php
@@ -1,44 +1,56 @@
{ $action }();
- }
+}
// for validation we list the allowed controllers and their actions
// Add an entry for each new controller and its actions
-$controllers = array('pages' => ['home', 'error'],
- 'product' => ['readAll','read','create','update','delete'],
- 'controllerXXX' => ['actionYYY', 'actionZZZ'],
- );
- // check that the requested controller and action are both allowed
- // if someone tries to access something else they will be redirected
- // to the error action of the pages controller
- if (array_key_exists($controller, $controllers)) {
+$controllers = array('pages' => ['home', 'aboutus', 'error'],
+ 'product' => ['readAll', 'read', 'create', 'update', 'delete'],
+ 'blog' => ['readAll', 'read', 'create', 'update', 'delete', 'readAllAdminUser'],
+ 'authentication' => ['create', 'login'],
+ 'contactus' => ['create'],
+ 'subscribe' => ['create'],
+ 'controllerXXX' => ['actionYYY', 'actionZZZ'],
+);
+
+//after you make it all the last step is go to routes and add new model, new array and same cruds
+// check that the requested controller and action are both allowed
+// if someone tries to access something else they will be redirected
+// to the error action of the pages controller
+if (array_key_exists($controller, $controllers)) {
if (in_array($action, $controllers[$controller])) {
- call($controller, $action);
+ call($controller, $action);
} else {
- call('pages', 'error');
+ call('pages', 'error');
}
- } else {
+} else {
call('pages', 'error');
- }
- ?>
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff --git a/views/blog/backup.php b/views/blog/backup.php
new file mode 100644
index 0000000..0db0a59
--- /dev/null
+++ b/views/blog/backup.php
@@ -0,0 +1,24 @@
+
Fill in the following form to add a new blog:
//this is the html that makes the form pop up to add item
+
\ No newline at end of file
diff --git a/views/blog/backup2.php b/views/blog/backup2.php
new file mode 100644
index 0000000..07d943d
--- /dev/null
+++ b/views/blog/backup2.php
@@ -0,0 +1,54 @@
+
+title . '.jpeg';
+if(file_exists($file)){
+ $img = "";
+ echo $img;
+}
+else
+{
+echo "";
+}
+
+?>
+
+
+
+
+
\ No newline at end of file
diff --git a/views/blog/backup3.php b/views/blog/backup3.php
new file mode 100644
index 0000000..4096caf
--- /dev/null
+++ b/views/blog/backup3.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/views/blog/backup4.php b/views/blog/backup4.php
new file mode 100644
index 0000000..96a363e
--- /dev/null
+++ b/views/blog/backup4.php
@@ -0,0 +1,18 @@
+
+
The above data is present to demonstrate the utilisation of variables
-populated earlier within the page processing
-
This is the home page of the MVC Skeleton Application
\ No newline at end of file
+
+
+
+
+
+
+ Our Blog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Explore the world with us.
+
Our blog is not just about photography, it will take you on a journey of culture, food, history and beyond
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Italy
+
Italy comprises some of the most varied and scenic landscapes on Earth and is often described as a country shaped like a boot. Home to many of the world's greatest works of art, architecture and gastronomy, Italy elates, inspires and moves like no other.
Picturesque cities such as Kraków and Gdańsk vie with energetic Warsaw for your urban attention. Elsewhere, woods, rivers, lakes and hills beckon for some fresh-air fun.
Epicenter of the arts. Architectural darling. Dining and shopping capital. Trendsetter. New York City wears many crowns, and spreads an irresistible feast for all.
+
+
+
+
+
+
+
diff --git a/views/products/aboutus.php b/views/products/aboutus.php
new file mode 100644
index 0000000..3ac00fa
--- /dev/null
+++ b/views/products/aboutus.php
@@ -0,0 +1,8 @@
+Fill in the following form to create a new product:
+
+
+
+
+
+
+
+
+
+
+