<?



include_once '../sys/inc/start.php';



include_once '../sys/inc/compress.php';



include_once '../sys/inc/sess.php';



include_once '../sys/inc/home.php';



include_once '../sys/inc/settings.php';



include_once '../sys/inc/db_connect.php';



include_once '../sys/inc/ipua.php';



include_once '../sys/inc/fnc.php';



include_once '../sys/inc/user.php';











if (isset($_GET['id']) && $user['id'] == $_GET['id'])$ank['id']=intval($_GET['id']);else {header("Location: /index.php?".SID);exit;}








if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: /index.php?".SID);exit;}



$ank=get_user($ank['id']);











$set['title']='Удаление странички "'.$ank['nick'].'"';
include_once '../sys/inc/thead.php';



title();











if (isset($_POST['delete']))



{



if (function_exists('set_time_limit'))@set_time_limit(600);



$mass[0]=$ank['id'];



$collisions=user_collision($mass,1);



mysql_query("DELETE FROM `user` WHERE `id` = '$ank[id]' LIMIT 1");



mysql_query("DELETE FROM `chat_post` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `gifts_user` WHERE `id_user` = '$ank[id]' OR `id_ank` = '$ank[id]'");



mysql_query("DELETE FROM `frends` WHERE `user` = '$ank[id]' OR `frend` = '$ank[id]'");	



mysql_query("DELETE FROM `frends_new` WHERE `user` = '$ank[id]' OR `to` = '$ank[id]'");	



	



	mysql_query("DELETE FROM `stena` WHERE `id_user` = '$ank[id]'");



	mysql_query("DELETE FROM `stena_like` WHERE `id_user` = '$ank[id]'");	



	mysql_query("DELETE FROM `status_like` WHERE `id_user` = '$ank[id]'");	



	mysql_query("DELETE FROM `status` WHERE `id_user` = '$ank[id]'");	



	mysql_query("DELETE FROM `status_komm` WHERE `id_user` = '$ank[id]'");	







$q5=mysql_query("SELECT * FROM `forum_t` WHERE `id_user` = '$ank[id]'");



while ($post5 = mysql_fetch_assoc($q5))



{



mysql_query("DELETE FROM `forum_p` WHERE `id_them` = '$post5[id]'");



}



mysql_query("DELETE FROM `forum_t` WHERE `id_user` = '$ank[id]'");











mysql_query("DELETE FROM `user_set` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `notification` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `notification_set` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `discussions` WHERE `id_user` = '$ank[id]' OR `id_user` = '$ank[id]' OR `ot_kogo` = '$ank[id]'");



mysql_query("DELETE FROM `discussions_set` WHERE `id_user` = '$ank[id]'");







mysql_query("DELETE FROM `forum_p` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `forum_zakl` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `guest` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `loads_komm` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `news_komm` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `user_files` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `user_music` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `like_object` WHERE `id_user` = '$ank[id]'");







mysql_query("DELETE FROM `status` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `status_like` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `status_komm` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `status_count` WHERE `id_user` = '$ank[id]'");







mysql_query("DELETE FROM `mark_notes` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `mark_files` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `mark_people` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `mark_foto` WHERE `id_user` = '$ank[id]'");







mysql_query("DELETE FROM `tape_set` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `tape` WHERE `id_user` = '$ank[id]'");



mysql_query("DELETE FROM `tape` WHERE `avtor` = '$ank[id]'");



mysql_query("DELETE FROM `tape` WHERE `id_file` = '$ank[id]' AND `type` = 'frend'");











$opdirbase=@opendir(H.'sys/add/delete_user_act');



while ($filebase=@readdir($opdirbase))



if (preg_match('#\.php$#i',$filebase))



include_once(H.'sys/add/delete_user_act/'.$filebase);







$q5=mysql_query("SELECT * FROM `obmennik_files` WHERE `id_user` = '$ank[id]'");



while ($post5 = mysql_fetch_assoc($q5))



{



unlink(H.'sys/obmen/files/'.$post5['id'].'.dat');



}











mysql_query("DELETE FROM `obmennik_files` WHERE `id_user` = '$ank[id]'");







mysql_query("DELETE FROM `users_konts` WHERE `id_user` = '$ank[id]' OR `id_kont` = '$ank[id]'");



mysql_query("DELETE FROM `mail` WHERE `id_user` = '$ank[id]' OR `id_kont` = '$ank[id]'");



mysql_query("DELETE FROM `user_voice` WHERE `id_user` = '$ank[id]' OR `id_kont` = '$ank[id]'");



mysql_query("DELETE FROM `user_collision` WHERE `id_user` = '$ank[id]' OR `id_user2` = '$ank[id]'");



mysql_query("DELETE FROM `votes_user` WHERE `u_id` = '$ank[id]'");











if (count($collisions)>1 && isset($_GET['all']))



{



for ($i=1;$i<count($collisions);$i++)



{



mysql_query("DELETE FROM `user` WHERE `id` = '$collisions[$i]' LIMIT 1");



mysql_query("DELETE FROM `chat_post` WHERE `id_user` = '$collisions[$i]'");











mysql_query("DELETE FROM `forum_t` WHERE `id_user` = '$collisions[$i]'");











$q5=mysql_query("SELECT * FROM `forum_t` WHERE `id_user` = '$collisions[$i]'");



while ($post5 = mysql_fetch_assoc($q5))



{



mysql_query("DELETE FROM `forum_p` WHERE `id_them` = '$post5[id]'");



}







mysql_query("DELETE FROM `forum_p` WHERE `id_user` = '$collisions[$i]'");



mysql_query("DELETE FROM `forum_zakl` WHERE `id_user` = '$collisions[$i]'");



mysql_query("DELETE FROM `guest` WHERE `id_user` = '$collisions[$i]'");



mysql_query("DELETE FROM `loads_komm` WHERE `id_user` = '$collisions[$i]'");



mysql_query("DELETE FROM `news_komm` WHERE `id_user` = '$collisions[$i]'");











$q5=mysql_query("SELECT * FROM `obmennik_files` WHERE `id_user` = '$collisions[$i]'");



while ($post5 = mysql_fetch_assoc($q5))



{



unlink(H.'sys/obmen/files/'.$post5['id'].'.dat');



}



mysql_query("DELETE FROM `obmennik_files` WHERE `id_user` = '$collisions[$i]'");







mysql_query("DELETE FROM `users_konts` WHERE `id_user` = '$collisions[$i]' OR `id_kont` = '$collisions[$i]'");



mysql_query("DELETE FROM `mail` WHERE `id_user` = '$collisions[$i]' OR `id_kont` = '$collisions[$i]'");



mysql_query("DELETE FROM `user_voice` WHERE `id_user` = '$collisions[$i]' OR `id_kont` = '$collisions[$i]'");



mysql_query("DELETE FROM `user_collision` WHERE `id_user` = '$collisions[$i]' OR `id_user2` = '$collisions[$i]'");



mysql_query("DELETE FROM `votes_user` WHERE `u_id` = '$collisions[$i]'");



}



admin_log('Пользователи','Удаление',"Удаление группы пользователей '$ank[nick]' (id#".implode(',id#',$collisions).")");



msg('Все данные о пользователях удалены');



}



else 



{



admin_log('Пользователи','Удаление',"Удаление пользователя '$ank[nick]' (id#$ank[id])");



msg("Все данные о пользователе $ank[nick] удалены");



}















$tab=mysql_list_tables($set['mysql_db_name']);



for($i=0;$i<mysql_num_rows($tab);$i++)



{



mysql_query("OPTIMIZE TABLE `".mysql_tablename($tab,$i)."`");



}







echo "<div class='foot'>\n";



echo "&laquo;<a href='/users.php'>Пользователи</a><br />\n";



echo "</div>\n";



include_once '../sys/inc/tfoot.php';



}



















































































































































































































echo '<div class = "mess">Вы подтверждаете удаление вашей странички? После соглашения ваша страничка будет безвозвратно удалена.</div>';




echo "<form method=\"post\" action=\"\">\n";



echo "<input value=\"Удалить\" type=\"submit\" name='delete' />\n";



echo "</form>\n";



















echo "<br />\n";























echo "<div class='foot'>\n";



echo "&laquo;<a href='/info.php?id=$ank[id]'>В анкету</a><br />\n";







echo "</div>\n";



include_once '../sys/inc/tfoot.php';



?>