sendMail() публичный Метод

The main mail sending method, this simply calls a certain mail sending method depending on which mail provider you've selected in the application's config.
public sendMail ( $user_email, $from_email, $from_name, $subject, $body ) : boolean
$user_email string email
$from_email string sender's email
$from_name string sender's name
$subject string subject
$body string full mail body text
Результат boolean the success status of the according mail sending method
 public function sample3()
 {
     $data = array('John', '*****@*****.**', 'Sydney, NSW', 'Australia', 12, 06, 1980, '02 123 45678', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
     $template_html = 'sample-3.txt';
     $mail = new Mail();
     $mail->setMailBody($data, $template_html, 'TEXT');
     $mail->sendMail('Test Sample 3 Text Plain Template Format');
     exit('Email Sample 3');
 }
Пример #2
0
 /**
  * Send the password reset mail
  *
  * @param string $user_name username
  * @param string $user_password_reset_hash password reset hash
  * @param string $user_email user email
  *
  * @return bool success status
  */
 public static function sendPasswordResetMail($user_name, $user_password_reset_hash, $user_email)
 {
     // create email body
     $body = Config::get('EMAIL_PASSWORD_RESET_CONTENT') . ' ' . Config::get('URL') . Config::get('EMAIL_PASSWORD_RESET_URL') . '/' . urlencode($user_name) . '/' . urlencode($user_password_reset_hash);
     // create instance of Mail class, try sending and check
     $mail = new Mail();
     $mail_sent = $mail->sendMail($user_email, Config::get('EMAIL_PASSWORD_RESET_FROM_EMAIL'), Config::get('EMAIL_PASSWORD_RESET_FROM_NAME'), Config::get('EMAIL_PASSWORD_RESET_SUBJECT'), $body);
     if ($mail_sent) {
         Session::add('feedback_positive', Text::get('FEEDBACK_PASSWORD_RESET_MAIL_SENDING_SUCCESSFUL'));
         return true;
     }
     Session::add('feedback_negative', Text::get('FEEDBACK_PASSWORD_RESET_MAIL_SENDING_ERROR') . $mail->getError());
     return false;
 }
Пример #3
0
 public function AddUser()
 {
     global $mysqli, $emailActivation, $websiteUrl, $db_table_prefix;
     //Prevent this function being called if there were construction errors
     if ($this->status) {
         //Construct a secure hash for the plain text password
         $secure_pass = generateHash($this->clean_password);
         //Construct a unique activation token
         $this->activation_token = generateActivationToken();
         //Do we need to send out an activation email?
         if ($emailActivation == "true") {
             //User must activate their account first
             $this->user_active = 0;
             $mail = new Mail();
             //Build the activation message
             $activation_message = lang("ACCOUNT_ACTIVATION_MESSAGE", array($websiteUrl, $this->activation_token));
             //Define more if you want to build larger structures
             $hooks = array("searchStrs" => array("#ACTIVATION-MESSAGE", "#ACTIVATION-KEY", "#USERNAME#"), "subjectStrs" => array($activation_message, $this->activation_token, $this->displayname));
             /* Build the template - Optional, you can just use the sendMail function 
             			Instead to pass a message. */
             if (!$mail->newTemplateMsg("new-registration.txt", $hooks)) {
                 $this->mail_failure = true;
             } else {
                 //Send the mail. Specify users email here and subject.
                 //SendMail can have a third parementer for message if you do not wish to build a template.
                 if (!$mail->sendMail($this->clean_email, "New User")) {
                     $this->mail_failure = true;
                 }
             }
             $this->success = lang("ACCOUNT_REGISTRATION_COMPLETE_TYPE2");
         } else {
             //Instant account activation
             $this->user_active = 1;
             $this->success = lang("ACCOUNT_REGISTRATION_COMPLETE_TYPE1");
         }
         if (!$this->mail_failure) {
             //Insert the user into the database providing no errors have been found.
             $stmt = $mysqli->prepare("INSERT INTO " . $db_table_prefix . "users (\n\t\t\t\t\tuser_name,\n\t\t\t\t\tdisplay_name,\n\t\t\t\t\tpassword,\n\t\t\t\t\temail,\n\t\t\t\t\tactivation_token,\n\t\t\t\t\tlast_activation_request,\n\t\t\t\t\tlost_password_request, \n\t\t\t\t\tactive,\n\t\t\t\t\ttitle,\n\t\t\t\t\tsign_up_stamp,\n\t\t\t\t\tlast_sign_in_stamp\n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t'" . time() . "',\n\t\t\t\t\t'0',\n\t\t\t\t\t?,\n\t\t\t\t\t'New Member',\n\t\t\t\t\t'" . time() . "',\n\t\t\t\t\t'0'\n\t\t\t\t\t)");
             $stmt->bind_param("sssssi", $this->username, $this->displayname, $secure_pass, $this->clean_email, $this->activation_token, $this->user_active);
             $stmt->execute();
             $inserted_id = $mysqli->insert_id;
             $stmt->close();
             //Insert default permission into matches table
             $stmt = $mysqli->prepare("INSERT INTO " . $db_table_prefix . "user_permission_matches  (\n\t\t\t\t\tuser_id,\n\t\t\t\t\tpermission_id\n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t?,\n\t\t\t\t\t'1'\n\t\t\t\t\t)");
             $stmt->bind_param("s", $inserted_id);
             $stmt->execute();
             $stmt->close();
         }
     }
 }
Пример #4
0
 /**
  * Envoi un email
  * @return object 2 attributs, bool success et array string msg
  */
 public function sendMail()
 {
     $resCheck = $this->check();
     $res = $resCheck;
     if ($resCheck->success === true) {
         $param = array('pseudo' => 'Admin', 'pseudoExpediteur' => $this->pseudo, 'emailExpediteur' => $this->email, 'sujet' => $this->sujet, 'message' => nl2br($this->message));
         $mail = new Mail(DESTINATAIRE_MAIL_CONTACT, '[Technote] Contact', 'mail_contact.twig', $param);
         $resMail = $mail->sendMail();
         $res->success = $resCheck->success && $resMail->success;
         $res->msg = array_merge($res->msg, $resMail->msg);
         if ($resMail->success === true && !empty($_SESSION['user'])) {
             $actionDAO = new ActionDAO(BDD::getInstancePDO());
             $action = new Action(array('id_action' => DAO::UNKNOWN_ID, 'libelle' => 'Contact par formulaire', 'id_membre' => $_SESSION['user']->id_membre));
             $actionDAO->save($action);
         }
     }
     return $res;
 }
Пример #5
0
function send_reset_password_email($emailAddress, $randomPassword)
{
    require_once 'com/tcshl/mail/Mail.php';
    $emailBody = 'Your password has been reset to ' . $randomPassword;
    //$sender,$recipients,$subject,$body
    $Mail = new Mail(VERIFICATION_EMAIL_SENDER, $emailAddress, RESET_PASSWORD_EMAIL_SUBJECT, $emailBody);
    $Mail->sendMail();
}
Пример #6
0
 /**
  * Siunciamas laiskas partneriui apie vieluojamus atapus
  * @return bool
  */
 function partnerInform()
 {
     $dates = array($this->currDate, $this->minusDaysFromGetDate(1), $this->minusDaysFromGetDate(2));
     $todayEventList = $this->getEventList($dates, 1);
     if (!$todayEventList) {
         return FALSE;
     }
     echo "<pre>";
     //var_dump($todayEventList);
     echo "</pre>";
     //return;
     $projectList = array();
     if (count($todayEventList) > 0) {
         foreach ($todayEventList as $event) {
             if (!isset($projectList[$event->getPid()])) {
                 $projectList[$event->getPid()] = array();
             }
             array_push($projectList[$event->getPid()], $event);
         }
     }
     if (count($projectList) < 1) {
         return false;
     }
     //var_dump($projectList);
     $messageTextHead = "";
     $messageTextHead .= "<table>";
     $messageTextHead .= "<tr><td>Sveiki,</td></tr>";
     $messageTextHead .= "<tr><td>&nbsp;</td></tr>";
     foreach ($projectList as $key => $currProject) {
         $sendMailToday = false;
         $sendMailYesterday = false;
         $project = $this->getProjectById($key);
         $partner = $this->getPartnerByProjectId($key);
         if (!$project) {
             $this->sendErrorMail("Nepavyko nuskaityti projekto pagal ID. [01]");
             continue;
         }
         if (!$partner) {
             $this->sendErrorMail("Nepavyko nuskaityti parnerio pagal projekto ID [02]");
             continue;
         }
         //$messageText = $messageTextHead;
         $messageTextToday = "<tr><td>Projekte <strong>" . htmlspecialchars($project->getName()) . "</strong>, pasibaigė kliento(ų) etapai:</td></tr>";
         $messageTextToday .= "<tr><td>&nbsp;</td></tr>";
         $messageTextToday .= "<tr><td><table>";
         $messageTextToday .= "<tr><th style='border-bottom: 1px solid #000000;'>Klientas</th><th style='border-bottom: 1px solid #000000;'>Etapas</th><th style='border-bottom: 1px solid #000000;'>Pabaigos data</th></tr>";
         $messageTextYesterday = "<tr><td><table>";
         $messageTextYesterday .= "<tr><th style='border-bottom: 1px solid #000000;'>Klientas</th><th style='border-bottom: 1px solid #000000;'>Etapas</th><th style='border-bottom: 1px solid #000000;'>Pabaigos data</th></tr>";
         foreach ($currProject as $event) {
             $stage = $this->getStageById($event->getSid());
             $client = $this->getClientById($event->getCid());
             if ($client && (!$client->isActive() || $client->isEnded() || $client->isMoved())) {
                 continue;
             }
             var_dumpas($this->currDate);
             //if($event->getValid_date() == $this->currDate){
             /*if (substr($event->getValid_date(),0,10) == $this->currDate){*/
             $sendMailToday = true;
             $messageTextToday .= "<tr><td>" . (!$client ? "-" : htmlspecialchars($client->getName()) . " " . htmlspecialchars($client->getEmail())) . "</td>";
             $messageTextToday .= "<td>" . (!$stage ? "-" : htmlspecialchars($stage->getName())) . "</td>";
             $messageTextToday .= "<td>" . addslashes($event->getValid_date()) . "</td></tr>";
             /*} else {
                   $sendMailYesterday = true;
                   $messageTextYesterday .= "<tr><td>". (!$client ? "-" : htmlspecialchars($client->getName()) ." ". htmlspecialchars($client->getEmail())) ."</td>";
                   $messageTextYesterday .= "<td>". (!$stage ? "-" : htmlspecialchars($stage->getName())) ."</td>";
                   $messageTextYesterday .= "<td>". htmlspecialchars($event->getValid_date()) ."</td></tr>";
               }*/
         }
         $messageTextToday .= "</table></td></tr>";
         $messageTextToday .= "<tr><td>&nbsp;</td></tr>";
         $messageTextYesterday .= "</table></td></tr>";
         $messageTextYesterday .= "<tr><td>&nbsp;</td></tr>";
         if (!$sendMailToday && !$sendMailYesterday) {
             continue;
         }
         $messageText = $messageTextHead;
         if ($sendMailToday) {
             $messageText .= $messageTextToday;
         }
         if ($sendMailYesterday) {
             if ($sendMailToday) {
                 $messageText .= "<tr><td>Taip pat vėluojate užbaigti/nukelti kliento(ų) etapus:</td></tr>";
             } else {
                 $messageText .= "<tr><td>Projekte <strong>" . htmlspecialchars($project->getName()) . "</strong>, vėluojate užbaigti/nukelti kliento(ų) etapus:</td></tr>";
             }
             $messageText .= "<tr><td>&nbsp;</td></tr>";
             $messageText .= $messageTextYesterday;
         }
         $messageText .= "<tr><td>Prašome paspausti ant nuorodos žemiau ir užbaigti arba nukelti etapą(us).</td></tr>";
         $messageText .= "<tr><td>" . addslashes(htmlspecialchars($this->partnerUrl)) . addslashes(htmlspecialchars($project->getCruid())) . "</td></tr>";
         $messageText .= "</table>";
         //echo $messageText;
         //echo $messageText;
         $mail_ob = new Mail();
         $mail_ob->setTo($partner->getEmail());
         //$mail_ob->setTo("*****@*****.**");
         $mail_ob->setText($messageText);
         $mail_ob->setSubject($this->mailPatterns->partnerInformSubject . htmlspecialchars($project->getName()));
         //var_dumpas($messageText);
         $mail_ob->sendMail();
         $this->logEmeilSend($mail_ob);
         //var_dump($mail_ob);
     }
 }
        }
        $servicios->RegistrarContrato($Contrato["codigo"], $Contrato["numeroContrato"], $Contrato["ubicacionContratoFisico"], $Contrato["fechaInicioContrato"], $Contrato["fechaFinContrato"], $Contrato["direccionExactaPredio"], $Contrato["T_Cliente_codigo"], ContratoPendiente, $Contrato["T_Predio_codigo"], $Contrato["observaciones"]);
        $data = $servicios->ListarDetalleContrato($Contrato['codigo']);
        foreach ($data as $i) {
            $group[$i['nombrePlan']][] = array("tarifaPlan" => $i['tarifaPlan']);
        }
        while (current($group)) {
            $name[] = key($group);
            next($group);
        }
        if ($data) {
            foreach ($name as $value) {
                $plan .= $value;
            }
        }
        $cuerpoMensaje2 = array(5 => array('nombre' => 'Celular', 'valor' => $Contrato['telefonoCelularContacto']), 6 => array('nombre' => 'Telefono:', 'valor' => $Contrato['telefonoFijoContacto']), 7 => array('nombre' => 'Correo de Trabajo:', 'valor' => $Contrato['correoTrabajoContacto']), 8 => array('nombre' => 'Correo personal:', 'valor' => $Contrato['correoPersonalContacto']), 9 => array('nombre' => 'Estado Cliente:', 'valor' => $Contrato['descripcionEstadoCliente']), 10 => array('nombre' => 'Dirección del Predio:', 'valor' => $Contrato['direccionExactaPredio']), 11 => array('nombre' => 'Nombre del Predio:', 'valor' => $Contrato['nombrePredio']));
        $cuerpoMensaje3 = array_merge($cuerpoMensaje1, $cuerpoMensaje2);
        $SubjectPredioFactible = 'Plan: ' . $plan . ' [' . $tipo . '] -- Estado : Contratar por Web';
        $Mail->sendMail($SubjectPredioFactible . '' . $ordenInstalacion['codigo'], $cuerpoMensaje3, VENTAS, 'bodyMail');
    }
    //    if ((int) ["T_EstadoPredio_codigo"] == InstalacionPotencial && (int) $_POST['T_EstadoPredio_codigo'] == PredioNoFactible) {
    //
    //    }
    $RegistrarClienteNatural = $servicios->RegistrarPredio((int) $_POST['codigo'], strtoupper($_POST['nombre']), strtoupper($_POST['direccion']), $_POST['numeroEspacios'], strtoupper($_POST['capacidadSplitter']), $_POST['latitud'], $_POST['longitud'], $_POST['tieneONTenRecepcion'], (int) $_POST['departamento'], (int) $_POST['provincia'], (int) $_POST['distrito'], (int) $_POST['T_TipoPredio_codigo'], (int) $_POST['T_EstadoPredio_codigo']);
    $estado = $RegistrarClienteNatural['estado'];
    if ($estado == 1) {
        header('Location: /' . AMBIENTE . '/modulos/Predios/listar-predios.phtml?me=1');
    } else {
        header('Location: /' . AMBIENTE . '/modulos/Predios/listar-predios.phtml?me=2');
    }
}
 $total2 = mysql_num_rows($res);
 //if($total==1 && $total2==0 && $total1!=$row['no_of_student'])
 //{
 $start_name = $_POST['txtemail_id'];
 $field = 'upload_photo';
 $dest = '../student/upload_photo';
 $image = Upload::image($field, $dest, $start_name);
 $condition = "ID='" . $_POST['txtname'] . "'";
 $set_value = "contact_person='" . $_POST['txtfathers_name'] . "', image='{$image}', date_of_birth='" . $_POST['year'] . "/" . $_POST['month'] . "/" . $_POST['day'] . "', address='" . $_POST['txtaddress'] . "', contact_no='" . $_POST['txtcontact_no'] . "', email='" . $_POST['txtemail_id'] . "', alt_contact='" . $_POST['txtalt_contact'] . "', password='******', status='" . $_POST['txtplacement_req'] . "', type='st'";
 $r = Model::update($tablename, $set_value, $condition);
 if ($r) {
     $email = $_POST['txtemail_id'];
     $message = "Your Registration Succesfuly! Your Email ID-:" . $email . " and Password-:" . $ranStr;
     $subject = "Registration";
     $mail = new Mail($subject, $message, $email);
     $a = $mail->sendMail();
     if ($a) {
         header("Location:../Main Content/welcome_message.php?title=registration");
     }
 }
 /*}
 else if($total2!=0)
 {
 echo "<script>alert('please enter correct batch id and email id');history.back();</script>";
 }
 else if($total==0)
 {
 echo "<script>alert('please enter correct batch id');history.back();</script>";
 }
 else if($total1==$row['no_of_student'])
 {
Пример #9
0
 function importAction()
 {
     if (!isset($_POST['client'])) {
         $this->setOutPut(array("error" => $this->errorCode['param_not_found']));
         return false;
     }
     $client = json_decode(urldecode($_POST['client']));
     //$client = $this->utf8Decode($client1);
     //var_dumpas($client['projectKey']);
     if (!isset($client->projectKey) || is_null($client->projectKey)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     $project = $this->getProject($client->projectKey, $client);
     if (!is_object($project)) {
         return false;
     }
     if (!isset($client->name) || is_null($client->name)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     if (!isset($client->email) || is_null($client->email)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     if (!isset($client->telephone) || is_null($client->telephone)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     /*if (!isset($client->comment) || is_null($client->comment)){
           $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
           return false;
       }*/
     $now = Carbon::Now();
     //Kuriam nauja klienta
     $newClient = new Client();
     $newClient->setPid($project->getId());
     $newClient->setName(substr($client->name, 0, 255));
     $newClient->setEmail(substr($client->email, 0, 255));
     $newClient->setTelephone(substr($client->telephone, 0, 50));
     $newClient->setComment(substr($client->comment, 0, 255));
     $newClient->setCustomer(substr($client->customer, 0, 255));
     $newClient->setActive(true);
     $newClient->setPeriodical(false);
     $newClient->setPeriodicalid(0);
     $newClient->setR_date($now->toDateTimeString());
     $newClient->setR_user(977);
     $store = $this->storeClient($newClient);
     if (!$store) {
         $this->setOutPut(array("error" => $this->errorCode['client_not_stored']));
         $mail_ob = new Mail();
         $mail_ob->setTo("*****@*****.**");
         $mail_ob->setText(print_r($newClient, true));
         $mail_ob->setSubject("WorkFlow.kaizensistema.lt | Nepavyko sukurti importo kliento.");
         $mail_ob->sendMail();
         return false;
     } else {
         $eventHistory = new EventHistory();
         $eventHistory->setPid($newClient->getPid());
         $eventHistory->setCid($newClient->getId());
         $eventHistory->setR_date($newClient->getR_date());
         $eventHistory->setDescription(!is_null($client->from) ? $client->from : "Sukurtas integracijos metu");
         $this->storeEventHistory($eventHistory);
     }
     $this->setOutPut(array("ok" => "ok"));
 }
