<?php
session_start();
define('FL_KEY', true);
include "funct.php";
?>
<!DOCTYPE HTML>
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<head>
<title>lab #4</title>
<link href="http://allfont.ru/allfont.css?fonts=arsenal-regular" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=1110">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
</head>
<body>
<div class="content">
<div class="screen">
<header class="header">
<div class="container">
<nav>
<div class="header-left">
<h2><a class="a-animated" href="index.php">Товары</a></h2>
</div>
</nav>
<div class="logo">
<a href="index.php"><img src="img/logo.svg" width=150px alt="Ошибка загрузки"></a>
</div>
<nav id="nav">
<?php
if (isset($_SESSION['user'])) {
echo '<div class="header-right" onClick="exitClick()">
<h2 class="a-animated a-psevdo">Выход (' . $_SESSION['user']['login'] . ')</h2>
</div>
<div class="header-right" onClick="cartClick()">
<h2 class="a-animated a-psevdo">Корзина</h2>
</div>';
} else {
echo '<div class="header-right" onClick="authClick()" id="authDel">
<h2 class="a-animated a-psevdo">Авторизация</h2>
</div>
<div class="header-right" onClick="regClick()" id="regDel">
<h2 class="a-animated a-psevdo">Регистрация</h2>
</div>';
}
?>
</nav>
</div>
</header>
<div id="cap" class="cap">
<div id="cart-list" class="cart-list">
<div id="cart" class="cart-bg">
<h2>В корзине пока нет товаров</h2>
<tr><th>Наименование</th><th>Фирма</th><th>Категория</th><th>Цена</th><th>Описание</th><th>Количество</th></tr>
</div>
</div>
</div>
<main>
<div class="prod-list">
<div class="prod-bg"></div>
<div class="production">
<ul class="products-clearfix">
<?php
$prods = createProds("товары.csv");
foreach ($prods as $prod) {
echo '<li class="product">
<div class="prod-img">
<img src="img/item' . $prod['id'] . '.png">
</div>
<div class="prod-head">
<p><b>' . $prod['name'] . '</b></p>
</div>
<p><b>Производитель:</b> ' . $prod['firm'] . '</p>
<p><b>Тип:</b> ' . $prod['type'] . '</p>
<p>' . $prod['desc'] . '</p>
<p><b>Цена:</b> ' . $prod['cost'] . '</p>
<div class="in-cart" value="' . $prod['id'] . '" onClick="Cart(this)">
<p class="cart-text">В корзину</p>
</div>
</li>';
}
?>
</ul>
</div>
</div>
<div id="reg" class="reg">
<div class="reg-area">
<div class="middle">
<h2>Регистрация</h2>
<div id="fancy-inputs">
<label class="input">
<input type="text" class="registration" id="login">
<span><span>Username</span></span>
</label>
<label class="input">
<input type="text" class="email registration" id="email">
<span><span>E-mail</span></span>
</label>
<label class="input">
<input type="password" class="registration" id="pass">
<span><span>Password</span></span>
</label>
</div>
<p class="btn" id="regbtn" onClick="registration()">Зарегистрироваться</p>
</div>
</div>
</div>
<div id="auth" class="reg">
<div class="reg-area">
<div class="middle">
<h2>Авторизация</h2>
<div id="fancy-inputs">
<label class="input">
<input type="text" class="auth" id="login_auth">
<span><span>Username</span></span>
</label>
<label class="input">
<input type="password" class="auth" id="pass_auth">
<span><span>Password</span></span>
</label>
</div>
<p class="btn" id="authbtn" onClick="auth()">Войти</p>
</div>
</div>
</div>
</main>
<footer>
<div class="copyright">
<p>© 2020 https:/campin.gg</p>
</div>
</footer>
</div>
</div>
<script language="JavaScript">
</script>
</body>
</html>
По ответу из комментария к вопросу, к сожалению удавалось дойти только до return промиса с абракадаброй(((