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

//Соханение в лог
if($_POST['tolog'] == 'true'){
$qr = mysqli_query($connect_db, "SELECT id,st,msg,dt FROM `".DB_PREFIX."_adm_auth` ORDER BY id ASC");
if (mysqli_num_rows($qr) > 0) {
$history = '';
while($row = mysqli_fetch_assoc($qr)) {
$ty = $row['st'];
if($ty == 0) { $st = 'Информация'; } if($ty == 1) { $st = 'Ошибка'; } if($ty == 2) { $st = 'Успех'; }
$history .= wudatenorm($row['dt']).' | '.$st.' | '.$row['msg']."\r\n";
}
$filename = '../wu-logs/log_activity_auth.txt';
$fh = fopen($filename, 'a+');
fwrite($fh, $history);
fclose($fh);
}
}

//Очистка активности
mysqli_query($connect_db, "DELETE FROM `".DB_PREFIX."_adm_auth`");
exit('1');
?>