コード例 #1
0
ファイル: login.php プロジェクト: yonkon/diplom
function create_new_user($login, &$err)
{
    $err = "";
    $name = clearText($_REQUEST["loginform"]["name"]);
    if (!strlen($name)) {
        $err = "Укажите имя";
        return false;
    }
    $tel = clearText($_REQUEST["loginform"]["tel"]);
    $city = clearText($_REQUEST["loginform"]["city"]);
    $cont = clearText($_REQUEST["loginform"]["cont"]);
    $liketel = intval(clearText(@$_REQUEST["loginform"]["liketel"]));
    $teltime = clearText(@$_REQUEST["loginform"]["teltime"]);
    $filial_domain = clearText(@$_REQUEST['loginform']['zf_filial_domain']);
    //get filial by domain
    $add_to_filial = Filials::search($filial_domain, $city);
    // create client
    $pwd = generate_pasw(5);
    $client_id = Client::create(array('filial_id' => $add_to_filial, 'fio' => $name, 'email' => $login, 'telnum' => $tel, 'city' => $city, 'liketel' => $liketel, 'teltime' => $teltime, 'contacts' => $cont, 'password' => $pwd));
    if ($client_id < 1) {
        return false;
    }
    auth_client($login);
    // send reg email
    $txt = "<p>Здравствуйте, " . $name . "!</p>" . "<p>Мы очень рады, что Вы решили воспользоваться нашими услугами и высоко ценим Ваше доверие!</p>" . "<p>Теперь Вы можете войти в личный кабинет:<br>" . "&nbsp;Логин: " . $login . "<br>" . "&nbsp;Пароль: " . $pwd . "<br></p>" . "<p><i>С уважением, компания по написанию студенческих работ.</i></p>";
    $email = new Email();
    $email->setData(array('email' => $login, 'name' => $name), "Регистрация на сайте написания рефератов", $txt, array(), true, array(), array('email' => Filials::getEmail($add_to_filial), 'name' => Filials::getName($add_to_filial)));
    if (!$email->send()) {
        die;
    }
    return true;
}
コード例 #2
0
ファイル: remind.php プロジェクト: yonkon/diplom
function check_rm_form(&$err)
{
    if (isset($_REQUEST["ok"])) {
        return true;
    }
    $err = "";
    if (!isset($_REQUEST["rm_user_login"]) || !strlen($_REQUEST["rm_user_login"])) {
        return false;
    }
    if (!isset($_REQUEST["rm_user_code"])) {
        return false;
    }
    $login = clearText($_REQUEST["rm_user_login"]);
    $code = clearText($_REQUEST["rm_user_code"]);
    if (!strlen($login)) {
        $err = "Укажите адрес электронной почты";
        return false;
    }
    if (!validateEmail($login)) {
        $err = "Укажите корректный адрес электронной почты";
        return false;
    }
    if (strlen($code) != 4 || $code != @$_SESSION["remind_scode"]) {
        $err = "Неверный код";
        return false;
    }
    $client = Client::findOneBy(array('email' => $login));
    if ($client) {
        $txt = "<p>Здравствуйте, " . $client["fio"] . "!</p>";
        $txt .= "Пароль для доступа к личному кабинету: <i>" . $client["password"] . "</i>";
        $txt .= "<p><i>С уважением, компания по написанию студенческих работ.</i></p>";
        $email = new Email();
        $email->setData(array('email' => $client["email"], 'name' => $client["fio"]), "Восстановление пароля", $txt, array(), true, array(), array('email' => Filials::getEmail($client["filial_id"]), 'name' => Filials::getName($client["filial_id"])));
        $email->send();
    }
    ob_end_clean();
    header("location: ?type=remind&ok");
    die;
}
コード例 #3
0
ファイル: makeorder.php プロジェクト: yonkon/diplom
 function check_order_form(&$err)
 {
     save_order_form();
     $err = "";
     // Обработка файлов
     // Если передается файл, то запускаем прием файла
     if (isset($_FILES["zf_work_file"]) && $_FILES["zf_work_file"]["error"] && strlen($_FILES["zf_work_file"]["name"])) {
         $err = "Ошибка при загрузке файла";
         return false;
     }
     if (isset($_REQUEST["zf_file_to_del"]) && intval($_REQUEST["zf_file_to_del"]) > -1) {
         // Удалить файл
         $path = TMPFILES_PATH . session_id();
         $fls = check_user_files();
         $delfile = $fls[intval($_REQUEST["zf_file_to_del"])]["full"];
         if (is_file($delfile)) {
             unlink($delfile);
         }
         $fls = check_user_files();
         if (!count($fls) && file_exists($path)) {
             rmdir($path);
         }
         $err = "Файл удален";
         return false;
     }
     if (is_uploaded_file($_FILES["zf_work_file"]["tmp_name"])) {
         // Формируем новое имя файла
         $path = TMPFILES_PATH . session_id();
         if (!file_exists($path)) {
             @mkdir($path);
         }
         if (file_exists($path)) {
             $new_name = $path . "/" . $_FILES["zf_work_file"]["name"];
             if (file_exists($new_name)) {
                 unlink($new_name);
             }
             move_uploaded_file($_FILES["zf_work_file"]["tmp_name"], $new_name);
         }
         $err = "Файл сохранен";
         return false;
     }
     // check auth if need
     if (!is_client_logged()) {
         $login = clearText($_REQUEST["zf_user_login"]);
         // need login
         if (!validateEmail($login)) {
             if (isset($_REQUEST["ajax_mode"])) {
                 ob_clean();
                 die("-1");
             }
             $err = "Необходимо указать адрес электронной почты";
             return false;
         }
         if ($client = Client::findOneBy(array('email' => $login))) {
             $_SESSION["frame"]["client"] = $client;
         } else {
             // create new user
         }
     }
     // check form
     $_SESSION["zf_work_tema"] = substr($_SESSION["zf_work_tema"], 0, 200);
     $_SESSION["zf_work_pages"] = substr($_SESSION["zf_work_pages"], 0, 50);
     $_SESSION["zf_work_dopinfo"] = substr($_SESSION["zf_work_dopinfo"], 0, 1000);
     return true;
 }