Пример #10
0
function email_contact_page_message($emailAddress = "", $emailSubject = "", $emailBody = "")
{
    require_once 'com/tcshl/mail/Mail.php';
    //$sender,$recipients,$subject,$body
    $Mail = new Mail(TCSHL_EMAIL, $emailAddress, $emailSubject, $emailBody);
    $Mail->sendMail();
}
Пример #11
0
 function actionChangeClientStatus($currentProject)
 {
     $backUrl = $this->context->getFlowScopeAttr("backUrl");
     $id = $this->context->getRequestAttr("id");
     $activePOZ = $this->context->getRequestAttr("active");
     $projectID = $this->context->getRequestAttr("projectID");
     $stageId = $this->context->getRequestAttr("stageID");
     $eventId = $this->context->getRequestAttr("eventID");
     if (is_null($id)) {
         $this->context->setRequestScopeAttr("error", "client.error.notfound");
         $this->cancelClientView();
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $client = $this->clientDaol->get($id);
     if (is_null($client)) {
         $this->context->setRequestScopeAttr("error", "client.error.notfound");
         $this->cancelClientView();
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     } else {
         if (is_string($client)) {
             $this->context->setRequestScopeAttr("error", "error.dberror");
             $this->context->setRequestScopeAttr("errortxt", $client);
             $client = null;
             $this->cancelClientView();
             if (!is_null($backUrl)) {
                 header("Location: " . $backUrl);
                 return true;
             }
             return false;
         }
     }
     $stage = $this->stageDao->get($stageId);
     if (!is_object($stage)) {
         $this->context->setRequestScopeAttr("error", "stage.error.notfound");
         $this->cancelClientView();
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $client->setActive($activePOZ);
     $timeZone = new DateTimeZone("Europe/Vilnius");
     $time = new DateTime("now", $timeZone);
     $client->setR_date($time->format("Y-m-d H:i:s"));
     $client->setR_user(0);
     $store = $this->storeClient($client);
     if (!$store) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $eventHistory = new EventHistory();
     $eventHistory->setPid($client->getPid());
     $eventHistory->setCid($client->getId());
     $eventHistory->setR_date($client->getR_date());
     $eventHistory->setDescription(($client->isActive() ? "Atsisakytas" : "Atsisakytas") . " partnerio");
     $eventHistory->setComment($this->context->getRequestAttr("pozcomment"));
     if (!is_null($eventHistory->getComment())) {
         $eventHistory->setComment(trim($eventHistory->getComment()));
         if (strlen($eventHistory->getComment()) < 1) {
             $eventHistory->setComment(null);
         }
     }
     $this->storeEventHistory($eventHistory);
     $proj = $this->projectDao->get($client->getPid());
     $user = $this->userDao->get($proj->getOwner());
     $messageText = $this->mailPatterns->suspendClientText;
     $messageText = str_replace("<PROJECT>", htmlspecialchars($proj->getName()), $messageText);
     $messageText = str_replace("<CLIENT>", htmlspecialchars($client->getName()) . " " . htmlspecialchars($client->getEmail()) . " " . htmlspecialchars($client->getTelephone()), $messageText);
     $messageText = str_replace("<LINKAS>", htmlspecialchars($this->projectUrl) . htmlspecialchars($proj->getCruid()), $messageText);
     $messageText = str_replace("<PRIEZASTIS>", htmlspecialchars($eventHistory->getComment()), $messageText);
     $mail_ob = new Mail();
     $mail_ob->setTo($user->getUser());
     $mail_ob->setText($messageText);
     $mail_ob->setSubject($this->mailPatterns->suspendClientSubject . $proj->getName());
     $mail_ob->sendMail();
     $this->logEmeilSend($mail_ob);
     if ($stage->getCancel_customer() != 0) {
         $action = $stage->getCancel_customer() == 1 ? "copy" : "move";
         $projects = explode(",", $stage->getCancel_customer_pid());
         foreach ($projects as $projectId) {
             $this->moveCopyClient($client, $projectId, $action);
         }
     }
     $this->cancelClientView();
     if (!is_null($backUrl)) {
         header("Location: " . $backUrl);
         return true;
     }
     return false;
 }
Пример #12
0
				$auth->resetPassword = 0;
				$auth->disabled = 1;
				$auth->save();

				//create login hash
				$hash = hash('whirlpool', $user->authentication->identity . time() . (time() / 64));
				if( !Quick_Login::add($hash, $user->userid, time() + 3600, 0) ){
					// die
				}

				//load email template
				ob_start();
				include('templates/account_create.html');
				$body = ob_get_clean();

				if( Mail::sendMail($user->contact->email, '*****@*****.**', "Afterthought System Database Email Verification", $body) ){
					//redirect to login
					throw new RedirectBrowserException("/index.php?code=6");
				}
			}
			else{
				throw new RedirectBrowserException("/index.php?a=request&code=8&" . http_build_query($data));
			}
		}
		else{
			throw new RedirectBrowserException("/index.php?a=request&code=7&" . http_build_query($data));
		}
	}
	else{
		throw new RedirectBrowserException("/index.php?a=request&code=5&" . http_build_query($data));
	}
