function ifCatExists(\App\DB\Connection $connection, $catName)
{
    $catArray = \App\DB\Categories::getAll($connection);
    $flag = false;
    foreach ($catArray as $cat) {
        if ($cat['title'] == $catName) {
            $flag = true;
            break;
        }
    }
    return $flag;
}
예제 #2
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 {