コード例 #4
0
ファイル: index.php プロジェクト: xinxinw1/message
 }
 if ($_REQUEST['type'] == "sendMessage") {
     $doc = $_POST['doc'];
     $name = $_POST['name'];
     $text = $_POST['text'];
     die(sendMessage($doc, $name, $text));
 }
 if ($_REQUEST['type'] == "sendNotice") {
     $doc = $_POST['doc'];
     $text = $_POST['text'];
     die(sendNotice($doc, $text));
 }
 if ($_REQUEST['type'] == "clearText") {
     $doc = $_POST['doc'];
     $name = $_POST['name'];
     clearText($doc);
     usleep(11000);
     die(sendNotice($doc, "{$name} cleared the text."));
 }
 if ($_REQUEST['type'] == "checkConnection") {
     ignore_user_abort(true);
     set_time_limit(0);
     $doc = $_GET['doc'];
     $name = $_GET['name'];
     usleep(200000);
     sendNotice($doc, "{$name} is online.");
     while (true) {
         echo ".";
         //echo getTime() . "\n";
         ob_flush();
         flush();
コード例 #5
0
ファイル: cabinet_profile.php プロジェクト: yonkon/diplom
<?php

use Components\Entity\Client;
use Components\Classes\Email;
use Components\Classes\Filials;
use Components\Entity\Filial;
if (!is_client_logged() || $_SESSION["frame"]["client"]["blocked"]) {
    echo 'Доступ запрещен.';
} else {
    $info = "";
    $error = "";
    if (isset($_REQUEST["cab_prof_infochng"])) {
        $c = clearText($_REQUEST["cab_prof_infochng"]);
        $c = substr($c, 0, 500);
        Client::update($_SESSION["frame"]["client"]["id"], array('contacts' => $c));
        $_SESSION["frame"]["client"]["contacts"] = $c;
        $info = "Сохранено";
    }
    if (isset($_REQUEST["cab_prof_pwdchng"]) && is_array($_REQUEST["cab_prof_pwdchng"])) {
        $a = $_REQUEST["cab_prof_pwdchng"];
        if ($a["old"] == $_SESSION["frame"]["client"]["password"]) {
            if ($a["new"] == $a["rep"]) {
                $new = preg_replace("/[^0-9a-z]/i", "", $a["new"]);
                if (strlen($new) > 4 && strlen($new) < 21) {
                    $hpwd = md5($new . strtolower($_SESSION["frame"]["client"]["email"]));
                    Client::update($_SESSION["frame"]["client"]["id"], array('hpwd' => $hpwd, 'password' => $new));
                    $info = "Пароль изменен";
                    $txt = "<p>Здравствуйте, " . $_SESSION["frame"]["client"]["fio"] . "!</p>" . "Новый пароль для доступа к личному кабинету: <i>" . $new . "</i>" . "<p><i>С уважением, компания по написанию студенческих работ.</i></p>";
                    $email = new Email();
                    $email->setData(array('email' => $_SESSION["frame"]["client"]["email"], 'name' => $_SESSION["frame"]["client"]["fio"]), "Изменение пароля к личному кабинету", $txt, array(), true, array(), array('email' => Filials::getEmail($_SESSION["frame"]["client"]["filial_id"]), 'name' => Filials::getName($_SESSION["frame"]["client"]["filial_id"])));
                    if ($email->send()) {
コード例 #6
0
ファイル: cabinet_messages.php プロジェクト: yonkon/diplom
     }
     if ($cnt) {
         $h = $cnt * 30;
         if ($h > 180) {
             $h = 180;
         }
         print "<div style='height: " . $h . "px; overflow: auto;'>" . $out . "<div style='border-top: 1px solid silver;'></div></div>";
     }
 }
 if (isset($messages[intval($_REQUEST["messages"])])) {
     $m = $messages[intval($_REQUEST["messages"])];
     if (!$m["readed"]) {
         Message::update($m["id"], array('readed' => 1));
     }
     if (isset($_REQUEST["cab_msg_answer"])) {
         $t = clearText($_REQUEST["cab_msg_answer"]);
         if (strlen($t)) {
             $t = substr($t, 0, 1000);
             $sbj = "[Re] " . $m["subject"];
             $message_id = Message::create(array("parent_id" => $m["id"], "klient_id" => $m["klient_id"], "created" => time(), "creator_id" => $m["addr"], "addr" => $m["creator_id"], "subject" => $sbj, "text" => $t, "prior" => 1));
             if ($message_id) {
                 enqueue_message_to_email($message_id, message_reciever_to_email($m['creator_id']), \Components\Entity\EmailNotificationType::TO_RECEIVER_ON_MESSAGE_COMMON);
                 $_SESSION["cab_msg_answer_info"] = "<span style='color:green'>Сообщение отправлено</span>";
             } else {
                 $_SESSION["cab_msg_answer_info"] = "<span style='color:red'>Не удалось отправить сообщение</span>";
             }
             header("location: ?type=cabinet&messages=" . $m["id"]);
             print $_SESSION["cab_msg_answer_info"];
             die;
         } else {
             $_SESSION["cab_msg_answer_info"] = "Введите текст сообщения";