<?php
/**
 * DEPRECATED: This class is legacy code and should NOT be used.
 * 
 * SECURITY WARNING: This class contains multiple critical security vulnerabilities:
 * 1. SQL Injection vulnerabilities (direct SQL queries with user input)
 * 2. Plain text password storage/comparison
 * 3. No input validation
 * 
 * This class has been deprecated and is kept only for reference.
 * DO NOT USE THIS CLASS IN PRODUCTION CODE.
 * 
 * For user authentication, use the modern login system in:
 * - login.php (uses password_hash and prepared statements)
 * - app/classes/UserLoginTracker.php (for login tracking)
 * 
 * @deprecated Since security audit - Use modern authentication system instead
 */

namespace App\classes;

use App\classes\Database;
use App\classes\Session;

/**
 * @deprecated This class is insecure and should not be used
 */
class UserLogin
{
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function roleCheck($username, $pass) {
        trigger_error('UserLogin::roleCheck() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection and plain text password vulnerabilities
     */
    public static function userCheck($data) {
        trigger_error('UserLogin::userCheck() is deprecated and insecure. Use login.php instead.', E_USER_WARNING);
        // Original insecure code removed for security
        return 'This method is deprecated. Please use the modern login system.';
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function countActiveUser() {
        trigger_error('UserLogin::countActiveUser() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return 0;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function loginUserData($username) {
        trigger_error('UserLogin::loginUserData() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function doubleUser($usr) {
        trigger_error('UserLogin::doubleUser() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function doubleEmail($email) {
        trigger_error('UserLogin::doubleEmail() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function passwordCheck($pass, $conpass) {
        // This method is relatively safe but still deprecated
        if ($pass === $conpass) {
            return true;
        }
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection and plain text password vulnerabilities
     */
    public function addUser($data) {
        trigger_error('UserLogin::addUser() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return 'This method is deprecated. Please use the modern registration system.';
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public function updateUser($data) {
        trigger_error('UserLogin::updateUser() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function allUser() {
        trigger_error('UserLogin::allUser() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function userUnblock($id) {
        trigger_error('UserLogin::userUnblock() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function userBlock($id) {
        trigger_error('UserLogin::userBlock() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function makeAdmin($id) {
        trigger_error('UserLogin::makeAdmin() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function deleteUser($id) {
        trigger_error('UserLogin::deleteUser() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return 'This method is deprecated. Please use the modern user management system.';
    }
    
    /**
     * @deprecated DO NOT USE
     */
    public static function imageChecker($ext) {
        if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'PNG' || $ext == 'JPG' || $ext == 'JPEG') {
            return true;
        }
        return false;
    }
    
    /**
     * @deprecated DO NOT USE - Contains SQL injection vulnerability
     */
    public static function findSingleImage($id) {
        trigger_error('UserLogin::findSingleImage() is deprecated and insecure. Do not use.', E_USER_WARNING);
        // Original insecure code removed for security
        return false;
    }
}