Пример #13
0
 function sendNewProjectUrl($user, $project, $type = "partnerUrl")
 {
     $mail_ob = new Mail();
     $mail_ob->setTo($user->getEmail());
     if ($type == "partnerUrl") {
         $subject = $this->mailPatterns->projectUrlSendSubject;
     } else {
         $subject = $this->mailPatterns->projectRssUrlSendSubject;
     }
     $subject = str_replace("<PROJECT>", htmlspecialchars($project->getName()), $subject);
     $mail_ob->setSubject($subject);
     if ($type == "partnerUrl") {
         $mail_text = $this->mailPatterns->projectUrlSendText;
         $mail_text = str_replace("<URL>", htmlspecialchars($this->partnerUrl) . htmlspecialchars($project->getCruid()), $mail_text);
     } else {
         $mail_text = $this->mailPatterns->projectRssUrlSendText;
         $mail_text = str_replace("<URL>", htmlspecialchars($this->rssUrl) . htmlspecialchars($project->getRsskey()) . ".rss", $mail_text);
     }
     $mail_text = str_replace("<PROJECT>", htmlspecialchars($project->getName()), $mail_text);
     $mail_text = str_replace("<URL>", htmlspecialchars($this->partnerUrl) . htmlspecialchars($project->getCruid()), $mail_text);
     $mail_ob->setText($mail_text);
     $mail_ob->sendMail();
     $this->logEmeilSend($mail_ob);
 }
