Update
This commit is contained in:
parent
b67b84dc60
commit
8823161f87
@ -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([
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user