Renamed multiple database tables

This commit is contained in:
2026-05-15 23:00:08 +02:00
parent 925348e8fe
commit 5a27c678b1
40 changed files with 267 additions and 256 deletions

View File

@@ -20,7 +20,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
die("Invalid email address.");
}
$stmt = $GLOBALS['conn']->prepare("SELECT * FROM vc_users WHERE user_email = ? LIMIT 1");
$stmt = $GLOBALS['conn']->prepare("SELECT * FROM system_users WHERE user_email = ? LIMIT 1");
$stmt->bind_param('s', $username);
$stmt->execute();
$result = $stmt->get_result();

View File

@@ -48,29 +48,29 @@ function setSessionParams()
{
if (isset($_SESSION['user']['user_uuid'])) {
$user_uuid = $_SESSION['user']['user_uuid'];
$stmt = $GLOBALS['conn']->prepare("SELECT * FROM vc_users INNER JOIN vc_user_groups ON vc_users.user_group_uuid = vc_user_groups.user_group_uuid WHERE user_uuid = ? LIMIT 1");
$stmt = $GLOBALS['conn']->prepare("SELECT * FROM system_users INNER JOIN system_user_groups ON system_users.user_group_uuid = system_user_groups.user_group_uuid WHERE user_uuid = ? LIMIT 1");
$stmt->bind_param('s', $user_uuid);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_assoc();
$_SESSION['user'] = ['user_uuid' => $user['user_uuid'],
'user_email' => $user['user_email'],
'user_first_name' => $user['user_first_name'],
'user_full_name' => $user['user_full_name'],
'user_group_uuid' => $user['user_group_uuid'],
'user_group_weight' => $user['user_group_weight'],
'user_group_type' => $user['user_group_type'],
'user_pref_language' => $user['user_pref_language'],
'user_two_factor_enabled' => $user['user_two_factor_enabled'],
'user_profile_picture' => $user['user_profile_picture'],
'user_profile_picture_thumbnail' => $user['user_profile_picture_thumbnail'],
'user_timezone' => getUserTimezone(),
'user_email' => $user['user_email'],
'user_first_name' => $user['user_first_name'],
'user_full_name' => $user['user_full_name'],
'user_group_uuid' => $user['user_group_uuid'],
'user_group_weight' => $user['user_group_weight'],
'user_group_type' => $user['user_group_type'],
'user_pref_language' => $user['user_pref_language'],
'user_two_factor_enabled' => $user['user_two_factor_enabled'],
'user_profile_picture' => $user['user_profile_picture'],
'user_profile_picture_thumbnail' => $user['user_profile_picture_thumbnail'],
'user_timezone' => getUserTimezone(),
];
$stmt = $GLOBALS['conn']->prepare("SELECT vc_user_group_permissions_portal.permission_value, vc_permissions.permission_name
FROM vc_user_group_permissions_portal
INNER JOIN vc_permissions ON vc_user_group_permissions_portal.permission_uuid = vc_permissions.permission_uuid
$stmt = $GLOBALS['conn']->prepare("SELECT system_user_group_permissions.permission_value, system_permissions.permission_name
FROM system_user_group_permissions
INNER JOIN system_permissions ON system_user_group_permissions.permission_uuid = system_permissions.permission_uuid
WHERE user_group_uuid = ?");
$stmt->bind_param('s', $user['user_group_uuid']);
$_SESSION['permission'] = array();
@@ -84,7 +84,7 @@ function setSessionParams()
function loginUser($user_uuid)
{
$update = $GLOBALS['conn']->prepare("UPDATE vc_users SET user_last_login_timestamp = ? WHERE user_uuid = ?");
$update = $GLOBALS['conn']->prepare("UPDATE system_users SET user_last_login_timestamp = ? WHERE user_uuid = ?");
$update->bind_param('is', time(), $user_uuid);
$update->execute();

View File

@@ -20,7 +20,7 @@ if ($loginAttempts > 5) {
$user_email = $_POST['user_email'];
$sql = "SELECT * FROM vc_users WHERE user_email = ?";
$sql = "SELECT * FROM system_users WHERE user_email = ?";
$stmt = $GLOBALS['conn']->prepare($sql);
$stmt->bind_param("s", $user_email);
if (!$stmt->execute()) {
@@ -45,7 +45,7 @@ $user_uuid = $user_data["user_uuid"];
$user_password_reset_token = bin2hex(random_bytes(32));
$user_password_reset_expires = time() + 86400;
$sql = "UPDATE vc_users SET user_password_reset_token = ?, user_password_reset_expires = ? WHERE user_uuid = ?";
$sql = "UPDATE system_users SET user_password_reset_token = ?, user_password_reset_expires = ? WHERE user_uuid = ?";
$stmt = $GLOBALS['conn']->prepare($sql);
$stmt->bind_param("sss",
$user_password_reset_token,

View File

@@ -16,22 +16,22 @@ if (isset($_POST['user_uuid'])) {
}
$user_uuid = $_SESSION['user']['user_uuid'];
$sql = "UPDATE vc_users SET user_password = ?,
$sql = "UPDATE system_users SET user_password = ?,
user_password_reset_token = NULL,
user_password_reset_expires = NULL
WHERE user_uuid = ?";
$userSql = "SELECT COUNT(*) FROM vc_users WHERE user_uuid = ?";
$userSql = "SELECT COUNT(*) FROM system_users WHERE user_uuid = ?";
$whereValue = $user_uuid;
} elseif (isset($_POST['user_password_reset_token'])) {
$user_password_reset_token = $_POST['user_password_reset_token'];
$sql = "UPDATE vc_users SET user_password = ?,
$sql = "UPDATE system_users SET user_password = ?,
user_password_reset_token = NULL,
user_password_reset_expires = NULL,
user_verified_email = 1,
user_status = 'active'
WHERE user_password_reset_token = ? AND user_status IN ('active', 'pending')";
$userSql = "SELECT COUNT(*) FROM vc_users WHERE user_password_reset_token = ?";
$userSql = "SELECT COUNT(*) FROM system_users WHERE user_password_reset_token = ?";
$whereValue = $user_password_reset_token;
}