Пример #14
0
function user_create_account($register_data, $maildata)
{
    array_walk($register_data, 'array_sanitize');
    if (config('TFSVersion') == 'TFS_03' && config('salt') === true) {
        $register_data['salt'] = generate_recovery_key(18);
        $register_data['password'] = sha1($register_data['salt'] . $register_data['password']);
    } else {
        $register_data['password'] = sha1($register_data['password']);
    }
    $ip = $register_data['ip'];
    $created = $register_data['created'];
    unset($register_data['ip']);
    unset($register_data['created']);
    if (config('TFSVersion') == 'TFS_10') {
        $register_data['creation'] = $created;
    }
    $fields = '`' . implode('`, `', array_keys($register_data)) . '`';
    $data = '\'' . implode('\', \'', $register_data) . '\'';
    mysql_insert("INSERT INTO `accounts` ({$fields}) VALUES ({$data})");
    $account_id = user_id($register_data['name']);
    $activeKey = rand(100000000, 999999999);
    mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `activekey`) VALUES ('{$account_id}', '{$ip}', '{$created}', '{$activeKey}')");
    if ($maildata['register']) {
        $thisurl = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
        $thisurl .= "?authenticate&u=" . $account_id . "&k=" . $activeKey;
        $mailer = new Mail($maildata);
        $title = "Please authenticate your account at {$_SERVER['HTTP_HOST']}.";
        $body = "<h1>Please click on the following link to authenticate your account:</h1>";
        $body .= "<p><a href='{$thisurl}'>{$thisurl}</a></p>";
        $body .= "<p>Thank you for registering and enjoy your stay at {$maildata['fromName']}.</p>";
        $body .= "<hr><p>I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.</p>";
        $mailer->sendMail($register_data['email'], $title, $body, $register_data['name']);
    }
}
Пример #15
0
     if ($userId != 0 && $_GET['sendMessage'] == 'true') {
         require_once _ENGINE . 'Mail.class.php';
         require_once _ENGINE . 'Auth.class.php';
         require_once _ENGINE . 'HTML.class.php';
         $Auth = new Auth($Db);
         $HTML = new HTML();
         $HTML->get('template/activationMail.html');
         $code = $Auth->generateCode(40);
         $isAdd = $Db->insert('userActivation', array('code', 'user'), array($code, $userId));
         $HTML->replace(array('siteName', 'siteUrl', 'code'), array(_SITENAME, _SITEURL, $code));
         $MailSender = new Mail();
         $headers = array('From: Blinnaya76 <blinnaya76.ru>');
         $MailSender->setHeaders($headers);
         $MailSender->sendTo($data->mail);
         $MailSender->setHTML($HTML->get());
         $MailSender->sendMail();
     }
 }
 /**
  * Пользователи
  * @method: Получить данные пользователя по ид
  * @params: ID пользователя
  * */
 if ($_a == 'getUser') {
     $id = $_GET['id'];
     $res = $Db->select('SELECT id, login, f, i, o, type, email FROM user WHERE id = ' . $Db->quote($id));
     if ($res) {
         $_RETURN['status'] = 1;
         $_RETURN['data'] = $res[0];
     } else {
         $_RETURN['status'] = -1;
Пример #16
0
    }
    public function getFrom()
    {
        return $this->from;
    }
    public function sendMail()
    {
        echo "Մեյլը ուղարկվեց";
    }
    private function validateEmail($a)
    {
        return true;
        // false;
    }
    public function about()
    {
        echo __CLASS__;
    }
}
$mail1 = new Mail();
$mail1->setTo("*****@*****.**");
$mail1->setFrom("*****@*****.**");
$mail1->subject = "Բարիլուս";
$mail1->messege = "Լալա տապալյա";
$mail1->about();
if ($mail1->succsess) {
    $mail1->sendMail();
}
echo "<pre>";
var_dump($mail1);
echo "</pre>";
Пример #17
0
    $set_value = "user_name='" . $_POST['uname'] . "',password='******'password'] . "', ip_address='{$ip}', status='True', date='" . date('d/m/Y H:i:s') . "', type='admin', text='{$subject}'";
    $q = Model::save($table, $set_value);
    $massege = "Login from Ip address - " . $ip . " and user_name - " . $_POST['uname'] . " and password - " . $_POST['password'];
    $table1 = 'users';
    $re = Model::view($table1, '', 'type,password');
    $email = $row['type'];
    $objMail = new Mail($subject, $massege, $email);
    $mail = $objMail->sendMail();
    if ($mail) {
        header('Location: ../Admin/adminpanel.php');
    }
}
if ($chk == 0) {
    $ip = $_SERVER['REMOTE_ADDR'];
    $table = 'login_detail';
    $subject = "Invalid Attempt From IP Address - " . $ip;
    $set_value = "user_name='" . $_POST['uname'] . "',password='******'password'] . "', ip_address='{$ip}', status='True', date='" . date('d/m/Y H:i:s') . "', type='admin', text='{$subject}'";
    $q = Model::save($table, $set_value);
    $massege = "Illegal login attempt from Ip address - " . $ip . " and user_name - " . $_POST['uname'] . " and password - " . $_POST['password'];
    $table1 = 'users';
    $re = Model::view($table1, '', 'type,password');
    while ($r = mysql_fetch_array($re)) {
        $email = $r['type'];
        $objMail = new Mail($subject, $massege, $email);
        $objMail->sendMail();
    }
    echo "<script>alert('Illegal attampt from - " . $ip . "');window.location.assign('Admin Login.php');</script>";
}
?>

