Skip to content

Instantly share code, notes, and snippets.

View harryWonder's full-sized avatar
🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>

Ilori stephen harryWonder

🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>
View GitHub Profile
@harryWonder
harryWonder / Controller.php
Created May 10, 2020 08:51
This file acts as the base controller for other controllers in the controllers folder.
<?php
session_start();
class Controller { }
?>
@harryWonder
harryWonder / dashboard.php
Created May 11, 2020 07:36
The dashboard view for users
<?php require_once('./controller/Dashboard.php'); ?>
<?php
$Dashboard = new Dashboard();
$Response = [];
$active = $Dashboard->active;
$News = $Dashboard->getNews();
?>
<?php require('./nav.php'); ?>
<main role="main" class="container">
<div class="container">
@harryWonder
harryWonder / index.php
Created May 11, 2020 07:38
This file serves as the login page for our application.
<?php require_once('./controller/Login.php'); ?>
<?php
$Login = new Login();
$Response = [];
$active = $Login->active;
if (isset($_POST) && count($_POST) > 0) $Response = $Login->login($_POST);
?>
<?php require('./nav.php'); ?>
<main role="main" class="container">
<div class="container">
@harryWonder
harryWonder / logout.php
Created May 11, 2020 07:39
This view file loads in the logout controller and logs out the current user session.
<?php require_once('./controller/Logout.php'); ?>
<?php new Logout(); ?>
@harryWonder
harryWonder / register.php
Last active May 15, 2020 00:08
This file acts as our view for registering or creating a new user.
<?php require_once('./controller/Register.php'); ?>
<?php
$Register = new Register();
$Response = [];
$active = $Register->active;
if (isset($_POST) && count($_POST) > 0) $Response = $Register->register($_POST);
?>
<?php require('./nav.php'); ?>
<main role="main" class="container">
<div class="container">
@harryWonder
harryWonder / nav.php
Last active May 15, 2020 00:09
This file acts as the base nav for all other views
<?php require_once('./config.php'); ?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="application-name" content="LD Talent Login Project">
<meta name="author" content="Ilori Stephen A">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>LD Talent | <?php echo ucfirst($active); ?></title>
<!-- Css Styles... -->
@harryWonder
harryWonder / DashboardModel.php
Last active May 15, 2020 00:11
This file extends the Db Class and houses a method which is responsible for fetching a list of news from the database.
<?php
require_once(__dir__ . '/Db.php');
class DashboardModel extends Db {
/**
* @param null
* @return array
* @desc Returns an array of news....
**/
public function fetchNews() :array
@harryWonder
harryWonder / Db.php
Last active May 15, 2020 00:15
A Db Class which provides a decent abstraction layer for making database operations.
<?php
class Db {
protected $dbName = 'learning_dollars_db'; /** Database Name */
protected $dbHost = 'localhost'; /** Database Host */
protected $dbUser = 'root'; /** Database Root */
protected $dbPass = ''; /** Databse Password */
protected $dbHandler, $dbStmt;
/**
* @param null|void
@harryWonder
harryWonder / Db.php
Last active May 15, 2020 00:15
A Db Class which provides a decent abstraction layer for making database operations.
<?php
class Db {
protected $dbName = 'learning_dollars_db'; /** Database Name */
protected $dbHost = 'localhost'; /** Database Host */
protected $dbUser = 'root'; /** Database Root */
protected $dbPass = ''; /** Databse Password */
protected $dbHandler, $dbStmt;
/**
* @param null|void
@harryWonder
harryWonder / LoginModel.php
Last active May 15, 2020 00:16
A LoginModel class which searches for a user based on the user email address and returns an array with a status and data key which determines the result of the search
<?php
require_once(__dir__ . '/Db.php');
class LoginModel extends Db {
/**
* @param string
* @return array
* @desc Returns a user record based on the method parameter....
**/
public function fetchEmail(string $email) :array