27 lines
775 B
PHP
27 lines
775 B
PHP
<?php
|
|
|
|
// Include the database connection file
|
|
require_once __DIR__ . '/../../connect.php';
|
|
|
|
// Filter and encrypt the phone number input
|
|
$phone_number = filterRequest("phone_number");
|
|
$phone_number = $encryptionHelper->encryptData($phone_number);
|
|
|
|
// Prepare the SQL query to verify the phone
|
|
$sql = "UPDATE phone_verification SET is_verified = 1 WHERE phone_number = :phone_number";
|
|
|
|
// Prepare the statement
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->bindParam(":phone_number", $phone_number);
|
|
|
|
// Execute the query
|
|
$stmt->execute();
|
|
$affectedRows = $stmt->rowCount();
|
|
|
|
// Check if the update was successful
|
|
if ($affectedRows > 0) {
|
|
jsonSuccess(["message" => "Phone number verified successfully"]);
|
|
} else {
|
|
jsonError("No phone number found or verification failed");
|
|
}
|
|
?>
|