Файл: photos/handler/new_album.php
Строк: 29
<?php
if (!empty($_POST['name']))
{
$name = check($_POST['name']);
$name = substr($name, 0, 100);
if (empty($name)) {go(URL.'/photos/?id='.$user_id);}
$dir = HOME.'/files/photos/'.$user_id;
if (!is_dir($dir))
{
mkdir(HOME.'/files/photos/'.$user_id,0777);
mkdir(HOME.'/files/photos/'.$user_id.'/icons',0777);
mkdir(HOME.'/files/photos/'.$user_id.'/mini',0777);
mkdir(HOME.'/files/photos/'.$user_id.'/preview',0777);
}
if (mysql_query("INSERT INTO `photos_albums` SET
`user_id` = '".$user_id."',
`name` = '".$name."',
`uptime` = '".time()."',
`time` = '".time()."'
") == true)
{
if ($ajax_query == false) go(URL.'/photos/?id='.$user_id);
}
}
?>
<script type="text/javascript">
$(function(){
$('#form').on('submit', function(e){
$('#form_content').html('');
Page.Loading('start');
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){
Page.Go($that.attr('action'));
}
}
});
});
});
</script>