Пример #1
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
$src_path = __DIR__ . '/../src/';
include_once $src_path . 'autoload.php';
session_start();
$connection = new \App\DB\Connection('root', '');
$urler = new \App\Utilities\Url();
$view = $urler->getPage();
$categories = \App\DB\Categories::getAll($connection);
switch ($view) {
    case 'main':
        include_once $src_path . 'main.php';
        break;
    case 'company':
        include_once $src_path . 'company.php';
        break;
    case 'contacts':
        include_once $src_path . 'contacts.php';
        break;
    case 'exit':
        if (isset($_SESSION['user_id'])) {
            include_once $src_path . 'exit.php';
        } else {
            echo "<h1>404 Not Found</h1>";
        }
        break;
    case 'edit':
        if (isset($_SESSION['user_id'])) {
            include_once $src_path . 'edit.php';
        } else {
Пример #2
0
<?php

$src_path = __DIR__ . '/../src/';
include_once $src_path . 'autoload.php';
session_start();
$connection = new \App\DB\Connection('root', '');
$urler = new \App\Utilities\Url();
$page = $urler->getPage();
$categories = \App\DB\Categories::getAll($connection);
switch ($page) {
    case 'main':
        include_once $src_path . 'main.php';
        break;
    case 'category':
        include $src_path . 'category.php';
        break;
    case 'product':
        include $src_path . 'single-item.php';
        break;
    case 'cart/add':
        include $src_path . 'cart_add.php';
        break;
    case 'cart/del':
        include $src_path . 'cart_del.php';
        break;
    case 'cart':
        include $src_path . 'cart.php';
        break;
    case 'order':
        include $src_path . 'order.php';
        break;