Esempio n. 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;
}
Esempio n. 2
0
function addclient_exec($Frm, $Err)
{
    if (!$Err) {
        $rnd_pwd = $Frm->GetNmValueI('random_password');
        if ($rnd_pwd) {
            $pwd = generate_pasw(5);
        } else {
            $pwd = $Frm->GetNmValueH('password');
        }
        $eml = trim(strtolower($Frm->GetNmValue('email')));
        if (Client::exist($eml)) {
            $Frm->_gui->informer->ERR("Клиент с таким email уже существует");
            page_reloadAll();
        }
        $filial_id = Filials::check($Frm->GetNmValueI('filial_id'));
        $client_id = Client::create(array('filial_id' => $filial_id, 'fio' => $Frm->GetNmValueH('name'), 'email' => $eml, 'telnum' => $Frm->GetNmValueH('phone'), 'city' => $Frm->GetNmValueH('city'), 'icq' => $Frm->GetNmValueH('icq'), 'skype' => $Frm->GetNmValueH('skype'), 'contacts' => $Frm->GetNmValueH('contacts'), 'about' => $Frm->GetNmValueH('about'), 'ref_id' => $Frm->GetNmValueI('ref'), 'from_id' => $Frm->GetNmValueI('client_from'), 'added_by' => $_SESSION["user"]["data"]["id"], 'password' => $pwd));
        $Frm->_gui->OK("Добавлено");
        switch ($Frm->GetNmValueI('next')) {
            case 0:
                page_reloadSec();
                break;
            case 1:
                header("location: ?section=kln&subsection=2&edit=" . $client_id);
                die;
                break;
            case 2:
                header("location: ?section=ord&subsection=1&kln_id=" . $client_id);
                die;
                break;
        }
    }
}
Esempio n. 3
0
 public static function create(array $data)
 {
     if (empty($data) || !is_array($data) || empty($data['email'])) {
         return false;
     }
     if (!empty($data['password'])) {
         $password = $data['password'];
     } else {
         $password = generate_pasw(5);
     }
     $default_parameters = array('filial_id' => 0, 'password' => $password, 'hpwd' => md5($password . strtolower($data['email'])), 'fio' => '', 'liketel' => 0, 'teltime' => '', 'icq' => '', 'skype' => '', 'contacts' => '', 'regdate' => time(), 'blocked' => 0, 'about' => '', 'ocenka' => 0, 'ref_id' => 0, 'from_id' => 0, 'added_by' => 0, 'orderform' => 0, 'referrer_code' => uniqid());
     $data = array_merge($default_parameters, $data);
     if (self::exist($data['email'])) {
         return false;
     }
     $data['filial_id'] = Filials::check($data['filial_id']);
     return parent::create($data);
 }
Esempio n. 4
0
<?php

use Components\Classes\Email;
use Components\Entity\Client;
use Components\Exceptions\Exception;
use Components\Classes\Filials;
if (isset($_REQUEST["codeimg"])) {
    ob_clean();
    $scode = generate_pasw(4);
    $_SESSION["remind_scode"] = $scode;
    $img = imagecreatetruecolor(100, 30);
    $cw = imagecolorallocate($img, 255, 255, 255);
    $cb = imagecolorallocate($img, 0, 0, 0);
    imagefill($img, 0, 0, $cw);
    $x = 10;
    for ($i = 0; $i < 4; $i++) {
        $y = 5 + mt_rand(0, 5);
        imagestring($img, 4, $x, $y, $scode[$i], $cb);
        $x += 10 + mt_rand(0, 10);
    }
    for ($i = 0; $i < 200; $i++) {
        $x = mt_rand(0, 99);
        $y = mt_rand(0, 29);
        imagesetpixel($img, $x, $y, $cw);
    }
    /*
      for ($i=0; $i<200; $i++)
      {
     $x = mt_rand(0, 99);
     $y = mt_rand(0, 29);
     imagesetpixel($img, $x, $y, $cb);
Esempio n. 5
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;
 }