Spaces:
Sleeping
Sleeping
Kush-Singh-26
synced backend and frontend, added more menu items, ui and admin page improvements
56fb0d1 Download api/forgot_password.php from Kush26/kiit-kaffe: direct link, hf CLI and curl.
- Browser
- Download file 789 Bytes
-
https://huggingface.co/spaces/Kush26/kiit-kaffe/resolve/main/api/forgot_password.php
- Command line
-
hf download hf://spaces/Kush26/kiit-kaffe/api/forgot_password.php
-
curl -L -o forgot_password.php https://huggingface.co/spaces/Kush26/kiit-kaffe/resolve/main/api/forgot_password.php
789 Bytes
| header("Content-Type: application/json"); | |
| include "db.php"; | |
| $data = json_decode(file_get_contents("php://input"), true); | |
| $email = trim($data["email"] ?? ""); | |
| $new_password = $data["new_password"] ?? ""; | |
| if (!$email || !$new_password) { | |
| echo json_encode(["status" => "error", "message" => "Email and new password required"]); | |
| exit; | |
| } | |
| $stmt = $conn->prepare("UPDATE users SET password = ? WHERE email = ?"); | |
| if ($stmt->execute([$new_password, $email])) { | |
| if ($stmt->rowCount() > 0) { | |
| echo json_encode(["status" => "success", "message" => "Password updated successfully"]); | |
| } else { | |
| echo json_encode(["status" => "error", "message" => "Email not found"]); | |
| } | |
| } else { | |
| echo json_encode(["status" => "error", "message" => "Update failed"]); | |
| } | |