<?php
error_reporting(E_ERROR | E_PARSE);
ini_set('display_errors', '1');
include('../../user/extension/connect.php');
$con =  mysqli_connect($db_host,$db_user,$db_pass,$db_name);
	if(mysqli_connect_error()){
		echo 'connect to database failed';
	} else {
        if(isset($_GET['key']) && !empty($_GET['key'])){
            
            $key = $_GET['key'];
            
            if($key == '@@@F1r3n3t@@@') {
                $data = '';
                $query = mysqli_query($con,"SELECT user_name FROM users WHERE user_duration <= 0 OR is_freeze = '1' OR is_passchange = '1' ORDER by user_id DESC");
                
                while($row=mysqli_fetch_array($query))
                {
                	$data .= '';
                	$user_name = $row['user_name'];
                	$data .= '/usr/sbin/userdel -r -f '.$user_name.' &> /dev/null;'.PHP_EOL;
                }
                
                echo $data;
            }else{
                echo 'Invalid Key!';
            }
        }else{
            echo 'Invalid Key!';
        }
	}
?>