Exemplo n.º 1
0
 function recover($mail)
 {
     $dao = new UserDAO();
     $id = $dao->getUserIdByMail($mail);
     if ($id != -1) {
         $user = $dao->selectUserById($id);
         $name = $user->name;
         $pass = $user->password;
         $message = "Dear " . $name . ", Your account password is " . $pass;
         $subject = "Password Recovery Mail";
         $mailSender = new MailSender();
         $mailSender->sendMail("*****@*****.**", $mail, $message, $subject);
     }
     return $id;
 }
Exemplo n.º 2
0
 function sendMail($info)
 {
     foreach ($info as $user) {
         $emailAddr = $user["email"];
         if (isset($emailAddr) && !empty($emailAddr)) {
             date_default_timezone_set('UTC');
             $date = date('F j, Y');
             $textResources = new TextResources('en');
             $serverContext = str_replace('/statusreport.php', '', $_SERVER['SCRIPT_NAME']);
             $pageContext = new PageContext("mail", $textResources, "en", $serverContext);
             $twigVars = array('host' => "http://" . $_SERVER['HTTP_HOST'], 'pageContext' => $pageContext, 'user' => $user, 'date' => $date, 'textResources' => $textResources);
             $message = $this->twig->render('mails/statusreport.twig', $twigVars);
             if (isset($_GET["testMail"])) {
                 MailSender::sendMail($_GET["testMail"], "zSticker Status Update", $message);
             } else {
                 if (isset($_GET["realMail"])) {
                     MailSender::sendMail($emailAddr, "zSticker Status Update", $message);
                 }
             }
             echo "<br/>Sending to: " . $emailAddr . "<br/>" . $message;
         }
     }
 }
Exemplo n.º 3
0
<?php

$user = new User();
$_POST['email'] = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$res = $user->selectByEmail($_POST['email']);
if ($res !== false) {
    echo ReturnCode::$userPresent;
} else {
    $_POST['password'] = Database::encryptString($_POST['password']);
    $user->fillByAssoc($_POST);
    $res = $user->insert();
    if ($res !== false) {
        $body = 'Dear ' . $user->getName() . ',' . PHP_EOL . PHP_EOL . 'Thanks for registering to our service, we wish you a happy user experience.';
        MailSender::sendMail($_POST['email'], 'Welcome to Trizor', $body);
        echo ReturnCode::$success;
    } else {
        echo ReturnCode::$error;
    }
}
Exemplo n.º 4
0
<?php

$_POST['email'] = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$user = new User();
if ($user->selectByEmail($_POST['email'])) {
    $newPassword = uniqid();
    $user->setPassword(Database::encryptString($newPassword));
    if ($user->update()) {
        $body = "Dear " . $user->getName() . ",\r\n\r\n" . "Your password has been reset.\r\n" . "Your new password is: {$newPassword}.\r\n" . "We suggest you to change your password to a more familiar one as soon as possible.\r\n\r\n" . "Have a nice day.\r\n" . "Tripzor Team";
        $res = MailSender::sendMail($user->getEmail(), 'Tripzor Password Reset', $body);
        if (!$res) {
            echo ReturnCode::$mailError;
        } else {
            echo ReturnCode::$success;
        }
        echo $mail->ErrorInfo;
    } else {
        echo ReturnCode::$error;
    }
} else {
    echo ReturnCode::$userNotFound;
}
Exemplo n.º 5
0
<link rel='stylesheet' href='/style/basket-style.css' type='text/css' media='screen, projection' />
<div id="content">
<?php 
if ($payOk == 1) {
    $userInfo = $_SESSION['basketStuff']->getUserInfo();
    $orderInfo = $_SESSION['basketStuff']->getOrderInfo();
    $productStuff = new ProductsStuff();
    $productStuff->addRelatedProducts($orderInfo->orderedProductsInfo);
    if ($userInfo == NULL) {
        header("Location: /index.php/");
    }
    if (!($userInfo->email == '')) {
        $mSender = new MailSender();
        $mSender->sendMail($orderInfo);
    }
    echo "<div id='empty'> Заказ успешно оплачен! </div>";
    $_SESSION['basketStuff']->clear();
} else {
    echo "<div id='empty'> Заказ не был оплачен =( </div>";
}
?>
</div>