Файл: modules/video/edit.php
Строк: 72
<?php
require_once '../../incfiles/core.php';
require_once '../../incfiles/func.php';
require_once '../../incfiles/auth.php';
require_once '../../incfiles/user.php';
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
}
else go(URL);
$title = $user['name'].' '.$user['surname'].' :: '.lang('Аудиозаписи','Аудіозаписи');
require_once '../../incfiles/head.php';
?>
<script type="text/javascript">
$(function () {
$('#form').on('submit', function (e) {
e.preventDefault();
var $that = $(this)
, formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action')
, type: $that.attr('method')
, contentType: false
, processData: false
, data: formData
, success: function (response) {
if (response) {
$('.content').html(response);
}
}
});
});
});
</script>
<?
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$result = mysql_query("SELECT * FROM `video` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true) $arr_video = mysql_fetch_array($result);
else go(URL);
}
if($user_id ==1){
$adm = 'link
<input id="textarea" name="link" class="input" maxlength="500" value="'.$arr_video['file'].'"/>';
}
if (!empty($_POST['name'])){
$name = check($_POST['name']);
$name = substr($name, 0, 1000);
$about = check($_POST['about']);
$about = substr($about, 0, 1000);
if($user_id ==1)
$link = check($_POST['link']);
else
$link = check($arr_video['file']);
mysql_query("UPDATE `video` SET
`name` = '$name',
`about` = '$about',
`file` = '$link'
WHERE `id` = '".$id."'");
echo ok(lang('Сохранено','Збережено'));
}
if($user['id']!=$arr_video['user_id'])go(URL);
echo '<div class="block">
<form id="form" action="'.URL.'/modules/video/edit.php?id='.$id.'" method="post">
'.lang('Название','Назва').'
<input id="textarea" name="name" class="input" maxlength="500" value="'.$arr_video['name'].'"/>
'.lang('Про видео','Про відео').'
<input id="textarea" name="about" class="input" maxlength="500" value="'.$arr_video['about'].'"/>
'.$adm.'
<input class="button2" type="submit" value="'.lang('Сохранить','Зберегти').'" /> ';
require_once '../../incfiles/foot.php';
?>