include "../includes/header.php"; // init $feedback = ""; $ok_record_id = $_SESSION["staff_id"]; ////////////////// // Record View ////////////////// if (isset($_POST["submit_record"])) { // Submit form $record = new Staff($_POST["staff_id"], "post", TRUE); ////////////////////////////////// // Is this an insert or an update? ////////////////////////////////// if ($_POST["staff_id"] == "") { $record->insertRecord(); $ok_record_id = $record->getRecordId(); } else { $record->updateRecord("brief"); } // Show feedback $feedback = $record->getMessage(); // See query? //$record->deBug(); } else { ///////////////////// // Start the record display //////////////////// $record = new Staff($ok_record_id, '', TRUE); // show feedback if it isn't already set if (!$feedback) { $feedback = $record->getMessage();
<?php require_once "includes/config.php"; require_once "includes/functions.php"; use SubjectsPlus\Control\Querier; use SubjectsPlus\Control\Staff; $db = new Querier(); $lstrForm = ''; if (!isset($_GET['id'])) { if (isset($_POST['email'])) { $lobjStaff = new Staff('', 'forgot'); if ($lobjStaff->getRecordId() == NULL) { $introtext = "<p align=\"center\" style=\"clear: both;\" class=\"smaller\"><br />" . _("{$lobjStaff->getMessage()}") . "</p>"; $lstrForm = $lobjStaff->outputEmailForm(); } else { $lobjTodayDate = new DateTime(); //The code is a hased string composed of the user's email, installation's salt, and today's date MMDDYYYY $lstrCode = md5($lobjStaff->getEmail() . $salt . $lobjTodayDate->format('mdY')); $lstrMessage = "Hello {$lobjStaff->getFullName()},\n\nHere is the link to reset your password. Link only works for three days. {$BaseURL}control/forgotpassword.php?id={$lobjStaff->getRecordID()}&code={$lstrCode}"; mail($lobjStaff->getEmail(), 'Reset password for SubjectsPlus', $lstrMessage, "From: {$administrator_email}"); $introtext = "<p align=\"center\" style=\"clear: both;\" class=\"smaller\"><br /><strong>" . _("An email has been sent to reset your password. Please click the link in the email and follow the instructions.") . "</strong></p>"; } } else { $lobjStaff = new Staff(); $introtext = "<p align=\"center\" style=\"clear: both;\" class=\"smaller\"><br />" . _("Please enter your <strong>email</strong> so we can email you a link to reset your password.") . "</p>"; $lstrForm = $lobjStaff->outputEmailForm(); } } else { $_SESSION['staff_id'] = $_GET['id']; $lobjStaff = new Staff($_GET['id']); if (isset($_POST['password'])) {