34 lines
893 B
PHP
34 lines
893 B
PHP
<?php
|
|
|
|
// Include the database connection file
|
|
include "../../connect.php";
|
|
|
|
// Filter and validate the phone number input
|
|
$phone_number = filterRequest("phone_number");
|
|
|
|
// Prepare the SQL query using a parameterized query to prevent SQL injection
|
|
$sql = "UPDATE phone_verification SET is_verified = 1 WHERE phone_number = :phone_number";
|
|
|
|
// Prepare the statement
|
|
$stmt = $con->prepare($sql);
|
|
|
|
// Bind the phone number parameter
|
|
$stmt->bindParam(":phone_number", $phone_number);
|
|
|
|
// Execute the query
|
|
$stmt->execute();
|
|
|
|
// Get the number of affected rows
|
|
$affectedRows = $stmt->rowCount();
|
|
|
|
// Check if the update was successful
|
|
if ($affectedRows > 0) {
|
|
// Return a success response
|
|
printSuccess($data = ["message" => "Phone number verified successfully"]);
|
|
} else {
|
|
// Return a failure response
|
|
printFailure($message = "No phone number found or verification failed");
|
|
}
|
|
|
|
?>
|