prepare($sql); $stmt->execute(); $rowCount = $stmt->rowCount(); $admin='support@mobile-app.store'; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; $headers .= "From: $admin" . "\r\n"; $subject = "Verify your email address"; $bodyEmail = "
Hi [$email],
We recently received a request to verify your email address for your account on SEFER App.
To verify your email address, please write this to app .
$tokenIf you did not request to verify your email address, please ignore this email.
Thank you,
SEFER Team. "; if ($rowCount > 0) { // The email already exists, so update the data $sql = "UPDATE `email_verifications` SET `token` = '$token' WHERE `email` = '$email'"; $stmt = $con->prepare($sql); $stmt->execute(); if ($stmt->rowCount() > 0) { // The update was successful jsonSuccess($message = "Email verification data updated successfully"); mail($email, $subject, $bodyEmail, $headers); } else { // The update was unsuccessful jsonError($message = "Failed to update email verification data"); } } else { // The email does not exist, so insert the data $sql = "INSERT INTO `email_verifications` (`email`, `token`) VALUES ('$email', '$token')"; $stmt = $con->prepare($sql); $stmt->execute(); if ($stmt->rowCount() > 0) { // The insertion was successful jsonSuccess($message = "Email verification data saved successfully"); mail($email, $subject, $bodyEmail, $headers); } else { // The insertion was unsuccessful jsonError($message = "Failed to save email verification data"); } } ?>