Hey guys, hopefully someone out there can help me with this one. I want an email notification sent every time a user logs into my site. Right now I get an email however it doesn't tell me what user has logged in. the script is below. All I get is "$un has logged into the ***** website." PLEASE HELP!?!?!
<?php
session_start();
require_once 'classes/Membership.php';
$membership = new Membership();
// If the user clicks the "Log Out" link on the index page.
if(isset($_GET['status']) && $_GET['status'] == 'loggedout') {
$membership->log_User_Out();
}
// Did the user enter a password/username and click submit?
if($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])) {
$response = $membership->validate_User($_POST['username'], $_POST['pwd']);
}
if($_POST)
{
$un = $_POST['username'];
$to = 'myemail@email.com';
$subject = 'Login Instance at *****';
$headers = 'From: DO NOT REPLY <donotreply@*****.com>';
$message = '$un has logged into the ***** website.';
mail($to, $subject, $message, $headers);
}?>