51 lines
2.2 KiB
PHP
51 lines
2.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
||
|
|
if (!isset($_SESSION['superadmin'])) {
|
||
|
|
echo json_encode(['No data', 403]); exit;
|
||
|
|
}
|
||
|
|
|
||
|
|
$post = clearInputData($_POST);
|
||
|
|
|
||
|
|
$sql = "DELETE FROM block_videos WHERE id=".$post['video_id'];
|
||
|
|
|
||
|
|
try {
|
||
|
|
mysql_query($sql);
|
||
|
|
|
||
|
|
$sql = "SELECT * FROM block_videos WHERE block_id=" . $post['block_id'];
|
||
|
|
try {
|
||
|
|
$result = mysql_query($sql);
|
||
|
|
if (mysql_num_rows($result)!=0) {
|
||
|
|
$result_html = '';
|
||
|
|
while ($obj = mysql_fetch_assoc($result)) {
|
||
|
|
$result_html .=
|
||
|
|
'<div class="block_video_wrap">'.
|
||
|
|
'<span class="block_video_url">'.$obj["url"].'</span>'.
|
||
|
|
'<span class="block_video_del" block_id="'.$obj["block_id"].'" video_id="'.$obj["id"].'">Удалить</span>'.
|
||
|
|
'<div class="clear"></div>'.
|
||
|
|
'</div>
|
||
|
|
<div>
|
||
|
|
<div class="add_month_img">Добавить изображение:</div>
|
||
|
|
|
||
|
|
<div class="clear"></div>
|
||
|
|
<form method="post" enctype="multipart/form-data" id="block-video-images-form_'.$obj["id"].'" style="display: inline;">
|
||
|
|
<div class="block-video-images-container" id="block-video-images-container_'.$obj["id"].'" class="">
|
||
|
|
<input type="hidden" name="video_id" value="'.$obj["id"].'">
|
||
|
|
<input data-id="'.$obj["id"].'" type="file" name="blockVideoPhoto[]" accept="image/jpg,image/jpeg" multiple="">
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
<div id="image-block-video-result_'.$obj["id"].'">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
<div class="clear"></div>
|
||
|
|
</div>';
|
||
|
|
}
|
||
|
|
echo $result_html; exit;
|
||
|
|
}
|
||
|
|
} catch (Exception $e) {
|
||
|
|
echo $e->getMessage();
|
||
|
|
}
|
||
|
|
} catch (Exception $e) {
|
||
|
|
echo $e->getMessage();
|
||
|
|
}
|