$get_last_mid = "SELECT mid from Mothers where email = '" . $_POST['email'] . "';";
                 if (!$get_last_mid) {
                     $_SESSION['AccountMessage'] = "Mother " . $_POST['email'] . " not added successfully.";
                 } else {
                     $result_get_last_mid = mysql_query($get_last_mid);
                     $row_get = mysql_fetch_array($result_get_last_mid);
                     $_SESSION['linked_mid'] = $row_get['mid'];
                     $link_query = "INSERT INTO Mothers_Scientists(sid,mid) VALUES('" . $_SESSION['sid'] . "','" . $_SESSION['linked_mid'] . "');";
                     mysql_query($link_query);
                     if ($_POST["name"]) {
                         $name_query = "INSERT INTO MotherInfo (mid,Name) VALUES(" . $_SESSION['linked_mid'] . ",'" . $_POST['name'] . "');";
                         mysql_query($name_query);
                     }
                     $_SESSION['AccountMessage'] = "Mother " . $_POST['email'] . " added successfully.";
                     $_SESSION['AccountType'] = 1;
                     $mail = generatePassMail($_POST['email'], "New Mother Account", $pass, "You will be prompted to change the password as soon as you log in. If you are not, you can change it by going to the profile tab, and selecting the Change Password option. <br /><br />Click the following link to login to <a href='https://lactor.org/'>Lactor</a>.");
                 }
             }
         }
     }
     $_SESSION['AccountDisplay'] = 1;
 } else {
     if (isset($_POST['proxy'])) {
         $_SESSION['mid'] = $_POST['mid'];
         $_SESSION['s_mid'] = 1;
         header("Location: http://www.lactor.org/add_entry.php");
         exit;
     } else {
         if (isset($_POST['info'])) {
             $_SESSION['s_mid'] = $_POST['mid'];
             $_SESSION['AccountDisplay'] = 3;
<?php

//TODO: unexistant user.
include_once "../../includes/general.php";
include_once "../../includes/db.include.php";
include_once "../../includes/mail.include.php";
db_connect();
$_SESSION['reset_email'] = mysql_real_escape_string($_POST['email']);
if (trim($_POST["email"]) == "") {
    $_SESSION['ResetMessage'] = "You must input an email address.\n";
    $_SESSION['ResetType'] = 3;
    $_SESSION['ResetDetails'] = $_SESSION['ResetDetails'] . "Input your email address so we can send you your password.<br />";
    go("../reset_pass.php");
}
$newpassdisplay = genRandomString();
$newpass = mysql_real_escape_string(md5($newpassdisplay));
//update
$query = "UPDATE Scientists SET password = '******', loginstep = 1 WHERE  email = '" . $_SESSION['reset_email'] . "';";
$result = mysql_query($query);
$mail = generatePassMail($_SESSION['reset_email'], "Password Reset", $newpassdisplay, "You will be prompted to change the password as soon as you log in.");
$_SESSION['LoginMessage'] = "Password reset successful.";
$_SESSION['LoginDetails'] = "An email was sent to " . $_SESSION['reset_email'] . " with a new password. You will be asked to change the password upon your first login.";
$_SESSION['LoginType'] = 1;
go("../login.php");
?>
 
include_once "../includes/general.php";
include_once "../includes/db.include.php";
include_once "../includes/mail.include.php";
db_connect();
$_SESSION['reset_email'] = mysql_real_escape_string($_POST['email']);
if (trim(@$_POST["email"]) == "") {
    $_SESSION['ResetMessage'] = "You must enter an email address.\n";
    $_SESSION['ResetDetails'] = $_SESSION['ResetDetails'] . "Enter your email address so we can send you your password.<br />";
    $_SESSION['ResetType'] = 3;
    go("../reset_pass.php");
}
$newpassdisplay = genRandomString();
$newpass = mysql_real_escape_string(md5($newpassdisplay));
//update
$query = "SELECT * FROM Mothers WHERE email = '" . $_SESSION['reset_email'] . "';";
$result = mysql_query($query);
$ls = "2";
$row = mysql_fetch_array($result);
if ($row['loginstep'] == 1) {
    $ls = "1";
}
$query = "UPDATE Mothers SET password = '******', loginstep = " . $ls . " WHERE  email = '" . $_SESSION['reset_email'] . "';";
$result = mysql_query($query);
$mail = generatePassMail($_SESSION['reset_email'], "Password Reset", $newpassdisplay, "You will be prompted to change the password as soon as you log in. If you are not, you can change it by going to the profile tab, and selecting the Change Password option.");
$_SESSION['LoginMessage'] = "Password reset successful for " . $_POST["email"] . ".";
$_SESSION['LoginDetails'] = "An email was sent to " . $_SESSION['reset_email'] . " with a new password. You will be asked to change the password upon your first login.";
$_SESSION['LoginType'] = 1;
go("../login.php");
?>