<?php require_once '../include/config.php'; /* This file contains instructions for three different states of the form: * - Displaying the initial search form * - Handling a form submission and ... * - ... displaying the results if matches are found. * - ... displaying a "no results found" message if necessary. */ // if a non-blank search term is specified in // the query string, perform a search $searchTerm = isset($_GET['s']) ? trim($_GET['s']) : ''; $products = ''; if ($searchTerm) { require_once ROOT_PATH . 'include/products.php'; $products = getProductsSearch($searchTerm); } $pageTitle = 'Search'; $section = 'search'; include ROOT_PATH . 'include/header.php'; ?> <div class="section shirts search page"> <div class="wrapper"> <h1><?php echo $pageTitle; ?> </h1> <form method="get" action=""> <input type="search" name="s" value="<?php
function main_controller() { if ($_GET['action'] == 'search') { $data = getProductsSearch(); view_products($data); } if (empty($_COOKIE['log']) && empty($_COOKIE['pa'])) { echo "<ul><a href=\"http://localhost/companies/index.php?page=reg\" >Зарегистрируйтесь</a>"; echo "<li>или</li>"; echo "<a href=\"http://localhost/companies/index.php?page=login\">Войдите</a>"; } else { $nameUser = $_COOKIE['log']; echo "<form action=logout.php method=post> Привет, {$nameUser}!<input type=submit value=Выход /></form>"; checkUser(); } }