HTML
4
Вклад в тег
function exam(elem) {
elem.addEventListener('click', (event) => {
currColor.style.backgroundColor = `${getComputedStyle(event.target).backgroundColor}`;
});
}
exam('prewColor');
exam('redColor');
exam('blueColor');
<?php
// Headers
header('Access-Control-Allow-Origin: http://localhost:3000');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: *');
header('Content-Type: application/json');
// Connect to db
$connect = mysqli_connect('localhost', 'root', 'root', 'f-mania');
// If connect error
if (!$connect) {
echo mysqli_connect_error();
die();
}
// Split url into array
$params = explode('/', $_GET['url']);
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if ($params[0] == 'account') {
// ...
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($params[0] == 'account') {
if ($params[1] == 'login') {
// ...
} elseif ($params[1] == 'recover') {
// ...
} elseif ($params[1] == 'reset') {
// ...
} elseif ($params[1] == 'register') {
// ...
}
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') {
// ...
} elseif ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
// ...
}
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-F
RewriteRule ^(.+)$ index.php?url=$1 [L,QSA]