Sender ikke mail!
Mit glemt password script virker ikke som det skal, det sender ikke brugeren en mail med den nye adgangskode, men den opdaterer adgangskoden i databasenNogle forslag?
Her er koden:
<?php // File: $Id: user.php,v 1.3 2003/07/04 07:28:38 larsneo Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// 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. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of this file:
// Purpose of this file: mail a new password if forgotten
// ----------------------------------------------------------------------
$ModName = basename( dirname( __FILE__ ) );
modules_get_language();
function lostpassword_user_lostpassscreen()
{
include 'header.php';
$host_name = getenv("REMOTE_ADDR");
OpenTable();
echo "<font class=\"pn-title\">"._PASSWORDLOST."</font><br><br>\n"
."<font class=\"pn-normal\">"._NOPROBLEM." <br />Advarsel! Din ip-adresse ($host_name) bliver gemt!</font><br>\n"
."<form action=\"user.php\" method=\"post\">\n"
."<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">\n"
."<tr>\n"
."<td><font class=\"pn-normal\">Email: </font></td><td><input type=\"text\" name=\"uname\" size=\"60\" maxlength=\"60\"></td></tr>"
."<tr><td><font class=\"pn-normal\"></font></td><td><input type=\"hidden\" name=\"email\" size=\"60\" maxlength=\"60\"></td>\n"
."</tr>\n"
."</table>\n"
."<input type=\"hidden\" name=\"op\" value=\"mailpasswd\">\n"
."<input type=\"hidden\" name=\"module\" value=\"NS-LostPassword\">\n"
."<input type=\"submit\" value=\""._SENDPASSWORD."\">\n"
."</form>\n";
CloseTable();
include 'footer.php';
}
function lostpassword_user_mailpasswd()
{
list($uname,
$email)= pnVarCleanFromInput('uname',
'email');
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$sitename = pnConfigGetVar('sitename');
$system = pnConfigGetVar('system');
$adminmail = pnConfigGetVar('adminmail');
$column = &$pntable['users_column'];
$wheres = array();
if (!empty($email)) {
$wheres[] = "$column[email] = '".pnVarPrepForStore($email)."'";
$who = $email;
}
if (!empty($uname)) {
$wheres[] = "$column[uname] = '".pnVarPrepForStore($uname)."'";
$who = $uname;
}
$where = join('AND ', $wheres);
$result = $dbconn->Execute("SELECT $column[uname],
$column[email],
$column[pass]
FROM $pntable[users]
WHERE $where");
if (($dbconn->ErrorNo() != 0) || ($result->numRows() == 0)) {
include 'header.php';
OpenTable();
echo "<center><font class=\"pn-normal\">"._SORRYNOUSERINFO."</center></font>";
CloseTable();
include 'footer.php';
} else {
$host_name = getenv("REMOTE_ADDR");
list($uname, $email, $pass) = $result->fields;
$areyou = substr($pass, 0, 5);
$newpass=makepass();
$message = "En bruger på E-guiden.dk har lige bedt om nyt password til din konto. \n\nDit nye password er: $newpass\n\n Du kan logge ind på: ". pnGetBaseURL() . "index.php\n\n";
$subject = "Nyt password til $uname på E-guiden.dk";
pnMail($email, $subject, $message, "From: $adminmail\nX-Mailer: PHP/" . phpversion());
// Next step: add the new password to the database
$cryptpass = md5($newpass);
$column = &$pntable['users_column'];
$query = "UPDATE $pntable[users] SET $column[pass]='".pnVarPrepForStore($cryptpass)."' WHERE $column[uname]='".pnVarPrepForStore($uname)."'";
$result = $dbconn->Execute($query);
if($dbconn->ErrorNo()<>0) {
echo "<font class=\"pn-title\">"._UPDATEFAILED."</font>";
}
include 'header.php';
OpenTable();
echo "<center><font class=\"pn-title\">"._PASSWORD4." ".pnVarPrepForDisplay($uname)." "._MAILED."</center></font>";
CloseTable();
include 'footer.php';
// If no Code, send it
}
}
?>
sikkert bare en kommafejl et sted eller noget, men kan ikke finde det.
