// -*- C++ -*-
/* ******************************************************************** **
** Copyright (C) 1995-2000 Michael Oertel **
** Copyright (C) 2000- PHPOpenChat Development Team **
** http://www.ortelius.de/phpopenchat/ **
** **
** This program is free software. You can redistribute it and/or modify **
** it under the terms of the PHPOpenChat License Version 1.0 **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY, without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **
** **
** You should have received a copy of the PHPOpenChat License **
** along with this program. **
** ******************************************************************** */
include("defaults_inc.php");
if($sendpwd&&$nickname)
{
include("connect_db_inc.php");
$db_handle=connect_db($DATABASEHOST,$DATABASEUSER,$DATABASEPASSWD);
if(!$db_handle){ exit; }
$nickname = mysql_real_escape_string($nickname, $db_handle);
// check, if user is in the database
$result = mysql_query("SELECT Email,Passwort FROM chat_data WHERE Nick='$nickname'",$db_handle);
$numrows = mysql_num_rows ($result);
if ($numrows == 0) { $status_message = $MSG_SENDPWD_NONICK; }
// get data from database and check, if a password for the user is in the database
if ($status_message == "")
{
$dbdata = mysql_fetch_array($result);
$sendpw_email = $dbdata['Email'];
$sendpw_password =$dbdata['Passwort'];
if ($sendpw_email == "") { $status_message = $MSG_SENDPWD_NOEMAIL; }
}
// all data is okay .. send password to user
if ($status_message == "")
{
include 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->From = "team@schulhofchat.de";
$mail->FromName = "SchulhofChat";
$mail->Host = "schulhofchat.de";
$mail->mailer = 'mail';
$mail->IsMail();
$mail->Hostname = 'schulhofchat.de';
$mail->Subject = $MSG_SENDPWD_SUBJECT;
$mail->Body = $MSG_SENDPWD_MSGTXT.$sendpw_password;
$mail->AltBody = strip_tags(str_replace('
',"\n",$MSG_SENDPWD_MSGTXT.$sendpw_password));
$mail->AddAddress($sendpw_email);
$mail->send();
$status_message = $MSG_SENDPWD_SUCCESS;
$sql = "insert into chat_sendpwd
(nick, cookieuser, host) values
('$nickname','".mysql_real_escape_string($PHPOPENCHAT_USER, $db_handle)."','".$_SERVER['REMOTE_ADDR']."')";
$result = mysql_query($sql,$db_handle);
}
// Output $status_message
echo "
|