Файловый менеджер - Редактировать - /home/gqdcvggs/.trash/update_profile.php
Назад
<?php header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); require_once 'config.php'; $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if ($conn->connect_error) { echo json_encode(['success' => false, 'error' => 'Database connection failed']); exit; } $data = json_decode(file_get_contents('php://input'), true); $userId = intval($data['userId']); $firstName = $conn->real_escape_string($data['firstName']); $lastName = $conn->real_escape_string($data['lastName']); $yearsPlaying = intval($data['yearsPlaying']); $hoursPerWeek = intval($data['hoursPerWeek']); $sql = "UPDATE users SET first_name = '$firstName', last_name = '$lastName', years_playing = $yearsPlaying, hours_per_week = $hoursPerWeek"; if (isset($data['profileImage']) && !empty($data['profileImage'])) { $profileImage = $conn->real_escape_string($data['profileImage']); $sql .= ", profile_image = '$profileImage'"; } $sql .= " WHERE id = $userId"; if ($conn->query($sql) === TRUE) { echo json_encode(['success' => true]); } else { echo json_encode(['success' => false, 'error' => $conn->error]); } $conn->close(); ?>
| ver. 1.6 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка