$page->smarty->assign('email', $_POST['email']); if ($_POST['email'] == "") { $page->smarty->assign('error', "Missing Email"); } else { // Check users exists and send an email. $ret = $page->users->getByEmail($_POST['email']); if (!$ret) { $page->smarty->assign('sent', "true"); break; } else { // Generate a forgottenpassword guid, store it in the user table. $guid = md5(uniqid()); $page->users->updatePassResetGuid($ret["id"], $guid); // Send the email $to = $ret["email"]; $subject = $page->settings->getSetting('title') . " Forgotten Password Request"; $contents = "Someone has requested a password reset for this email address.<br>To reset the password use <a href=\"" . $page->serverurl . "forgottenpassword?action=reset&guid={$guid}\">this link</a>\n"; $page->smarty->assign('sent', "true"); Utility::sendEmail($to, $subject, $contents, $page->settings->getSetting('email')); break; } } } break; } $page->title = "Forgotten Password"; $page->meta_title = "Forgotten Password"; $page->meta_keywords = "forgotten,password,signup,registration"; $page->meta_description = "Forgotten Password"; $page->content = $page->smarty->fetch('forgottenpassword.tpl'); $page->render();
<?php use nzedb\utility\Utility; use nzedb\Captcha; $captcha = new Captcha($page); if (isset($_POST["useremail"])) { if ($captcha->getError() === false) { // Send the contact info and report back to user. $email = $_POST["useremail"]; $mailto = $page->settings->getSetting('email'); $mailsubj = "Contact Form Submitted"; $mailbody = "Values submitted from contact form:<br/>"; //@TODO take this loop out, it's not safe. while (list($key, $val) = each($_POST)) { if ($key != 'submit') { $mailbody .= "{$key} : {$val}<br/>"; } } if (!preg_match("/\n/i", $_POST["useremail"])) { Utility::sendEmail($mailto, $mailsubj, $mailbody, $email); } $page->smarty->assign("msg", "<h2 style='text-align:center;'>Thank you for getting in touch with " . $page->settings->getSetting('title') . ".</h2>"); } } $page->title = "Contact " . $page->settings->getSetting('title'); $page->meta_title = "Contact " . $page->settings->getSetting('title'); $page->meta_keywords = "contact us,contact,get in touch,email"; $page->meta_description = "Contact us at " . $page->settings->getSetting('title') . " and submit your feedback"; $page->content = $page->smarty->fetch('contact.tpl'); $page->render();
/** * Send a email for a invitation request. * * @param string $siteTitle Name of the admin's website. * @param string $siteEmail Email of the admin's website. * @param string $serverURL Address of the admin's website. * @param int $userID ID of the user sending the request. * @param string $emailTo Email of the person to send the request. * * @return string */ public function sendInvite($siteTitle, $siteEmail, $serverURL, $userID, $emailTo) { $sender = $this->getById($userID); $token = $this->hashSHA1(uniqid()); $subject = $siteTitle . " Invitation"; $url = $serverURL . "register?invitecode=" . $token; if (!is_null($sender['firstname']) || $sender['firstname'] != '') { $contents = $sender["firstname"] . " " . $sender["lastname"] . " has sent an invite to join " . $siteTitle . " to this email address.<br>To accept the invitation click <a href=\"{$url}\">this link</a>\n"; } else { $contents = $sender["username"] . " has sent an invite to join " . $siteTitle . " to this email address.<br>To accept the invitation click <a href=\"{$url}\">this link</a>\n"; } Utility::sendEmail($emailTo, $subject, $contents, $siteEmail); $this->addInvite($userID, $token); return $url; }