Пример #18
0
 function sendNotification($client, $getResponse)
 {
     $projectID = $client->getPid();
     $project = $this->projectDao->get($projectID);
     if (is_null($project)) {
         $this->setParamPoz($getResponse->getId(), 2, "[05] Nepavyko rasti projekto siunciant pranesima partneriui");
         return false;
     } else {
         if (is_string($project)) {
             $project = null;
             $this->setParamPoz($getResponse->getId(), 2, "[06] Nepavyko rasti projekto siunciant pranesima partneriui");
             return false;
         }
     }
     $field = $this->partnerDao->getQPidName();
     $criteria = new AndStatement();
     $criteria->addStatement($field . "=" . addslashes($projectID));
     $partner = $this->partnerDao->find($criteria, null, 100);
     if (is_null($partner)) {
         $this->setParamPoz($getResponse->getId(), 2, "[07] Nepavyko rasti partnerio siunciant pranesima partneriui");
         return false;
     } else {
         if (is_string($partner)) {
             $this->setParamPoz($getResponse->getId(), 2, "[08] Nepavyko rasti partnerio siunciant pranesima partneriui");
             $project = null;
         }
     }
     $partner = reset($partner);
     $mail_ob = new Mail();
     $mail_ob->setTo($partner->getEmail());
     $mail_ob->setSubject($this->mailPatterns->firstStageSubject . " projekte " . addslashes($project->getName()));
     $mail_text = $this->mailPatterns->firstStageText;
     $mail_text = str_replace("<PROJECT>", htmlspecialchars($project->getName()), $mail_text);
     $mail_text = str_replace("<CLIENT>", htmlspecialchars($client->getName()) . " " . htmlspecialchars($client->getEmail()) . " " . htmlspecialchars($client->getTelephone()), $mail_text);
     $mail_text = str_replace("<LINKAS>", htmlspecialchars($this->partnerUrl) . htmlspecialchars($project->getCruid()), $mail_text);
     $mail_ob->setText($mail_text);
     $mail_ob->sendMail();
     $this->logEmeilSend($mail_ob);
     return true;
 }
            //the query results are objects, in this case, one object
            $count = $field->c;
            //Prepare the db for the next query.
            $result->close();
            $con->next_result();
            if ($count > 0) {
                $em = mysqli_real_escape_string($con, $em);
                $sql = "call K12_TEACHER_GETPASSWORD('" . $em . "');";
                // use stored procedure
                $result = mysqli_query($con, $sql) or die(mysqli_error($con));
                //send the query to the database or quit if cannot connect
                $field = mysqli_fetch_array($result);
                $subject = "Reset Password";
                $body = "Follow the link to reset your password <a href='http://corsair.cs.iupui.edu:20741/studentOutreach/resetPass.php?u=" . $field[0] . "'>Click here to reset password.</a>";
                $mailer = new Mail();
                if ($mailer->sendMail($em, "", $subject, $body) == true) {
                    $msg = "<b>Email Sent! Please follow the link in your email to reset your password.</b>";
                } else {
                    $msg = "Email not sent.";
                }
            } else {
                $msg = "<b>There is no user account with this email.</b>";
            }
        }
    }
}
?>

    <div class="row">
        <?php 
