Файл: photos/del_album.php
Строк: 52
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
if (empty($user_id)) {go(URL.'/');}
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `photos_albums` WHERE `id` = '".$id."' AND `user_id` = '".$user_id."' LIMIT 1");
if (mysql_num_rows($result) == true)
{
$arr_album = mysql_fetch_array(mysql_query("SELECT * FROM `photos_albums` WHERE `id` = '".$id."' AND `user_id` = '".$user_id."' LIMIT 1"));
}
else
{
go(URL.'/photos/?id='.$user_id);
}
}
else
{
go(URL.'/photos/?id='.$user_id);
}
if ($_GET['del'] == 'yes')
{
if (mysql_query("DELETE FROM `photos_albums` WHERE `id` = '".$id."' AND `user_id` = '".$user_id."'") == true)
{
$query = mysql_query("SELECT `name` FROM `photos_file` WHERE `aid` = '".$id."' AND `user_id` = '".$user_id."'");
while ($arr = mysql_fetch_array($query))
{
if (file_exists(HOME .'/files/photos/'. $user_id.'/'.$arr['name'])) {@unlink(HOME .'/files/photos/'. $user_id.'/'.$arr['name']);}
if (file_exists(HOME .'/files/photos/'. $user_id.'/preview/'.$arr['name'])) {@unlink(HOME .'/files/photos/'. $user_id.'/preview/'.$arr['name']);}
if (file_exists(HOME .'/files/photos/'. $user_id.'/mini/'.$arr['name'])) {@unlink(HOME .'/files/photos/'. $user_id.'/mini/'.$arr['name']);}
if (file_exists(HOME .'/files/photos/'. $user_id.'/icons/'.$arr['name'])) {@unlink(HOME .'/files/photos/'. $user_id.'/icons/'.$arr['name']);}
}
mysql_query("DELETE FROM `photos_file` WHERE `aid` = '".$id."'");
mysql_query("DELETE FROM `photos_comm` WHERE `aid` = '".$id."'");
$count_photos = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `photos_file` WHERE `user_id` = '".$user_id."'"),0);
mysql_query("UPDATE `users` SET `count_photos` = '".$count_photos."' WHERE `id` = '".$user_id."'");
go(URL.'/photos/?id='.$user_id);
}
}
$title = lang('Удалить Фотоальбом','Видалити Фотоальбом');
require_once('../incfiles/head.php');
echo '<div class="title">'.$title.'</div>
<div class="block">'.lang('Вы действительно хотите удалить этот альбом?','Ви дійсно хочете видалити цей албом?').'<br/><br/>
<a id="bg_orange" class="button2" href="'.URL.'/photos/del_album.php?id='.$id.'&del=yes" onclick="Page.Go(this.href); return false">'.lang('Удалить','Видалити').'</a>
<a class="button2" href="'.URL.'/photos/?id='.$user_id.'" onclick="Page.Go(this.href); return false">'.lang('Отменить','Скасувати').'</a>
</div>';
require_once('../incfiles/foot.php');
exit;
?>