wachtwoord terug halen!
Use of undefined constant MAIL_FROM - assumed 'MAIL_FROM' in ?:\??\??\????r\???\classes\system.php:515
hier de scriptj:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
//////////////////////////////////////////////////////////////////////
// Send forgot password email
//////////////////////////////////////////////////////////////////////
function sendForgotPasswordEmail($email) {
$email = addslashes($_POST["email"]);
if ($email == "")
die("Error: Empty e-mail address");
$query = "SELECT * FROM tb_empire WHERE email='$email'";
$rs = $this->DB->Execute($query);
if (!$rs->EOF) {
$newpassword = $this->generatePassword();
$activation_hash = md5(time(NULL) . $email);
$mail = new PHPMailer();
$mail->From = MAIL_FROM;
$mail->FromName = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
$mail->Host = MAIL_SMTP;
$mail->Mailer = "smtp";
$mail->AddAddress($email);
$mail->Body = str_replace("{password}", $newpassword, TPL_MAIL_CONTENT_FORGETPASSWORD);
$mail->Subject = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
if (!$mail->Send())
die("Error while sending email, retry or contact administrator");
$query = "UPDATE tb_empire SET password='" . md5($newpassword) . "' WHERE email='$email'";
$DB->Execute($query);
return true;
}
}
?>
//////////////////////////////////////////////////////////////////////
// Send forgot password email
//////////////////////////////////////////////////////////////////////
function sendForgotPasswordEmail($email) {
$email = addslashes($_POST["email"]);
if ($email == "")
die("Error: Empty e-mail address");
$query = "SELECT * FROM tb_empire WHERE email='$email'";
$rs = $this->DB->Execute($query);
if (!$rs->EOF) {
$newpassword = $this->generatePassword();
$activation_hash = md5(time(NULL) . $email);
$mail = new PHPMailer();
$mail->From = MAIL_FROM;
$mail->FromName = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
$mail->Host = MAIL_SMTP;
$mail->Mailer = "smtp";
$mail->AddAddress($email);
$mail->Body = str_replace("{password}", $newpassword, TPL_MAIL_CONTENT_FORGETPASSWORD);
$mail->Subject = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
if (!$mail->Send())
die("Error while sending email, retry or contact administrator");
$query = "UPDATE tb_empire SET password='" . md5($newpassword) . "' WHERE email='$email'";
$DB->Execute($query);
return true;
}
}
?>
wat is hier nu fout ???????
Gewijzigd op 01/01/1970 01:00:00 door M Rodrigo
MAIL_FROM is niet gedefineert, dus het heeft geen waarde.
Gewijzigd op 01/01/1970 01:00:00 door M Rodrigo
Je moet de functie define() hebben. Hiermee kun je een constante definiëren. In jouw geval:
define('MAIL_FROM', '[email protected]');
Use of undefined constant MAIL_SMTP - assumed 'MAIL_SMTP' in ?:\???\???\?????\?????\classes\system.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
//////////////////////////////////////////////////////////////////////
// Send forgot password email
//////////////////////////////////////////////////////////////////////
function sendForgotPasswordEmail($email) {
$email = addslashes($_POST["email"]);
if ($email == "")
die("Error: Empty e-mail address");
$query = "SELECT * FROM tb_empire WHERE email='$email'";
$rs = $this->DB->Execute($query);
if (!$rs->EOF) {
$newpassword = $this->generatePassword();
$activation_hash = md5(time(NULL) . $email);
$mail = new PHPMailer();
define('MAIL_FROM','[email protected]');
$mail->FromName = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
$mail->Host = MAIL_SMTP;
$mail->Mailer = "smtp";
$mail->AddAddress($email);
$mail->Body = str_replace("{password}", $newpassword, TPL_MAIL_CONTENT_FORGETPASSWORD);
$mail->Subject = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
if (!$mail->Send())
die("Error while sending email, retry or contact administrator");
$query = "UPDATE tb_empire SET password='" . md5($newpassword) . "' WHERE email='$email'";
$DB->Execute($query);
return true;
}
}
?>
//////////////////////////////////////////////////////////////////////
// Send forgot password email
//////////////////////////////////////////////////////////////////////
function sendForgotPasswordEmail($email) {
$email = addslashes($_POST["email"]);
if ($email == "")
die("Error: Empty e-mail address");
$query = "SELECT * FROM tb_empire WHERE email='$email'";
$rs = $this->DB->Execute($query);
if (!$rs->EOF) {
$newpassword = $this->generatePassword();
$activation_hash = md5(time(NULL) . $email);
$mail = new PHPMailer();
define('MAIL_FROM','[email protected]');
$mail->FromName = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
$mail->Host = MAIL_SMTP;
$mail->Mailer = "smtp";
$mail->AddAddress($email);
$mail->Body = str_replace("{password}", $newpassword, TPL_MAIL_CONTENT_FORGETPASSWORD);
$mail->Subject = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
if (!$mail->Send())
die("Error while sending email, retry or contact administrator");
$query = "UPDATE tb_empire SET password='" . md5($newpassword) . "' WHERE email='$email'";
$DB->Execute($query);
return true;
}
}
?>
wat is er nu weer aan de hand ???
MAIL_SMTP is ook niet gedefineerd. Zelfde regel als Herjan alleen dan met MAIL_SMTP en waarde localhost (vermoed ik).
Precies hetzelfde, alleen nu bij MAIL_SMTP: Je gebruikt een constante die niet gedefinieerd is...
Undefined variable: DB in ?:\???\???\????\??????\classes\system.php:36
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
//////////////////////////////////////////////////////////////////////
// Send forgot password email
//////////////////////////////////////////////////////////////////////
function sendForgotPasswordEmail($email) {
$email = addslashes($_POST["email"]);
if ($email == "")
die("Error: Empty e-mail address");
$query = "SELECT * FROM tb_empire WHERE email='$email'";
$rs = $this->DB->Execute($query);
if (!$rs->EOF) {
$newpassword = $this->generatePassword();
$activation_hash = md5(time(NULL) . $email);
$mail = new PHPMailer();
define('MAIL_FROM','[email protected]');
$mail->FromName = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
define('Host','localhost');
$mail->Mailer = "smtp";
$mail->AddAddress($email);
$mail->Body = str_replace("{password}", $newpassword, TPL_MAIL_CONTENT_FORGETPASSWORD);
$mail->Subject = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
if (!$mail->Send())
die("Error while sending email, retry or contact administrator");
$query = "UPDATE tb_empire SET password='" . md5($newpassword) . "' WHERE email='$email'";
$DB->Execute($query);
return true;
}
}
?>
//////////////////////////////////////////////////////////////////////
// Send forgot password email
//////////////////////////////////////////////////////////////////////
function sendForgotPasswordEmail($email) {
$email = addslashes($_POST["email"]);
if ($email == "")
die("Error: Empty e-mail address");
$query = "SELECT * FROM tb_empire WHERE email='$email'";
$rs = $this->DB->Execute($query);
if (!$rs->EOF) {
$newpassword = $this->generatePassword();
$activation_hash = md5(time(NULL) . $email);
$mail = new PHPMailer();
define('MAIL_FROM','[email protected]');
$mail->FromName = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
define('Host','localhost');
$mail->Mailer = "smtp";
$mail->AddAddress($email);
$mail->Body = str_replace("{password}", $newpassword, TPL_MAIL_CONTENT_FORGETPASSWORD);
$mail->Subject = LANG_FORGOTPASSWORD_MAIL_SUBJECT;
if (!$mail->Send())
die("Error while sending email, retry or contact administrator");
$query = "UPDATE tb_empire SET password='" . md5($newpassword) . "' WHERE email='$email'";
$DB->Execute($query);
return true;
}
}
?>
(en bij define('mail_from',[email protected]) in plaats van de email moet toch staan $email omdat hij de emails van de database moet halen of heb ik het fout)
Kortom, de variabele $DB bestaat niet. Waarschijnlijk heb je die dus nog nergens aangemaakt...