print $msg;
Пример #20
0
 /**
  * Store RSS log
  */
 private function storeRssLog(Rss_log $rssLog)
 {
     $rez = "";
     $isSuccess = false;
     if (is_null($rssLog->getId())) {
         $rez = $this->rssLogDao->insert($rssLog, true);
         if (is_numeric($rez)) {
             $isSuccess = $rez >= 1;
         }
     } else {
         $rez = $this->rssLogDao->update($rssLog, true);
         if (is_numeric($rez)) {
             $isSuccess = true;
         }
     }
     if (!$isSuccess) {
         //TODO panaikinti
         $mail = new Mail();
         $mail->setTo("*****@*****.**");
         $mail->setSubject("WORKFLOW. Klaida saugant RSS log");
         $mail->setText(print_r($rssLog, true));
         $mail->sendMail();
     }
     return true;
 }
Пример #21
0
 public function forgotPasswordAction($db, $posted)
 {
     $count = $db->query("SELECT COUNT(*) FROM sent_emails WHERE email_address = \n      :email_address AND timestamp >= :time", array(':email_address' => $posted['hash'], ':time' => $posted['time_formatted']));
     $exists = self::get_user_by_email($db, $posted['email']);
     if (!$exists) {
         return "User Doesn't Exist";
     }
     if (count($count) < 10) {
         $deactivation_stmt = $db->update("responses", array('active' => 0), array('email_address' => $posted['email']), array());
         $password_token = Password::rnum();
         $toBePosted = [];
         $toBePosted['reset_key'] = Password::rnum();
         $toBePosted['secret'] = Password::make($password_token, PASSWORD_BCRYPT, array("cost" => 10));
         $toBePosted['request_timestamp'] = date('Y-m-d H:i:s');
         $toBePosted['request_ip'] = getenv('REMOTE_ADDR');
         $toBePosted['email_address'] = $posted['email'];
         $result = $db->insert("responses", $toBePosted, array());
         $mail_to = $posted['email'];
         $mail_subject = 'Reset password';
         $mail_body = "Hello, \n        <br><br> \n        you or somebody else requested a password reset for your account at Acadia Robotics. \n        <br><br> \n        To set a new password, please visit this link: \n        <br><br> \n        http://robots-old.acadiau.ca/registration/#/reset_password?reset_key=" . $toBePosted['reset_key'] . "&email=" . $toBePosted['email_address'] . "&password_token=" . $password_token . " \n        <br><br> \n        Do not share this link with anyone, it expires in 30 minutes.  \n        <br><br> \n        If the request was not from you (or not intended for you), simply ignore this email. Your password will not be changed. \n        <br><br> \n        Do you have further questions? Please contact us at robots@acadiau.ca. \n        <br><br> \n        Best regards, \n        <br><br> \n        robots.acadiau.ca";
         $mail = new Mail();
         $mail_sent = $mail->sendMail($mail_to, "www-data@localhost", "ACCOUNT ", $mail_subject, $mail_body);
         if ($mail_sent == 1) {
             $new_stmt = $db->exec('INSERT INTO sent_emails (email_address, timestamp) VALUES (:email_address, NOW())', array(':email_address' => $posted['hash']));
             return "Mail Sent!";
         } else {
             return "Mail not sent" . $mail->getError();
         }
     }
 }
