This commit is contained in:
Evelyn Sucitro 2025-12-01 12:26:38 +07:00
parent b67b84dc60
commit 8823161f87
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,7 @@
<?php
// ✅ Set timezone Indonesia (WIB)
date_default_timezone_set('Asia/Jakarta');
// ✅ CORS Headers - di paling atas
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
@ -37,7 +40,7 @@ if (strlen($password) < 6) {
exit;
}
// ✅ Validasi format username (opsional tapi disarankan)
// ✅ Validasi format username
if (!preg_match('/^[a-zA-Z0-9_]{3,20}$/', $username)) {
echo json_encode([
"status" => "error",
@ -72,7 +75,8 @@ $stmt->bind_param("ss", $username, $hashedPassword);
if ($stmt->execute()) {
echo json_encode([
"status" => "success",
"message" => "Pendaftaran berhasil"
"message" => "Pendaftaran berhasil",
"registered_at" => date("Y-m-d H:i:s") // timestamp sudah WIB
]);
} else {
echo json_encode([