<?php
require_once('../wu_init.php');
if (!wu_token()) { exit('wu-error'); }
if (!USER_LOGGED) { exit('wu-error'); }
include('wu_checkadmin.php');

$usr = intval($_POST['usr']);

$nav = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT uid,av FROM `".DB_PREFIX."_users` WHERE uid='$usr' LIMIT 1"));
if (empty($nav['uid'])) { exit('wu-error'); }

unlink('../../wu-uploads/avatars/full/'.$nav['av']);
unlink('../../wu-uploads/avatars/thumbs/'.$nav['av']);

mysqli_query($connect_db, "UPDATE `".DB_PREFIX."_users` SET `av` = '' WHERE uid='$usr' LIMIT 1");
exit('1');
?>