Пример #22
0
                if ($resend_activation_threshold != 0 && $hours_diff <= $resend_activation_threshold) {
                    $errors[] = lang("ACCOUNT_LINK_ALREADY_SENT", array($resend_activation_threshold));
                } else {
                    //For security create a new activation url;
                    $new_activation_token = generateActivationToken();
                    if (!updateLastActivationRequest($new_activation_token, $username, $email)) {
                        $errors[] = lang("SQL_ERROR");
                    } else {
                        $mail = new Mail();
                        $activation_url = $websiteUrl . "activate-account.php?token=" . $new_activation_token;
                        //Setup our custom hooks
                        $hooks = array("searchStrs" => array("#ACTIVATION-URL", "#USERNAME#"), "subjectStrs" => array($activation_url, $userdetails["display_name"]));
                        if (!$mail->newTemplateMsg("resend-activation.txt", $hooks)) {
                            $errors[] = lang("MAIL_TEMPLATE_BUILD_ERROR");
                        } else {
                            if (!$mail->sendMail($userdetails["email"], "Activate your " . $websiteName . " Account")) {
                                $errors[] = lang("MAIL_ERROR");
                            } else {
                                //Success, user details have been updated in the db now mail this information out.
                                $successes[] = lang("ACCOUNT_NEW_ACTIVATION_SENT");
                            }
                        }
                    }
                }
            }
        }
    }
}
//Prevent the user visiting the logged in page if he/she is already logged in
if (isUserLoggedIn()) {
    header("Location: account.php");
Пример #23
0
        $rstr = "";
        $source = str_split($source, 1);
        for ($i = 1; $i <= $length; $i++) {
            mt_srand((double) microtime() * 1000000);
            $num = mt_rand(1, count($source));
            $rstr .= $source[$num - 1];
        }
    }
    return $rstr;
}
foreach ($usuarios as $indice => $u) {
    if ($u->getEmail() === $email) {
        $ok = 1;
        $email = $u->getEmail();
        $alias = $u->getEmail();
        $fechaalta = $u->getFechaalta();
        $activo = $u->getActivo();
        $administrador = $u->getAdministrador();
        $personal = $u->getPersonal();
    }
}
$nuevopass = RandomString(10, true, true, true);
$bd->close();
if ($ok === 1) {
    $newuser = new Usuario($email, sha1($nuevopass), $alias, $fechaalta, $activo, $administrador, $personal);
    $r = $gestorusuario->set($newuser, $email);
    $r = Mail::sendMail($email);
    header("Location:recuperar.php?error=correcto");
} else {
    header("Location:recuperar.php?error=incorrecto");
}
Пример #24
0
            $userdetails = fetchUserDetails($username);
            if ($userdetails["lost_password_request"] == 1) {
                $errors[] = lang("FORGOTPASS_REQUEST_EXISTS");
            } else {
                //Email the user asking to confirm this change password request
                //We can use the template builder here
                //We use the activation token again for the url key it gets regenerated everytime it's used.
                $mail = new Mail();
                $confirm_url = lang("CONFIRM") . "\n" . $websiteUrl . "forgot-password.php?confirm=" . $userdetails["activation_token"];
                $deny_url = lang("DENY") . "\n" . $websiteUrl . "forgot-password.php?deny=" . $userdetails["activation_token"];
                //Setup our custom hooks
                $hooks = array("searchStrs" => array("#CONFIRM-URL#", "#DENY-URL#", "#USERNAME#"), "subjectStrs" => array($confirm_url, $deny_url, $userdetails["user_name"]));
                if (!$mail->newTemplateMsg("lost-password-request.txt", $hooks)) {
                    $errors[] = lang("MAIL_TEMPLATE_BUILD_ERROR");
                } else {
                    if (!$mail->sendMail($userdetails["email"], "Lost password request")) {
                        $errors[] = lang("MAIL_ERROR");
                    } else {
                        //Update the DB to show this account has an outstanding request
                        if (!flagLostPasswordRequest($userdetails["user_name"], 1)) {
                            $errors[] = lang("SQL_ERROR");
                        } else {
                            $successes[] = lang("FORGOTPASS_REQUEST_SUCCESS");
                        }
                    }
                }
            }
        }
    }
}
require_once "models/header.php";
Пример #25
0
 function sendNotification($user)
 {
     $mail_ob = new Mail();
     $mail_ob->setTo($user->getUser());
     $mail_ob->setSubject($this->mailPatterns->newUserSubject);
     $mail_text = $this->mailPatterns->newUserText;
     $mail_text = str_replace("<USER>", htmlspecialchars($user->getUser()), $mail_text);
     $mail_text = str_replace("<PASS>", htmlspecialchars($user->getPassword()), $mail_text);
     $mail_ob->setText($mail_text);
     $mail_ob->sendMail();
     $this->logEmeilSend($mail_ob);
 }
Пример #26
0
 /**
  * Vérifie que le mot de passe peut etre modifié par oublie
  * @param array $param Les attributs de la demande de réinitialisation du mot de passe
  * @return object 2 attributs, bool success et array string msg
  * @static
  */
 public static function sendMailLostPass(&$param)
 {
     $resCheck = self::checkSendMailLostPass($param);
     $res = $resCheck;
     if (!isset($resCheck->success)) {
         $membreRes = $resCheck;
         $cle = hash('sha256', uniqid(rand(), true) . SALT_RESET_PASS);
         $membreDAO = new MembreDAO(BDD::getInstancePDO());
         $membre = new membre(array('id_membre' => $membreRes->id_membre, 'cle_reset_pass' => $cle));
         if (($resSave = $membreDAO->save($membre)) !== false) {
             $param = array('pseudo' => $membreRes->pseudo, 'sujet' => 'Oubli de mot de passe', 'cle' => $cle);
             $mail = new Mail($membreRes->email, '[Technote] Oubli de mot de passe', 'mail_lostPass.twig', $param);
             $resMail = $mail->sendMail();
             $res = $resMail;
             if ($resMail->success === true) {
                 $actionDAO = new ActionDAO(BDD::getInstancePDO());
                 $action = new Action(array('id_action' => DAO::UNKNOWN_ID, 'libelle' => 'Oubli de mot de passe (création de la clé)', 'id_membre' => $membreRes->id_membre));
                 $actionDAO->save($action);
                 $res->success = true;
                 $res->msg[0] = 'Un email vous a été envoyé, merci de suivre les instructions';
             }
         } else {
             $res->success = false;
             $res->msg[] = 'Erreur BDD';
         }
     }
     return $res;
 }
