Anonymous - 2002-07-23

hi
i did a little patch on the chat system. you can get an email notification when somebody enters the chat. youll be sent a mail with the username and ip adress.

just edit the file index.lib.php3.

search the following block and enter the lines  (TWICE!) seperated by a blank line here.
you got to insert your mail and yourt_domain

if (C_WELCOME)
{
// Delete old welcome messages sent to the current user
$DbLink->query("DELETE FROM ".C_MSG_TBL." WHERE username = 'SYS welcome' AND address = '$U'");
// Insert a new welcome message in the messages table
include("./${ChatPath}lib/welcome.lib.php3");
$current_time_plus = $current_time + 1; // ensures the welcome msg is the last one
$DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS welcome', '', '$current_time_plus', '$U', 'sprintf(\"".WELCOME_MSG."\")')");

$empfaenger = "your_mail@your_domain.com";
$betreff = "$U has enterd the chat";
$text = "$U has enterd the chat with ip $IP .";
mail($empfaenger, $betreff, $text, "From: your_mai@your_domain.com");

};
};
}
// In the case of an user that logs again in the same room because of the resize bug of NN4+
// update his logging time and his IP address
elseif (isset($Reload) && $Reload == "NNResize")
{
$DbLink->query("UPDATE ".C_USR_TBL." SET room='$R',u_time='$current_time', ip='$IP' WHERE username='$U'");
}
// For all other case of users entering in, set user infos. in users table and put a
// notification message of entrance in the messages table
else
{
$DbLink->query("INSERT INTO ".C_USR_TBL." VALUES ('$R', '$U', '$Latin1', '$current_time', '$status','$IP')");
$DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS enter', '', '$current_time', '', 'sprintf(L_ENTER_ROM, \"".special_char($U,$Latin1)."\")')");
if (C_WELCOME)
{
// Delete old welcome messages sent to the current user
$DbLink->query("DELETE FROM ".C_MSG_TBL." WHERE username = 'SYS welcome' AND address = '$U'");
// Insert a new welcome message in the messages table
include("./${ChatPath}lib/welcome.lib.php3");
$current_time_plus = $current_time + 1; // ensures the welcome msg is the last one
$DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS welcome', '', '$current_time_plus', '$U', 'sprintf(\"".WELCOME_MSG."\")')");

$empfaenger = "your_mail@your_domain.com";
$betreff = "$U has enterd the chat";
$text = "$U has enterd the chat with ip $IP .";
mail($empfaenger, $betreff, $text, "From: your_mai@your_domain.com");

};
};

till