Example #1
0
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;
}
Example #2
0
 function add_client_if_need($orderform = 0)
 {
     if (is_client_logged()) {
         return $_SESSION["frame"]["client"]["id"];
     }
     $add_to_filial = Filials::search($_SESSION['zf_filial_domain'], $_SESSION["zf_user_city"]);
     $referrer_id = 0;
     if (!empty($_SESSION['zf_referrer_code'])) {
         $referrer = Client::findOneBy(array('referrer_code' => $_SESSION['zf_referrer_code']));
         if (!empty($referrer)) {
             $referrer_id = $referrer['id'];
         }
     }
     $pwd = generate_pasw(5);
     $id = Client::create(array('filial_id' => $add_to_filial, 'fio' => $_SESSION["zf_user_name"], 'email' => $_SESSION["zf_user_login"], 'telnum' => $_SESSION["zf_user_tel"], 'city' => $_SESSION["zf_user_city"], 'password' => $pwd, 'orderform' => $orderform, 'ref_id' => $referrer_id));
     auth_client($_SESSION["zf_user_login"]);
     $_SESSION["new_klient_added"] = true;
     return $id;
 }
Example #3
0
<?php

require_once '../includes/application_top.php';
require_once DIR_FS_FRAME . 'func.php';
if (!isset($_REQUEST["action"])) {
    die("-1");
}
//die("" . print_r($_REQUEST, true) );
switch ($_REQUEST["action"]) {
    case 'check_email':
        if (auth_client($_REQUEST["email"])) {
            die($_SESSION["frame"]["client"]["id"]);
        } else {
            die(0);
        }
        break;
    default:
        die("-1");
        break;
}
die("-1");