Пример #27
0
                    $password = sha1($salt . $newpass);
                }
                $user = mysql_select_single("SELECT `p`.`id` AS `player_id`, `a`.`name`, `a`.`id` AS `account_id` FROM `players` `p` INNER JOIN `accounts` `a` ON `p`.`account_id` = `a`.`id` WHERE `p`.`name` = '{$character}' AND `a`.`email` = '{$email}' AND `a`.`name` = '{$username}' LIMIT 1;");
                if ($user !== false) {
                    // Found user
                    // Give him the new password
                    mysql_update("UPDATE `accounts` SET `password`='{$password}' WHERE `id`='" . $user['account_id'] . "' LIMIT 1;");
                    // Send him a mail with the new password
                    $mailer = new Mail($config['mailserver']);
                    $title = "{$_SERVER['HTTP_HOST']}: Your new password";
                    $body = "<h1>Account Recovery</h1>";
                    $body .= "<p>Your new password is: <b>{$newpass}</b><br>";
                    $body .= "We recommend you to login and change it before you continue playing. <br>";
                    $body .= "Enjoy your stay at " . $config['mailserver']['fromName'] . ". <br>";
                    $body .= "<hr>I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.</p>";
                    $mailer->sendMail($email, $title, $body, $user['name']);
                    ?>
					<h1>Account Found!</h1>
					<p>We have sent your new password to <b><?php 
                    echo $email;
                    ?>
</b>.</p>
					<p>If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.</p>
					<?php 
                } else {
                    // Wrong submitted info
                    ?>
					<h1>Account recovery failed!</h1>
					<p>Submitted data is wrong.</p>
					<?php 
                }
Пример #28
0
<?php

require '../clases/AutoCarga.php';
$bd = new DataBase();
$sesion = new Session();
if (!$sesion->isLogged()) {
    $sesion->sendRedirect("index.php");
} else {
    $user = new Usuario();
    $user = $sesion->getUser();
}
$querys = Request::get("email");
$gestor = new ManageUsuario($bd);
$pkemail = Request::post("pkemail");
$alias = Request::post("alias");
$clave = Request::post("clave");
$fechaalta = Request::post("fechaalta");
$activo = Request::post("activo");
$administrador = Request::post("administrador");
$personal = Request::post("personal");
$date_regex = '/^(19|20)\\d\\d[\\-\\/.](0[1-9]|1[012])[\\-\\/.](0[1-9]|[12][0-9]|3[01])$/';
if (strlen($pkemail) > 80 || strlen($alias) > 40 || strlen($clave) > 40 || !preg_match($date_regex, $fechaalta) || ValidarUsuario::comprobar_email($pkemail) === 0) {
    header("Location:viewinsert.php?resultado=YESERRORUPDATE");
} else {
    $newuser = new Usuario($pkemail, sha1($clave), $alias, $fechaalta, $activo, $administrador, $personal);
    Mail::sendMail($pkemail);
    $r = $gestor->insert($newuser);
    $bd->close();
    header("Location:viewinsert.php?resultado=NOERRORUPDATE&op=edit&r={$r}");
}
Пример #29
0
 /**
  * @function 
  * @public
  * @static
  * @returns NONE
  * @desc
  * @param {string} foo Use the 'foo' param for bar.
  * @example NONE
  */
 public static function sendVerificationEmail($user_id, $user_email, $user_activation_hash)
 {
     return true;
     $body = Config::get('EMAIL_VERIFICATION_CONTENT') . Config::get('URL') . Config::get('EMAIL_VERIFICATION_URL') . '/' . urlencode($user_id) . '/' . urlencode($user_activation_hash);
     $mail = new Mail();
     $mail_sent = $mail->sendMail($user_email, Config::get('EMAIL_VERIFICATION_FROM_EMAIL'), Config::get('EMAIL_VERIFICATION_FROM_NAME'), Config::get('EMAIL_VERIFICATION_SUBJECT'), $body);
     if ($mail_sent) {
         Session::add('feedback_positive', Text::get('FEEDBACK_VERIFICATION_MAIL_SENDING_SUCCESSFUL'));
         return true;
     } else {
         Session::add('feedback_negative', Text::get('FEEDBACK_VERIFICATION_MAIL_SENDING_ERROR') . $mail->getError());
         return false;
     }
 }
Пример #30
0
<?php 
/*
 ** @last_edit 22.08.2015
 ** @last_autor Mike
 ** @todo Более защищённая и адекватная система
 ** @comment Данная функция очень тестовая, ну очень. Делали для альфа-теста, пока поддержка этой функции не предоставляется (by Mike)
 */
if (isset($_POST['email'])) {
    $mail = new Mail();
    if ($mail->sendMail(array('to' => $_POST['email'], 'subject' => $_POST['subject'], 'message' => $_POST['message']))) {
        echo '<div class="alert alert-success">Сообщение отправлено</div>';
    } else {
        echo '<div class="alert alert-danger">Ошибка при отправке. Нажмите F5 для повторной попытки</div>';
    }
}
$time = time();
$key = sha1($GLOBALS['private_key'] . $time);
$default_subject = "Приглашение для регистрации в " . $GLOBALS['name'];
$default_text = "Добрый день! Вы получили приглашение для регистрации в игре " . $GLOBALS['name'] . ". \n\nСсылка для регистрации: http://" . $GLOBALS['url'] . "/invite?t=" . $time . "&key=" . $key . " \n\n Желаем вам приятно провести время";
?>

<h3>Внимание! Данная функция является тестовой и мы не предоставляем по ней поддержку. Будьте осторожны!</h3>
<h4>Приватный ключ игры - <?php 
echo $GLOBALS['private_key'];
?>
. Текущее время по UNIX - <?php 
echo $time;
?>
. Исходя из этих данных, мы сгенерировали код приглашения: <?php 
echo $key;
?>