<form action="upload.php" method="post" enctype="multipart/form-data">
<label for="file">Выберите изображение:</label>
<input type="file" name="file" id="file" required>
<button type="submit">Загрузить</button>
</form>
<?php
$target_dir = "img/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
$check = getimagesize($_FILES["file"]["tmp_name"]);
if($check !== false) {
if (file_exists($target_file)) {
echo "Файл уже существует.";
} else {
if ($_FILES["file"]["size"] > 2000000) {
echo "Файл слишком большой.";
} else {
$allowed_types = array('jpg', 'jpeg', 'png', 'gif');
if (in_array($imageFileType, $allowed_types)) {
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)
}
}
}
}
?>
<div class="knopka">
<div class="kn">
<button onclick="showElement()">Показать больше</button>
</div>
<div class="kn1">
<button onclick="hideElement()">Скрыть</button>
</div>
<div class="container" id="imageContainer">
<div class="scr41">
<img src="/Untitled (5)/Group 10.png" alt="Image 1">
</div>
<div class="scr51">
<img src="/Untitled (5)/Group 11.png" alt="Image 2">
</div>
<div class="scr51">
<img src="/Untitled (5)/Group 12.png" alt="Image 3">
</div>
</div>
</div>
.knopka {
text-align: end;
}
.kn {
margin-top: -55px;
margin-right: 350px;
}
.kn button, .kn1 button {
color: #4E4E4E;
border-radius: 5px;
background-color: #F7F7F7;
font-size: 15px;
border: none;
width: 200px;
height: 40px;
}
.kn button:hover, .kn1 button:hover {
background-color: #ffa34857;
color: rgb(0, 0, 0);
transition: all 0.6s ease;
}
.container {
justify-content: center;
display: flex;
opacity: 0;
transition: opacity 1s ease-in-out;
pointer-events: none;
}
.container.show {
opacity: 1;
pointer-events: auto;
}
.scr41 img, .scr51 img {
margin-top: 70px;
width: 140px;
}
function showElement() {
const element = document.getElementById('imageContainer');
element.classList.add('show');
}
function hideElement() {
const element = document.getElementById('imageContainer');
element.classList.remove('show');
}
const http = require('http');
const httpProxy = require('http-proxy');
const proxy = httpProxy.createProxyServer({});
http.createServer(function(req, res) {
proxy.web(req, res, {
target: 'https://game-analytics.ru',
changeOrigin: true,
selfHandleResponse: true
});
proxy.on('proxyRes', function(proxyRes, req, res) {
let body = [];
proxyRes.on('data', function(chunk) {
body.push(chunk);
});
proxyRes.on('end', function() {
body = Buffer.concat(body);
res.setHeader('Content-Security-Policy', '');
res.writeHead(proxyRes.statusCode, proxyRes.headers);
res.end(body);
});
});
}).listen(3000, () => {
console.log('Прокси-сервер запущен на порту 3000');
});
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Создание Iframe через JavaScript</title>
</head>
<body>
<div id="iframe-container"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const iframe = document.createElement('iframe');
iframe.setAttribute('src', 'http://localhost:3000');
document.getElementById('iframe-container').appendChild(iframe);
});
</script>
</body>
</html>
$("#modal").off('submit').on('submit', function (e) {
e.preventDefault();
var form_data = $(this).serialize();
$.ajax({
type: "POST",
url: "user/add.php",
data: form_data,
success: function (html) {
document.getElementById("shadow").style.display = "none";
document.getElementById("modal").style.display = "none";
$('#modal').trigger('reset');
$("#main").append(html);
}
});
});
require "../database/Task.php";
if (isset($_POST['title']) && isset($_POST['description'])) {
$task_mess = new Task;
$task_mess->add_task($_POST['title'], $_POST['description']);
$new_task = $task_mess->get_last_task();
echo "<div class='task'>
<h3>{$new_task['title']}</h3>
<p>{$new_task['description']}</p>
</div>";
}