Hi all.
I made a Retrieve Password page.
The field is called “user_email”. User types in their email and the code checks to see if that email exists.
If it does I need it to send that user an email with their login and password.
Now… this system allows a user to have multiple account associated with the same email (admins need to access different school accounts)
So in the On Validate code I attempted to call the sql and create an array of login information that gets put into the Message of the email
Here is what I have… all it does is pull the first record, when there are actually 5 records.
I have tried sc_select but it throws errors like mad, the other resource on SC and arrays are all button related.
//ON VALIDATE EVENT CODE
$user_email = trim(sc_sql_injection({user_email}));
$sql = "SELECT usersid ,user_email
FROM users WHERE user_email = ".$user_email;
sc_lookup(rs, $sql);
if (isset({rs[0][0]})) //row found
{
$my_email = {rs[0][1]};
$message = “You have recently requested your login information” ."
";
//create the array
$accounts=array();
$sql= "SELECT
schools.school_name,
users1.user_login,
users1.user_password,
users_sec_levels.sec_level_name
FROM users1
LEFT JOIN schools ON users.user_schoolid = schools.schoolid
LEFT JOIN users_sec_levels ON users.user_seclevel = users_sec_levels.seclevelsid
WHERE users1.user_email = $user_email AND users1.user_seclevel <> 99 ";
sc_lookup(lookup, $sql);
if (isset({lookup[0][0]})) // Row found
{
$school = {lookup[0][0]};
$login = {lookup[0][1]};
$pw = {lookup[0][2]};
$sec = {lookup[0][3]};
///add to the array
$accounts[]=$school.’:’.‘Login=’.$login.’ Password=’.$pw;
}
$work = implode("
“,$accounts);
$message.=”
".$work;
}
else
{
$message = “Your email is not in our system. Try a different email or contact your school administrator " .”
";
$my_email = $user_email;
}
//send the email
////////
$to = $my_email;
//echo"name=$name<br>";
$subject = “Request for Login Information”;
$from = “me@myemail.com”;
$additional_headers = “From: $from
Reply-To: $from
“;
$additional_headers .= “Content-type: text/plain;”;
echo”$message<br>”;
Any ideas? I dont need a code rewrite… just point me in the right direction Thanks!