Ok so I am practically brand new to php and I have really been working at this hard. I have gotten all my issues worked out and this appears to be the last one. My admin email doesn’t seem to be getting set.
When I test it out from the website through registering a test user the email with the activation link isn’t getting sent out. And I cant figure out why other than that this is causing it.
I could sure use some help. Pretty please and thank you so so much!
I have been beating my head against this all day and I just honestly don’t know what to do to fix it. Im sure its something simple but here I am…
Undefined variable: adminEmail in /home/***/***/forgot_pass.php on line 50
this the code for my forgot password page below is the code from the connect_to_mysql.php code
$outputForUser = "";
if ( isset($_POST['email']) && $_POST['email'] != "" )
{
$email = $_POST['email'];
$email = strip_tags($email);
$email= str_ireplace("`", "", $email);
$email = mysql_real_escape_string($email);
$sql = mysql_query("SELECT * FROM myMembers WHERE email='$email' AND email_activated='1'");
$emailcheck = mysql_num_rows($sql);
if ($emailcheck == 0){
$outputForUser = '<font color="#FF0000">There is no account with that info<br />
in our records, please try again.';
} else {
$emailcut = substr($email, 0, 4); // Takes first four characters from the user email address
$randNum = rand();
$tempPass = "$emailcut$randNum";
$hashTempPass = md5($tempPass);
@mysql_query("UPDATE myMembers SET password='$hashTempPass' WHERE email='$email'") or die("cannot set your new password");
Line 50 $headers = "From: $adminEmail\n"; // $adminEmail is established in [ scripts/connect_to_mysql.php ][/COLOR]$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \n";
$subject ="Login Password Generated";
$body="<div align=center><br>----------------------------- New Login Password --------------------------------<br><br><br>
Your New Password for our site is: <font color=\"#006600\"><u>$tempPass</u></font><br><br />
</div>";
if(mail($email,$subject,$body,$headers)) {
$outputForUser = "<font color=\"#006600\"><strong>Your New Login password has been emailed to you.</strong></font>";
} else {
$outputForUser = '<font color="#FF0000">Password Not Sent.<br /><br />
Please Contact Us...</font>';
}
}
} else {
$outputForUser = 'Enter your email address into the field below.';
}
?>
Here is the the code from my connect_to_mysql.php
<?php
mysql_connect("localhost","***","***") or die (mysql_error());
mysql_select_db("***") or die (mysql_error());?>
When I test it out from the website through registering a test user the email with the activation link isn’t getting sent out. And I cant figure out why other than that this is causing it.
I could sure use some help. Pretty please and thank you so so much!
I have been beating my head against this all day and I just honestly don’t know what to do to fix it. Im sure its something simple but here I am…
Undefined variable: adminEmail in /home/***/***/forgot_pass.php on line 50
this the code for my forgot password page below is the code from the connect_to_mysql.php code
$outputForUser = "";
if ( isset($_POST['email']) && $_POST['email'] != "" )
{
$email = $_POST['email'];
$email = strip_tags($email);
$email= str_ireplace("`", "", $email);
$email = mysql_real_escape_string($email);
$sql = mysql_query("SELECT * FROM myMembers WHERE email='$email' AND email_activated='1'");
$emailcheck = mysql_num_rows($sql);
if ($emailcheck == 0){
$outputForUser = '<font color="#FF0000">There is no account with that info<br />
in our records, please try again.';
} else {
$emailcut = substr($email, 0, 4); // Takes first four characters from the user email address
$randNum = rand();
$tempPass = "$emailcut$randNum";
$hashTempPass = md5($tempPass);
@mysql_query("UPDATE myMembers SET password='$hashTempPass' WHERE email='$email'") or die("cannot set your new password");
Line 50 $headers = "From: $adminEmail\n"; // $adminEmail is established in [ scripts/connect_to_mysql.php ][/COLOR]$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \n";
$subject ="Login Password Generated";
$body="<div align=center><br>----------------------------- New Login Password --------------------------------<br><br><br>
Your New Password for our site is: <font color=\"#006600\"><u>$tempPass</u></font><br><br />
</div>";
if(mail($email,$subject,$body,$headers)) {
$outputForUser = "<font color=\"#006600\"><strong>Your New Login password has been emailed to you.</strong></font>";
} else {
$outputForUser = '<font color="#FF0000">Password Not Sent.<br /><br />
Please Contact Us...</font>';
}
}
} else {
$outputForUser = 'Enter your email address into the field below.';
}
?>
Here is the the code from my connect_to_mysql.php
<?php
mysql_connect("localhost","***","***") or die (mysql_error());
mysql_select_db("***") or die (mysql_error());?>
Last edited: