Esempio n. 1
0
 function actionCreateAndSendAccess()
 {
     if ($_POST['accounts'] == 0) {
         $account = new BncomplexAccount();
         $account->date_create = new CDbExpression("now()");
         //$account->forsearch
         $account->user = BNComplex::generateUserLogin();
         $account->forsearch = $account->user;
         $account->pass = BNComplex::generatePass();
         $account->phone = $_POST["phone"];
         $result = $account->save();
     } else {
         $account = BncomplexAccount::model()->find("user=:user", array(":user" => $_POST["accounts"]));
         $result = $account;
     }
     if ($result) {
         foreach ($_POST["plates"] as $plate) {
             if (strlen(str_replace(" ", "", $plate)) > 0) {
                 if (BncomplexSubscription::model()->count("plate=:plate and id_account=:account", array(":plate" => $plate, ":account" => $account->id)) == 0) {
                     $subs = new BncomplexSubscription();
                     $subs->id_account = $account->id;
                     $subs->plate = MYChtml::check_num($plate);
                     if (!$subs->save()) {
                         print_r($subs->getErrors());
                     }
                 }
             }
         }
     } else {
         echo "Пиздец" . $_POST["accounts"];
     }
     if ($account) {
         $BNLogin = BNComplex::createAccount($account);
         if ($BNLogin) {
         } else {
             echo "Опять пиздец";
         }
     }
     $this->render("createandsend", array("account" => $account, "isNew" => $_POST['accounts'] == 0 ? "Новый" : "Старый"));
 }
Esempio n. 2
0
 public function actionCheckconnect()
 {
     $devId = $_GET["devId"];
     echo BNComplex::checkConnect($devId);
 }