Update: 2026-06-25 19:10:25
This commit is contained in:
@@ -53,11 +53,8 @@ try {
|
|||||||
$uniqueId = bin2hex(random_bytes(16));
|
$uniqueId = bin2hex(random_bytes(16));
|
||||||
|
|
||||||
if ($role === 'admin') {
|
if ($role === 'admin') {
|
||||||
// ✅ FIX R4: إزالة ALTER TABLE من كود الإنتاج — يجب تشغيل migration منفصل
|
$sql = "INSERT INTO adminUser (id, fingerprint, fingerprint_hash, name, phone, email, password, role, created_at)
|
||||||
// قبل استخدام هذا الكود، تأكد من تشغيل:
|
VALUES (:id, :fp, :fp_hash, :name, :phone, :email, :pass, :role, NOW())";
|
||||||
// ALTER TABLE adminUser ADD COLUMN IF NOT EXISTS phone VARCHAR(255) NULL AFTER name;
|
|
||||||
$sql = "INSERT INTO adminUser (id, fingerprint, fingerprint_hash, name, phone, password, role, created_at)
|
|
||||||
VALUES (:id, :fp, :fp_hash, :name, :phone, :pass, :role, NOW())";
|
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
':id' => $uniqueId,
|
':id' => $uniqueId,
|
||||||
@@ -65,6 +62,7 @@ try {
|
|||||||
':fp_hash' => $fpHash,
|
':fp_hash' => $fpHash,
|
||||||
':name' => $encName,
|
':name' => $encName,
|
||||||
':phone' => $encPhone,
|
':phone' => $encPhone,
|
||||||
|
':email' => $encEmail,
|
||||||
':pass' => $hashedPassword,
|
':pass' => $hashedPassword,
|
||||||
':role' => $role
|
':role' => $role
|
||||||
]);
|
]);
|
||||||
@@ -95,5 +93,5 @@ try {
|
|||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
error_log("[Staff Add Error] " . $e->getMessage());
|
error_log("[Staff Add Error] " . $e->getMessage());
|
||||||
jsonError($e->getMessage());
|
jsonError("An internal error occurred. Please try again later.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user