092a8bc7ce
- Removed all backup/duplicate files - Removed test files from root - Consolidated documentation to /docs/ - Moved scripts to /scripts/ - Renamed f_* directories (removed prefix) - Organized icons and assets - Removed unused vendor directories - Cleaned up redundant config files
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
defined('_ISVALID') or exit;
|
|
|
|
class VAuth {
|
|
public static function loginForm() {
|
|
global $smarty;
|
|
return $smarty->fetch('tpl_login.tpl');
|
|
}
|
|
|
|
public static function registerForm() {
|
|
global $smarty;
|
|
return $smarty->fetch('tpl_register.tpl');
|
|
}
|
|
|
|
public static function processLogin() {
|
|
$username = VSecurity::postParam('username', 'string');
|
|
$password = VSecurity::postParam('password', 'string');
|
|
|
|
if ($username && $password) {
|
|
// Basic authentication logic
|
|
global $class_database;
|
|
$sql = "SELECT * FROM db_accountuser WHERE usr_user = ? AND usr_password = ?";
|
|
$user = $class_database->execute($sql, [$username, md5($password)]);
|
|
|
|
if ($user && count($user) > 0) {
|
|
VSession::setUserSession($user[0]);
|
|
return ['success' => 'Login successful'];
|
|
}
|
|
}
|
|
|
|
return ['error' => 'Invalid credentials'];
|
|
}
|
|
}
|
|
?>
|