Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "";
- $password = "";
- $database = "";
- //Variables submitted by the users
- $userToPost = $_POST["userToPost"];
- // Create connection
- $conn = new mysqli($servername, $username, $password, $database);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT email FROM users WHERE username = '" . $userToPost . "'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- $userEmail = $row["email"];
- }
- }
- $sql = "SELECT otp FROM users WHERE username = '" . $userToPost . "'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- $userVerificationOtp = $row["otp"];
- }
- }
- $hashedOTP = password_hash($userVerificationOtp, PASSWORD_DEFAULT);
- ini_set( 'display errors', 1);
- error_reporting(E_ALL);
- $to = $userEmail;
- $subject = "OTP - Verification ( TOUR PUO V2 )";
- $message = '
- GEMENTAR TOUR PUO V2 EMAIL VERIFICATION
- Click link below to verify
- HIDDEN =' . $userEmail . '&otp=' . $hashedOTP . '
- ';
- $headers = "From:" . $from;
- mail($to,$subject,$message,$headers);
- echo "The Email Message was successfully sent.";
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement