Exemple #1
0
function newToken($userid, $email, $Safe4Use = false)
{
    $token = getToken(35);
    $pwSQL = "INSERT INTO pwReset (user_id, token) VALUES ({$userid}, '{$token}')\n    ON DUPLICATE KEY UPDATE ts = CURRENT_TIMESTAMP, token = '{$token}'";
    $pwDr = db::executeISql($pwSQL);
    if ($pwDr === false) {
        die('Error Occured Please restart process.');
    }
    $to = $email;
    $from = "noreply@localhost";
    $subject = 'AMS Password Reset';
    $mySig = <<<MESSAGE
<br><br>
<p>
  <i>
    <span style="font-size:8pt">
      "The information contained in the above e-mail message or messages (which include any attachments) may contain confidential, proprietary, or legally privileged information. It is intended only for the use of the person or entity to which it is addressed. If you are not the addressee, any form of disclosure, copying, modification, distribution, or any action taken or omitted in reliance on the information is unauthorized. If you received this communication in error, please notify the sender immediately and delete it from your computer system."&nbsp;
    </span>
  </i>
</p>
MESSAGE;
    $msg = 'A password reset has been initiated for AMS user ' . $email . '<br>' . 'Your reset token is <br> ' . $token . ' <br>and is valid for 20 minutes <br>' . '<br>' . 'Please use the following link/url:<br>' . '<a href="' . curPageURL() . '?email=' . $email . '&token=' . $token . '&reset">' . curPageURL() . '</a>' . '<br>' . '<br>';
    $message = $msg;
    $headers = "From: {$from}" . "\n";
    $semi_rand = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
    $headers .= "MIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
    $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
    $message .= "--{$mime_boundary}\n";
    //not sending emails at this point but should use the ok var to do so.
    $ok = false;
    var_dump($Safe4Use);
    if ($Safe4Use) {
        echo '<pre>' . print_r($msg, true) . '</pre>';
        resetForm($email);
    } else {
        resetForm($email, '', 'You will not be able to complete the password change process at this time.');
    }
    exit;
}
    }
    $_SESSION['h_np'] = $h_np;
    $_SESSION['h_cg'] = $h_cg;
    $_SESSION['margin'] = $margin;
    header("Location: http://127.0.0.1:8080/Aero/longresult.php");
}
$linkchoice = "";
if (isset($_GET['run'])) {
    $linkchoice = $_GET['run'];
}
switch ($linkchoice) {
    case 'dynamic':
        setView2();
        break;
    case 'clear':
        resetForm();
        break;
}
if (isset($_GET['mac']) && isset($_GET['wls']) && isset($_GET['wspan']) && isset($_GET['warea']) && isset($_GET['tmoment']) && isset($_GET['tls']) && isset($_GET['fusewidth']) && isset($_GET['flength']) && isset($_GET['htarea']) && isset($_GET['wsangle']) && isset($_GET['wrchord']) && isset($_GET['wtchord'])) {
    $mac = $_GET['mac'];
    $wls = $_GET['wls'];
    $wspan = $_GET['wspan'];
    $warea = $_GET['warea'];
    $tmoment = $_GET['tmoment'];
    $tls = $_GET['tls'];
    $fusewidth = $_GET['fusewidth'];
    $flength = $_GET['flength'];
    $htarea = $_GET['htarea'];
    $wsangle = $_GET['wsangle'];
    $wrchord = $_GET['wrchord'];
    $wtchord = $_GET['wtchord'];