function patch($importEntity, $existingEntity, $mapping)
{
    $result = array();
    $isModified = false;
    if (isset($existingEntity)) {
        $result["Id"] = $existingEntity["Id"];
        if ($existingEntity["IsDeleted"] == 1) {
            $isModified = true;
        }
        //Log::info("  Patching existing id=".$result["Id"]);
    } else {
        $isModified = true;
        $result["Id"] = GUID();
        Log::info("  Creating new id=" . $result["Id"]);
    }
    $result["IsDeleted"] = 0;
    foreach ($mapping as $iKey => $eKey) {
        if (isset($existingEntity) && isset($existingEntity[$eKey]) && $existingEntity[$eKey] == $importEntity[$iKey]) {
            continue;
        }
        $result[$eKey] = $importEntity[$iKey];
        @Log::info("  Id=" . $result["Id"] . ", [" . $eKey . "] changed to: " . $result[$eKey]);
        $isModified = true;
    }
    if ($isModified) {
        $result["LastChangeDateTimeUtc"] = DB::sqleval("utc_timestamp()");
        Log::info("  Touching LastChangeDateTimeUtc of Id=" . $result["Id"]);
    } else {
        Log::info("  No changes on Id=" . $result["Id"]);
    }
    if (!$isModified) {
        return null;
    }
    return $result;
}
Esempio n. 2
0
 public function set_cookie($user_id)
 {
     $cookie_guid = GUID(50);
     setCookie("session", $cookie_guid, time() + self::$logintime, self::$path, self::$domain, self::$secure);
     //			setCookie("expire",time()+1800, time()+self::$logintime, self::$path, self::$domain, self::$secure);
     DB::update("accounts", array("session" => $cookie_guid, "logintime" => strval(time())), "uid=%s", $user_id);
     return $cookie_guid;
 }
Esempio n. 3
0
function generate_until_satisfied($check)
{
    $guid = GUID();
    while (!$check($guid)) {
        $guid = GUID();
    }
    return $guid;
}
Esempio n. 4
0
function insertOrUpdateImageByTitle($database, $imageData, $title)
{
    $imageInfo = getimagesizefromstring($imageData);
    $existingImageRow = $database->queryFirstRow("SELECT * FROM image WHERE Title=%s", $title);
    $imageId = $existingImageRow ? $existingImageRow["Id"] : GUID();
    $row = array("Id" => $imageId, "LastChangeDateTimeUtc" => $database->sqleval("utc_timestamp()"), "IsDeleted" => "0", "Title" => $title, "Height" => $imageInfo[1], "Width" => $imageInfo[0], "MimeType" => $imageInfo['mime'], "FileSizeInBytes" => strlen($imageData), "Url" => sprintf("{Endpoint}/ImageData/%s", $imageId));
    if (!$existingImageRow) {
        $database->insert("imagedata", array("Id" => $row["Id"], "Data" => $imageData));
        $database->insert("image", $row);
    } else {
        $existingDataRow = $database->queryFirstRow("SELECT * FROM imagedata WHERE Id=%s", $imageId);
        if ($existingDataRow["Data"] != $imageData) {
            $database->update("imagedata", array("Id" => $row["Id"], "Data" => $imageData), "Id=%s", $imageId);
            $database->update("image", $row, "Id=%s", $imageId);
        }
    }
    return $imageId;
}
/**
 * Resetoidaan käyttäjän salasana, joko käyttäjän toimesta, tai ylläpidollisista syistä.
 * Lähettää käyttäjälle linkin sähköpostilla pw_reset-sivulle, tai jos salasana vanhentunut:
 *  ohjaa suoraan kyseiselle sivulle.
 * @param DByhteys $db
 * @param stdClass $user
 * @param string $reset_mode <p> onko kyseessä 'reset' vai 'expired'. Eka lähettää linkin, toka ohjaa suoraan.
 */
function password_reset(DByhteys $db, stdClass $user, $reset_mode)
{
    $key = GUID();
    $key_hashed = sha1($key);
    $sql_query = "\tINSERT INTO pw_reset (kayttaja_id, reset_key_hash)\n\t\t\t\t\tVALUES ( ?, ? )";
    $db->query($sql_query, [$user->id, $key_hashed]);
    if ($reset_mode == "expired") {
        //Jos salasana vanhentunut, ohjataan suoraan salasananvaihtosivulle
        header("Location:pw_reset.php?id={$key}");
        exit;
    } else {
        // jos salasanaa pyydetty sähköpostiin, lähetetään linkki
        laheta_salasana_linkki($user->sahkoposti, $key);
        header("Location:index.php?redir=6");
        exit;
        // Palautuslinkki lähetetty
    }
}
Esempio n. 6
0
 public function __add_to_cart($item_id, $sides)
 {
     $item = DB::queryOneRow("SELECT * FROM menu_items WHERE id=%s", $item_id);
     $existing_uid = DB::queryOneRow("SELECT uid FROM carts WHERE user_id=%s AND cart_type=%s AND active=%d", $this->data["uid"], $item["service_id"], 1);
     if (DB::count() != 0) {
         $uid = $existing_uid["uid"];
     } else {
         $uid = GUID();
     }
     DB::query("UPDATE carts SET quantity=quantity+1 WHERE item_id=%s AND user_id=%s AND cart_type=%s AND active=%d", $item_id, $this->data["uid"], $item["service_id"], 1);
     if (DB::affectedRows() == 0) {
         DB::insert("carts", array("uid" => $uid, "cart_type" => $item["service_id"], "item_id" => $item_id, "user_id" => $this->data["uid"]));
     }
     if (count($sides) > 0) {
         foreach ($sides as $sk => $sv) {
             DB::query("UPDATE cart_sides SET quantity=quantity+1 WHERE cart_entry_uid=%s AND side_id=%s", $uid, $sv);
             if (DB::affectedRows() == 0) {
                 DB::insert("cart_sides", array("cart_entry_uid" => $uid, "side_id" => $sv));
             }
         }
     }
     return $this->get_cart($item["category_id"]);
     //        DB::sqleval("NOW()")
 }
Esempio n. 7
0
if ($op == 'print') {
    disableWebCache();
    load()->web('print');
    $id = intval($_GPC['id']);
    $chips = biz_getChips($id, true);
    $printTitle = '定金交款';
    $type = 3;
    $msg = '';
    $enable = print_checkChipsEnable($chips, $type, $msg);
    if ($enable) {
        if ($_W['token'] == $_GPC['token']) {
            $bill = biz_getBill($chips['qrcode'], 2, null);
            if ($chips['ordermoney'] == 0) {
                //已足定,没有票据,生成票据0
                if (empty($bill)) {
                    $inputBill = array('BillGUID' => GUID(), 'Money' => 0, 'finance' => array(array('money' => 0, 'note' => '足定换票')));
                    if (!biz_addBill($chips, $inputBill, 2)) {
                        message('生成票据,保存数据失败!', $url, 'error');
                    }
                    $bill = biz_getBill($chips['qrcode'], 2, 0);
                }
            }
            //更新没有打印生成票据的数据
            if (!empty($bill) && empty($bill['Printed'])) {
                if (!biz_updateBillOfInvoNo($bill)) {
                    message('生成票据单号失败,请重新打印!', $this->createWebUrl($do), 'error');
                }
            }
            //未改变状态
            if (!biz_checkChipsStatus($chips, 7)) {
                load()->web('app');
Esempio n. 8
0
    //		$validationMessage = "Please enter your zip code";
    //		$messages = "\nMissing zip code\n";
    //	}
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $invalid = TRUE;
        $validationMessage = "Please enter a valid email address";
        $messages = "\nInvalid email address: " . $email . "\n";
    }
}
if ($invalid) {
    // email is invalid
    echo "<html><body>" . "<script language='javascript'>alert('" . $validationMessage . "'); window.history.back();</script>" . "</body></html>";
    $submitToESM = FALSE;
    $redirect = FALSE;
}
$guid = GUID();
setcookie('leadid', $guid, 0, '/');
$timeStamp = date("Y-m-d H:i:s");
$errorMessage = "";
//New tracking: L1 - type, L2 - channel, L3 - vendor, L4 - campaign
if (isset($_POST['type'])) {
    $type = $_POST['type'];
} elseif (isset($_COOKIE['type'])) {
    $type = $_COOKIE['type'];
} else {
    $type = 'Paid';
}
if (isset($_POST['channel'])) {
    $channel = $_POST['channel'];
} elseif (isset($_COOKIE['channel'])) {
    $channel = $_COOKIE['channel'];
function login($username, $password, $codestring = '', $captcha = '')
{
    global $bdstoken;
    request('http://pan.baidu.com/');
    if ($codestring == '') {
        $captcha = loginCheck($username);
        if ($captcha) {
            $ret['errno'] = 257;
            $ret['code_string'] = $captcha;
            $ret['captcha'] = 'https://passport.baidu.com/cgi-bin/genimage?' . $captcha;
            return $ret;
        }
    }
    $guid = GUID();
    getToken($guid);
    //加密登录不太灵,不知道怎么回事,抽风似的,不用了
    /*$_key = request('https://passport.baidu.com/v2/getpublickey?token='.$bdstoken);
      $key = json_decode(str_replace("'", '"', $_key['body']), true);
      if (!isset($key['pubkey']) || !isset($key['key'])) {
        echo '无法获取public key!请联系开发者!服务器返回:'.$_key['body'];
        die();
      }
      $pubkey = openssl_pkey_get_public($key['pubkey']);
      openssl_public_encrypt($password, $crypted_password, $pubkey);
      $crypted_password = base64_encode($crypted_password);
      $result = request('https://passport.baidu.com/v2/api/?login', "charset=utf-8&tpl=netdisk&subpro=netdisk_web&apiver=v3&tt=".time()."&token=$bdstoken&loginmerge=true&safeflg=0&codestring=$codestring&detect=1&foreignusername=&gid=&idc=&isPhone=&loglogintype=pc_loginBasic&logintype=basicLogin&mem_pass=on&password=$crypted_password&rsakey={$key['key']}&crypttype=12&quick_user=0&safeflag=0&staticpage=http://pan.baidu.com/res/static/thirdparty/pass_v3_jump.html&u=http://pan.baidu.com/&username=$username&countrycode=&verifycode=$captcha&gid=$guid&ppui_logintime=".mt_rand(10000, 15000));*/
    $result = request('https://passport.baidu.com/v2/api/?login', "charset=utf-8&tpl=netdisk&subpro=netdisk_web&apiver=v3&tt=" . time() . "&token={$bdstoken}&loginmerge=true&safeflg=0&codestring={$codestring}&detect=1&foreignusername=&gid=&idc=&isPhone=&loglogintype=pc_loginBasic&logintype=basicLogin&mem_pass=on&password={$password}&quick_user=0&safeflag=0&staticpage=http://pan.baidu.com/res/static/thirdparty/pass_v3_jump.html&u=http://pan.baidu.com/&username={$username}&countrycode=&verifycode={$captcha}&gid={$guid}&ppui_logintime=" . mt_rand(10000, 15000));
    parse_str(findBetween($result['body'], 'href += "', '"'), $output);
    if (!isset($output['err_no'])) {
        echo '无法登录!请联系开发者!服务器返回:<xmp>' . $result['body'];
        die;
    }
    $ret['errno'] = $output['err_no'];
    if (strlen($output['codeString'])) {
        $ret['code_string'] = $output['codeString'];
        $ret['captcha'] = 'https://passport.baidu.com/cgi-bin/genimage?' . $output['codeString'];
    }
    return $ret;
}
Esempio n. 10
0
function pre_submission_handler($form)
{
    $guid = GUID();
    $_POST['input_3'] = $guid;
    $_POST['input_5'] = 'http://automationlab.com.au/checkin?q=http://app.automationlab.com.au/q/' . $guid . '/[Email]';
}
Esempio n. 11
0
/**
 * $value: 付款明细,$room:房间信息,$chips: 认筹信息,$id :tradeGUID,
 * 获得供款明细的插入规则
 * 返回 array() $fee,
 */
function get_s_feearray($value, $room, $chips)
{
    $fee = array('FeeGUID' => GUID(), 'ProjGUID' => $chips['projguid'], 'TradeGUID' => $chips['qrcode'], 'ItemName' => $value['ItemName'], 'ItemType' => $value['FeeSort'], 'Sequence' => $value['Sequence'], 'Bz' => '人民币', 'ExRate' => 1.0, 'JmLateFee' => 0, 'IsChg' => 0, 'OutAmount' => 0, 'OutRmbAmount' => 0, 'DsAmount' => 0, 'RmbDsAmount' => 0, 'IsBcXyKx' => 0);
    if ($value['Action'] == "签署认购书") {
        $add = '+' . (empty($value['ActiDays']) ? '' : "{$value['ActiDays']} days") . (empty($value['ActiMonth']) ? '' : "{$value['ActiMonth']} months");
        $fee['lastDate'] = date("Y-m-d", strtotime($add, TIMESTAMP));
        $fee['lastDate'] = date("Y-m-d", strtotime('-1 days', strtotime($fee['lastDate'])));
    } else {
        $fee['lastDate'] = null;
    }
    //增加比例存储
    $fee['Rate'] = $value['Rate'];
    // 是否扣除定金交款
    if ($value['IsDeductEarnest'] == 1) {
        // 判断是打折,还是金额,
        if ($value['Rate'] > 0) {
            $fee['Amount'] = $room['RoomTotal'] * $value['Rate'] / 100.0 - $chips['ordermoney'] - $chips['premoney'];
        } else {
            $fee['Amount'] = $value['Amount'] - $chips['ordermoney'] - $chips['premoney'];
        }
    } else {
        if ($value['Rate'] > 0) {
            $fee['Amount'] = $room['RoomTotal'] * $value['Rate'] / 100.0;
        } else {
            $fee['Amount'] = $value['Amount'];
        }
    }
    $fee['RmbAmount'] = $fee['Amount'];
    if ($fee['ItemName'] == "银行按揭") {
        //取万元整数
        $fee['Amount'] = intval($fee['RmbAmount'] / 10000) * 10000;
    }
    // 计算余额
    if ($fee['ItemName'] == '定金') {
        $fee['Ye'] = $fee['Amount'] - $chips['ordermoney'] - $chips['premoney'];
    } else {
        $fee['Ye'] = $fee['Amount'];
    }
    // 计算RmbYe
    $fee['RmbYe'] = $fee['Ye'];
    //    if ($fee['Ye'] == 0) {
    //        $fee['Flag'] = '√';
    //    } else {
    //        $fee['Flag'] = null;
    //    }
    return $fee;
}
 /**
  * 添加商品
  *
  */
 public function create()
 {
     if (IS_POST) {
         $base_attr = $this->getBaseAttr();
         $storeid = I('storeid', 0);
         if ($storeid == 0) {
             $this->error("缺少商铺ID参数");
         }
         $attrext = array('isPostFree' => 1, 'isHasReceipt' => I('post.ishasreceipt', 0), 'isUnderGuaranty' => I('post.isunderguaranty', 0), 'isSupportReplace' => I('post.issupportreplace', 0), 'location' => array('country' => '中国', 'province' => '四川省', 'city' => '内江市', 'address' => '威远县'));
         $sku_list = $this->getSKUList();
         $product = array('product_base' => $base_attr, 'attrext' => $attrext, 'sku_list' => $sku_list);
         $product_id = GUID();
         $result = $this->addToProduct($storeid, $product_id, $product);
         if ($result['status']) {
             $this->success("操作成功!", U('Admin/WxshopProduct/index', array('storeid' => $storeid)));
         } else {
             $this->error($result['info']);
         }
     } else {
         $catename = I('catename', '');
         $storeid = I('storeid', 0);
         $cates = I("get.cates", '');
         $cates = explode("_", $cates);
         if (count($cates) <= 1) {
             $this->error("商品类目错误!");
         }
         $this->assign("cate_id", $cates[count($cates) - 1]);
         $this->assign("storeid", $storeid);
         $this->assign("catename", $catename);
         $this->assign("cates", I('cates', ''));
         $this->display();
     }
 }
Esempio n. 13
0
$res = array('ok' => false, 'msg' => '');
//检查项目授权,是否允许项目传输
if ($func == 'get_token') {
    //检查是否存在token?
    $guid = trim($_GPC['guid']);
    $key = 'sync_' . $guid;
    $token = memcached_get($key);
    if ($token == '') {
        $project = db_getProject($guid, true);
        if (empty($project)) {
            $res['msg'] = '无效的参数';
            returnJson($res);
        }
        if (memcached_addKey('Add' . $key)) {
            $data = array('guid' => $guid, 'ip' => CLIENT_IP);
            $token = GUID();
            memcached_set($key, $token, 300);
            memcached_set('sync_t_' . $token, $data, 300);
            memcached_delete('Add' . $key);
            $res['ok'] = true;
            $res['token'] = $token;
        } else {
            $res['msg'] = '无法增加cache数据';
        }
    } else {
        $res['msg'] = '此项目已有下载未完成,请等5分钟再试';
    }
    returnJson($res);
}
if ($func == 'release_token') {
    $token = $_GPC['token'];
Esempio n. 14
0
     $project = $_W['project'];
     $banks = biz_getBanks($project['BUGUID']);
     $project = biz_getProject($project['projguid']);
     $bank = biz_unserializer($project, 'bank');
 }
 //是否允许修改
 if (checksubmit()) {
     if (empty($inputBill)) {
         message('认筹单无效数据,不能交款!', $url, 'error');
     }
     //保存中
     $updateMoney = biz_getInput2Bill($inputBill);
     if (empty($inputBill['BillGUID'])) {
         // 插入票据单相关信息
         if ($inputBill['Money'] > 0) {
             $inputBill['BillGUID'] = GUID();
             if (!biz_addBill($chips, $inputBill)) {
                 $updateMoney = false;
                 message('认筹单诚意金交款,保存数据失败!', $url, 'error');
             }
         }
     } else {
         $update = array('Money' => $inputBill['Money'], 'Details' => iserializer($inputBill['finance']));
         $updateMoney = pdo_update('bill', $update, array('BillGUID' => $inputBill['BillGUID']));
     }
     if ($updateMoney !== false) {
         $premoney = $inputBill['Money'];
         foreach ($printed_Bills as $b) {
             $premoney += $b['Money'];
         }
         $data = array('status' => $status['付款'], 'changetime' => TIMESTAMP, 'pretype' => 1, 'premoney' => $premoney, 'preattach' => $inputBill['BillGUID']);
Esempio n. 15
0
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
include_once 'IwalletConnector.class.php';
$paylive = "https://i-walletlive.com/payLIVE/detailsnew.aspx?pay_token=";
$ns = "http://www.i-walletlive.com/payLIVE";
$wsdl = "https://i-walletlive.com/paylive/paymentservice.asmx?wsdl";
$api_version = "1.4";
$merchant_email = "*****@*****.**";
$merchant_secret_key = "yourmerchantkey";
$service_type = "C2B";
$integration_mode = true;
$iwl = new IwalletConnector($ns, $wsdl, $api_version, $merchant_email, $merchant_secret_key, $service_type, $integration_mode);
$order_id = GUID();
$comment1 = "";
$comment2 = "";
$order_items = array();
$chromecast_unit_price = 150;
$chromecast_quantity = 2;
$chromecast_subtotal = $chromecast_unit_price * $chromecast_quantity;
$organza_unit_price = 50;
$organza_quantity = 2;
$organza_subtotal = $organza_unit_price * $organza_quantity;
$order_items[0] = $iwl->buildOrderItem("001", "chromecast", $chromecast_unit_price, $chromecast_quantity, $chromecast_subtotal);
$order_items[1] = $iwl->buildOrderItem("002", "organza", $organza_unit_price, $organza_quantity, $organza_subtotal);
$sub_total = $chromecast_subtotal + $organza_subtotal;
$shipping_cost = 30;
$tax_amount = 0;
$total = $sub_total + $shipping_cost + $tax_amount;
Esempio n. 16
0
function ugf_form($form_id)
{
    global $wpdb;
    $sql = "select * from " . $wpdb->prefix . "ugf_forms where id = '%d'";
    $psql = $wpdb->prepare($sql, $form_id);
    $row = $wpdb->get_row($psql);
    if (!$row->enable_form) {
        return;
    }
    $form_start_date = $row->form_start_date;
    $form_end_date = $row->form_end_date;
    $cdate = date('Y-m-d');
    $show = false;
    if ($form_start_date == '0000-00-00' && $form_end_date == '0000-00-00') {
        $show = true;
    } else {
        if ($form_start_date != '0000-00-00' && $form_end_date != '0000-00-00') {
            if ($form_start_date <= $cdate && $form_end_date >= $cdate) {
                $show = true;
            }
        } else {
            if ($form_start_date != '0000-00-00') {
                if ($form_start_date <= $cdate) {
                    $show = true;
                }
            } else {
                if ($form_end_date != '0000-00-00') {
                    if ($form_end_date >= $cdate) {
                        $show = true;
                    }
                }
            }
        }
    }
    if ($show == false) {
        return;
    }
    $captcha_msg = $row->captcha_msg;
    if (!$captcha_msg) {
        $captcha_msg = 'Please Enter text shown in the image';
    }
    $sql = "select * from " . $wpdb->prefix . "ugf_fields where form_id = '%d' order by ordering asc";
    $psql = $wpdb->prepare($sql, $form_id);
    $fields_row = $wpdb->get_results($psql);
    /*
    $row['form_name'];
    $row['post_method'];
    $row['form_prefix_html'];
    $row['form_postfix_html'];
    $row['form_classes'];
    $row['form_start_date'];
    $row['form_end_date'];
    */
    $html = '';
    if ($row->form_prefix_html) {
        $html .= $row->form_prefix_html;
    }
    if (isset($_SESSION['form_success'])) {
        $html .= $_SESSION['form_success'];
        $_SESSION['form_success'] = '';
    }
    $html .= '<form action="' . $_SERVER['REQUEST_URI'] . '" id="' . $row->form_name . '"  method="' . $row->post_method . '" ';
    if ($row->form_classes) {
        $html .= ' class="' . $row->form_classes . '" ';
    }
    $form_token = GUID();
    $_SESSION['form_token'] = $form_token;
    $html .= ' enctype="multipart/form-data">';
    $html .= '<input type="hidden" name="ugfform_id" value="' . $row->id . '">';
    $html .= '<input type="hidden" name="ugfform_token" value="' . $_SESSION['form_token'] . '">';
    $html .= '<input type="hidden" name="ugfform_url" value="' . $_SERVER['REQUEST_URI'] . '">';
    for ($i = 0; $i < count($fields_row); ++$i) {
        $field_type = $fields_row[$i]->field_type;
        $lbl_wrapper_class = $fields_row[$i]->lbl_wrapper_class;
        $field_wrapper_class = $fields_row[$i]->field_wrapper_class;
        $field_class = $fields_row[$i]->field_class;
        $field_id = $fields_row[$i]->id;
        $sql = "select * from " . $wpdb->prefix . "ugf_fields_attributes where field_id = '%d'";
        $psql = $wpdb->prepare($sql, $field_id);
        $attr_row = $wpdb->get_results($psql);
        $attr_array = array();
        for ($k = 0; $k < count($attr_row); ++$k) {
            $attr_array[$attr_row[$k]->attribute_name] = $attr_row[$k]->attribute_value;
        }
        $sql = "select * from " . $wpdb->prefix . "ugf_fields_validations where field_id = '%d'";
        $psql = $wpdb->prepare($sql, $field_id);
        $validation_row = $wpdb->get_results($psql);
        if ($field_type == 'text') {
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            $html .= '<input type="text" id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" name="ugf' . $fields_row[$i]->field_machine_name . '"';
            $html .= ' class="' . $field_class . '  fld-' . $fields_row[$i]->field_machine_name . '" ';
            if ($attr_array['size'] > 0) {
                $html .= ' size="' . $attr_array['size'] . 'px" ';
            }
            $html .= '>';
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
        }
        if ($field_type == 'select') {
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            $html .= '<select id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" name="ugf' . $fields_row[$i]->field_machine_name . '"';
            $html .= ' class="' . $field_class . '  fld-' . $fields_row[$i]->field_machine_name . '" ';
            for ($k = 0; $k < count($attr_row); ++$k) {
                if ($attr_row[$k]->attribute_name == 'options') {
                    $options = $attr_row[$k]->attribute_value;
                }
            }
            $html .= '>';
            $options_arr = explode(chr(13), $options);
            if (isset($attr_array['first_row_blank']) && $attr_array['first_row_blank'] == 1) {
                $html .= '<option value="" ></option>';
            }
            foreach ($options_arr as $item) {
                $kv = explode("|", $item);
                if (trim($kv[1]) != '') {
                    if (trim($attr_array['default']) == trim($kv[0])) {
                        $html .= '<option value="' . trim($kv[0]) . '" selected="selected">' . trim($kv[1]) . '</option>';
                    } else {
                        $html .= '<option value="' . trim($kv[0]) . '">' . trim($kv[1]) . '</option>';
                    }
                }
            }
            $html .= '</select>';
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
        }
        if ($field_type == 'radio') {
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            for ($k = 0; $k < count($attr_row); ++$k) {
                if ($attr_row[$k]->attribute_name == 'options') {
                    $options = $attr_row[$k]->attribute_value;
                }
            }
            $options_arr = explode(chr(13), $options);
            $default = '';
            if (isset($attr_array['default'])) {
                $default = $attr_array['default'];
            }
            foreach ($options_arr as $item) {
                $kv = explode("|", $item);
                $html .= ' <div class="' . $fields_row[$i]->field_machine_name . trim($kv[0]) . '">';
                $html .= '<input type="radio" id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . trim($kv[0]) . '" name="ugf' . $fields_row[$i]->field_machine_name . '"';
                $html .= ' class="' . $field_class . '  fld-' . $fields_row[$i]->field_machine_name . trim($kv[0]) . '" ';
                if ($default == trim($kv[0])) {
                    $html .= ' checked="checked" ';
                }
                $html .= ' value="' . trim($kv[0]) . '">&nbsp;&nbsp;' . trim($kv[1]) . '</div>';
            }
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
        }
        if ($field_type == 'checkbox') {
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            for ($k = 0; $k < count($attr_row); ++$k) {
                if ($attr_row[$k]->attribute_name == 'options') {
                    $options = $attr_row[$k]->attribute_value;
                }
            }
            $options_arr = explode(chr(13), $options);
            foreach ($options_arr as $item) {
                if ($item != '') {
                    $kv = explode("|", $item);
                    if (count($kv) > 0 && $kv[1] != '') {
                        $html .= ' <div class="' . $fields_row[$i]->field_machine_name . trim($kv[0]) . '"> <input type="checkbox" id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . trim($kv[0]) . '" name="ugf' . $fields_row[$i]->field_machine_name . '[]"';
                        $html .= ' class="' . $field_class . '  fld-' . $fields_row[$i]->field_machine_name . trim($kv[0]) . '" ';
                        $html .= 'value="' . trim($kv[0]) . '">&nbsp;&nbsp;' . trim($kv[1]) . '</div>';
                    }
                }
            }
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
        }
        if ($field_type == 'date') {
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            $html .= '<input type="text" id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" name="ugf' . $fields_row[$i]->field_machine_name . '"';
            $html .= ' class="' . $field_class . ' fld-' . $fields_row[$i]->field_machine_name . '" ';
            $html .= '>';
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
            $date_format = 'mm/dd/yy';
            if (isset($attr_array['date_format'])) {
                $date_format = $attr_array['date_format'];
            }
            $html .= '<script>';
            $html .= 'jQuery(function() {';
            $html .= 'jQuery( "#ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" ).datepicker({';
            $html .= 'changeMonth: true,';
            $html .= 'changeYear: true,';
            $html .= 'dateFormat: "' . $date_format . '"';
            $html .= '});';
            $html .= '});';
            $html .= '</script>';
        }
        if ($field_type == 'file' || $field_type == 'image') {
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            $html .= '<input type="file" id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" name="ugf' . $fields_row[$i]->field_machine_name . '"';
            $html .= ' class="' . $field_class . '" ';
            for ($k = 0; $k < count($attr_row); ++$k) {
            }
            $html .= '>';
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
        }
        if ($field_type == 'textarea') {
            $rows = $attr_array['rows'];
            $cols = $attr_array['cols'];
            if (!$rows) {
                $rows = 3;
            }
            if (!$cols) {
                $cols = 30;
            }
            $html .= '<div class="ufg-control">';
            $html .= '<div class="ufg-control-label ugf-' . $fields_row[$i]->lbl_placement . ' ' . $lbl_wrapper_class . '">';
            $html .= '<label for="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" >';
            $html .= $fields_row[$i]->label_prefix;
            $html .= $fields_row[$i]->field_label;
            $html .= $fields_row[$i]->label_suffix;
            $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="ufg-control-input ' . $field_wrapper_class . '">';
            $html .= $fields_row[$i]->field_prefix_html;
            $html .= '<textarea id="ugf-' . $form_id . '-' . $fields_row[$i]->field_machine_name . '" name="ugf' . $fields_row[$i]->field_machine_name . '"';
            $html .= ' class="' . $field_class . ' ' . $fields_row[$i]->field_machine_name . '" ';
            $html .= ' rows="' . $rows . '" ';
            $html .= ' cols="' . $cols . '" ';
            for ($k = 0; $k < count($attr_row); ++$k) {
            }
            $html .= '>';
            $html .= '</textarea>';
            if (isset($_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name])) {
                $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error'][$fields_row[$i]->field_machine_name] . '</div>';
            }
            $html .= $fields_row[$i]->field_postfix_html;
            $html .= '</div>';
            $html .= '</div>';
        }
    }
    $url = plugins_url() . '/data-collection-form';
    if ($row->captcha == 1) {
        $html .= '<div class="ufg-control">';
        $html .= '<div class="captch-msg">' . $captcha_msg . '</div>';
        $html .= '<div class="captch-input">';
        $html .= '<input name="ugfcaptcha" type="text">';
        if (isset($_SESSION['ugform']['error']['ugfcaptcha'])) {
            $html .= '<div class="ugf-error">' . $_SESSION['ugform']['error']['ugfcaptcha'] . '</div>';
        }
        $html .= '</div>';
        $html .= '<div class="captch-img">';
        $html .= '<img src="' . $url . '/captcha.php" />';
        $html .= '</div>';
        $html .= '</div>';
    }
    $html .= '<div class="ufg-control"><button type="submit" >Submit</button></div>';
    $html .= '</form>';
    if ($row->form_postfix_html) {
        $html .= $row->form_postfix_html;
    }
    $_SESSION['ugform']['error'] = '';
    return $html;
}
Esempio n. 17
0
 public function doWebTemplate()
 {
     global $_W, $_GPC;
     $op = !empty($_GPC['op']) ? $_GPC['op'] : 'list';
     $printtype = biz_getDictionary('printtype');
     if ($op == 'list') {
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $table = 'printtemplate';
         $sql = "SELECT * FROM " . tablename($table) . " limit " . ($pindex - 1) * $psize . "," . $psize;
         $list = pdo_fetchall($sql);
         $total = pdo_fetchcolumn(" select count(*) from " . tablename($table));
         $pager = pagination($total, $pindex, $psize);
         include $this->template('template_list');
         exit;
     }
     if ($op == 'delete') {
         $this->CheckRight('deltemp');
         $id = $_GPC['id'];
         $template = db_getPrintTemplate($id);
         if (!empty($template)) {
             pdo_delete('printtemplate', array('id' => $template['id']));
             exit('success');
         } else {
             exit('无效数据!');
         }
     }
     if ($op == 'down') {
         $id = $_GPC['id'];
         $template = db_getPrintTemplate($id);
         header("Cache-Control:must-revalidate,post-check=0,pre-check=0");
         header("Content-Type:application/force-download");
         header("Content-Type: application/vnd.ms-word;charset=UTF-8");
         header("Content-Type:application/octet-stream");
         header("Content-Type:application/download");
         $ua = $_SERVER["HTTP_USER_AGENT"];
         $filename = $template['title'] . ".docx";
         if (preg_match("/MSIE/", $ua)) {
             $filename = urlencode($filename);
             header('Content-Disposition: attachment; filename=' . $filename);
         } else {
             header('Content-Disposition: attachment; filename=' . $filename);
         }
         header("Content-Transfer-Encoding:binary");
         echo base64_decode($template['content']);
         exit;
     }
     load()->web('print');
     if ($op == 'post') {
         $this->CheckRight('addtemp');
         if (checksubmit()) {
             if (!empty($_FILES['wordfile']['name'])) {
                 if ($_FILES['wordfile']['error'] != 0) {
                     message('文件上传失败,请重试!', $this->createWebUrl('template', array('op' => 'post')), 'error');
                 }
             } else {
                 message('请选择要上传的模板!', $this->createWebUrl('template', array('op' => 'post')), 'warning');
             }
             $word = GetUploadFile('wordfile');
             if (empty($word)) {
                 message('上传文件失败,目录无写入权限!', $this->createWebUrl('template', array('op' => 'post')), 'error');
             }
             $tags = GetTagsOfXml($word);
             if (empty($tags)) {
                 message('无效的模板文件,无法读取标签!', $this->createWebUrl('template', array('op' => 'post')), 'error');
             }
             $data = array('id' => GUID(), 'title' => trim($_GPC['title']), 'printtype' => $_GPC['printtype'], 'tags' => iserializer($tags), 'content' => base64_encode(file_get_contents($word)), 'tagsnum' => count($tags), 'status' => '0', 'createtime' => TIMESTAMP);
             @unlink($word);
             if (empty($data['title'])) {
                 $data['title'] = $_FILES['wordfile']['name'];
             }
             if (!empty($_GPC['onlyCurr'])) {
                 $data['project'] = $_W['project']['projguid'];
             }
             pdo_insert('printtemplate', $data);
             //$test=biz_Print_getTemplateById($data['id']);
             message('保存数据成功!', $this->CreateWebUrl('template'));
         }
         include $this->template('template_post');
         exit;
     }
     if ($op == 'tags') {
         $id = $_GPC['id'];
         $template = db_getPrintTemplate($id, true);
         if (empty($template)) {
             if ($_W['isajax']) {
                 echo '无效参数,无法获取模板信息';
                 exit;
             }
         }
         $disable = !empty($template['status']);
         $url = $this->createWebUrl('template', array('op' => $op, 'id' => $id));
         $map = $template['datamap'];
         $fields = biz_Print_getDataField($template['printtype']);
         if (empty($map)) {
             $map = array();
             foreach ($template['tags'] as $t) {
                 $map[$t] = '';
             }
         }
         $json = json_encode($map);
         if ($_W['isajax']) {
             include $this->template('tagEdit');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $map = json_decode(htmlspecialchars_decode($_GPC['json']));
             $map = object_to_array($map);
             if (!$disable) {
                 $update = array('datamap' => iserializer($map));
                 pdo_update('printtemplate', $update, array('id' => $id));
                 message('模板标签数据已配置', $this->createWebUrl('template'));
             } else {
                 message('模板已启用,不允许修改', $this->createWebUrl('template'));
             }
         }
     }
     if ($op == 'set') {
         $this->CheckRight('tag');
         $id = $_GPC['id'];
         $template = db_getPrintTemplate($id, true);
         if (empty($template)) {
             message('无效打印模板', $this->createWebUrl('template'), 'error');
         }
         $disable = !empty($template['status']);
         $url = $this->createWebUrl('template', array('op' => 'set', 'id' => $id));
         $map = $template['datamap'];
         $fields = biz_Print_getDataField($template['printtype']);
         if (empty($map)) {
             $map = array();
             foreach ($template['tags'] as $t) {
                 $map[$t] = '';
             }
         }
         if ($_W['token'] == $_GPC['token']) {
             if (!$disable) {
                 $update = array('datamap' => iserializer($_GPC['map']));
                 pdo_update('printtemplate', $update, array('id' => $id));
                 message('模板标签数据已配置', $this->createWebUrl('template'));
             } else {
                 message('模板已启用,不允许修改', $this->createWebUrl('template'));
             }
         }
         include $this->template('tagSet2');
     }
 }
Esempio n. 18
0
     } else {
         if ($step == 2) {
             $user_info = $_GPC['user'];
             $input_save = base64_encode(iserializer($user_info));
             $step = 3;
         } else {
             if ($step == 3) {
                 $data = $_GPC['chips'];
                 //处理销售人员信息
                 $salesman = biz_getStationUser($_W['project']['projguid'], false);
                 $data['salesmanGUID'] = $data['sales'];
                 $data['salesman'] = $salesman[$data['sales']]['UserName'];
                 $data['user'] = iunserializer(base64_decode($_GPC['user']));
                 $data['projguid'] = $_W['project']['projguid'];
                 unset($data['sales']);
                 $data['qrcode'] = GUID();
                 //$data['qrimage']=$this->geneQrcodeImg($data['qrcode']);
                 $data['status'] = 1;
                 $result = biz_saveChips($data);
                 if ($result['result']) {
                     message('数据增加成功!', $this->createWebUrl($do));
                 } else {
                     message('数据保存出错:' . $result['msg'], $this->createWebUrl($do), 'error');
                 }
             }
         }
     }
 }
 if ($step == 2) {
     $cardTypes = biz_getDictionary('CardType');
     $khTypes = biz_getDictionary('kehuType');
Esempio n. 19
0
function uploadImage($file)
{
    $name = $file['name'];
    $size = $file['size'];
    $tmp_l = $file['tmp_name'];
    $tn = explode(".", $name);
    $ext = end($tn);
    $allowed_extensions = explode(",", getSetting("imageexts"));
    $gid = GUID(50);
    $gname = sprintf("../../images/%s.%s", $gid, $ext);
    while (file_exists($gname)) {
        $gid = GUID(50);
        $gname = sprintf("../../images/%s.%s", $gid, $ext);
    }
    // valid name, proceed
    if (in_array($ext, $allowed_extensions)) {
        $result = move_uploaded_file($tmp_l, $gname);
        if ($result) {
            return sprintf("%s.%s", $gid, $ext);
        }
    }
    return -1;
}
Esempio n. 20
0
function erp_Write_Customer($chips)
{
    $write = false;
    $project = biz_getProject($chips['projguid']);
    $fields = array('CstGUID', 'CstName', 'CstType', 'KhFl', 'CardID', 'OfficeTel', 'HomeTel', 'MobileTel', 'PostCode', 'Address', 'CstType', 'Gender', 'CardType', 'WorkAddr', 'Country', 'CompanyPhone', 'signguid');
    //要检查客户是否已录入
    $info = biz_getChipsCustomerInfo($chips);
    $list = explode(',', $info['guid']);
    foreach ($list as $cid) {
        $customer = biz_getCustomerInfo(array('CstGUID' => $cid));
        if (empty($customer['erp'])) {
            //$customer['CreatedBy']=$chips['creator'];
            $customer['CstType'] = '个人';
            //$customer['KhFl']='普通客户';
            $customer['signguid'] = $chips['projguid'];
            $write = MsSql()->insertObject('p_Customer', array_elements($fields, $customer));
            // 生成CstAttach(客户项目对应表)
        }
        $exist = MsSql()->fetch('select * from p_CstAttach where ' . " CstGUID='{$cid}' and ProjGUID='{$chips['projguid']}'");
        if ($write && empty($exist)) {
            $attach = array('CstAttachGUID' => GUID(), 'CstGUID' => $cid, 'ProjGUID' => $chips['projguid'], 'BUGUID' => $project['BUGUID'], 'signguid' => $chips['projguid']);
            $write = MsSql()->insertObject('p_CstAttach', $attach);
            if ($write === false) {
                logging('写入p_CstAttach出错', $cid);
            }
        }
    }
    return $write;
}
Esempio n. 21
0
    }
    # проверяем, не сущестует ли пользователя с таким именем
    $query = mysql_query("SELECT COUNT(id) FROM users WHERE email='" . mysql_real_escape_string($email) . "'");
    //or die ("<br>Invalid query: " . mysql_error());
    if (mysql_result($query, 0) > 0) {
        $err[] = "User with this email already exists in the system.";
        //Пользователь с таким логином уже существует в базе данных
    }
    # Если нет ошибок, то добавляем в БД нового пользователя
    if (count($err) == 0) {
        $pswd = mb_strtolower(trim($_POST['password']));
        $salt = substr(md5($email), 10, 20) . "";
        $password = md5(md5($pswd) . $salt);
        mysql_query("INSERT INTO users SET email='" . $email . "', pswrd='" . $password . "'");
        $uid = (string) mysql_insert_id();
        $newVerCode = GUID();
        mysql_query("INSERT INTO verifi (idusr, vercode) VALUES ({$uid}, '{$newVerCode}');");
        // Отправляем письмо с проверочным адресом
        sendEMail(EMAIL_BOT, $email, "Verification PaperboD*", "Verification KEY: " . $newVerCode . "<br/><a href='" . URL_SITE_FULL . "/verifi/?k=" . $newVerCode . "'>Go verification</a>");
        header("Location: /login/");
        exit;
    }
}
require_once '../h.php';
?>

      <form class="form-signin" role="form" method="POST" action="">
        <h2 class="form-signin-heading">Please sign up</h2>
        <input type="email" name="email" id="reg_inp" class="form-control" placeholder="Email address" required autofocus>
        <input type="password" name="password" id="reg_inp" class="form-control" placeholder="Password" required>
        By clicking "Sign up", you agree to our <a href="#" data-toggle="modal" data-target="#myModalTerms">terms</a> of service.
Esempio n. 22
0
function GetUploadFile($fileTag)
{
    global $_W;
    $filename = $_FILES[$fileTag]['tmp_name'];
    $dest = IA_ROOT . '/' . $_W['config']['upload']['attachdir'] . '/' . GUID() . '.tmp';
    @move_uploaded_file($filename, $dest);
    return file_exists($dest) ? $dest : false;
}
Esempio n. 23
0
<?php

function GUID()
{
    if (function_exists('com_create_guid') === true) {
        return trim(com_create_guid(), '{}');
    }
    return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
echo GUID() . PHP_EOL;
Esempio n. 24
0
require_once './../class/NewsletterSubscriberManager.class.php';
require_once './../includes/functions.inc.php';
require_once './../includes/SSMTP.inc.php';
?>
	
<body>
<?php 
if (isset($_POST['newsletterSubscriberEmail'])) {
    include_once './partials/main.php';
    extract($_POST);
    if (!filter_var($newsletterSubscriberEmail, FILTER_VALIDATE_EMAIL)) {
        $emailError = Constants::BAD_FORMAT;
        include './partials/registerform.php';
    } else {
        $NSManager = new NewsletterSubscriberManager();
        $NewsletterSubscriber = new NewsletterSubscriber(GUID(), GUID(), $newsletterSubscriberEmail);
        if ($NSManager->Create($NewsletterSubscriber)) {
            $mail = SSMTP::getInstance();
            $mail->sendConfirmation($NewsletterSubscriber->getEmail(), $NewsletterSubscriber->getToken(), $NewsletterSubscriber->getUnregisterToken());
            include './partials/successRegistration.php';
        } else {
            $emailError = Constants::EMAIL_ALREADY_EXIST;
            include './partials/registerform.php';
        }
    }
} else {
    header('Location: index.php');
}
?>
		</body>			
<?php 
Esempio n. 25
0
 $allPostVars = $app->request->post();
 $CustomerID = $allPostVars['CustomerID'];
 $LocationID = $allPostVars['LocationID'];
 $TotalPrice = $allPostVars['TotalPrice'];
 $TotalSeconds = $allPostVars['TotalSeconds'];
 $CouponCodeID = $allPostVars['CouponCodeID'];
 $TaxID = $allPostVars['TaxID'];
 $SubTotal = $allPostVars['SubTotal'];
 $IsPaid = $allPostVars['IsPaid'];
 $IsApproved = 0;
 //$allPostVars['IsApproved'];
 $PaymentMethodID = $allPostVars['PaymentMethodID'];
 $ContentType = $allPostVars['ContentType'];
 $UploadedContentURL = $allPostVars['UploadedContentURL'];
 $BookingCode = $allPostVars['BookingCode'];
 $PublicKey = md5(GUID());
 $Comments = $allPostVars['Comments'];
 $TimeSlotID = $allPostVars['TimeSlotID'];
 $PriceID = $allPostVars['PriceID'];
 try {
     $db = getDB();
     $sth = $db->prepare("INSERT INTO nkvbooking (CustomerID,SubTotal,TimeSlotID,PriceID,LocationID,TotalPrice,TotalSeconds,CouponCodeID,TaxID,IsPaid,\n\t\tIsApproved,PaymentMethodID,UploadedContentURL,BookingCode,Comments,ContentType,PublicKey)\n            VALUES (:CustomerID,:SubTotal,:TimeSlotID,:PriceID,:LocationID,:TotalPrice,:TotalSeconds,:CouponCodeID,:TaxID,:IsPaid,\n\t\t:IsApproved,:PaymentMethodID,:UploadedContentURL,:BookingCode,:Comments,:ContentType,:PublicKey)");
     $sth->bindParam(':CustomerID', $CustomerID);
     $sth->bindParam(':SubTotal', $SubTotal);
     $sth->bindParam(':TimeSlotID', $TimeSlotID);
     $sth->bindParam(':PriceID', $PriceID);
     $sth->bindParam(':LocationID', $LocationID);
     $sth->bindParam(':TotalPrice', $TotalPrice);
     $sth->bindParam(':TotalSeconds', $TotalSeconds);
     $sth->bindParam(':CouponCodeID', $CouponCodeID);
     $sth->bindParam(':TaxID', $TaxID);
Esempio n. 26
0
        // retrieve user information
        $user = app('db')->table('accounts')->where('facebook_id', $fbuser->id)->first();
        // log this user in!
        if (!empty($user)) {
            $cookies->set_cookie($user->uid);
            return redirect('/profile.php?p=2&m=6');
        }
        // check if this email already exists and ask for password
        $user = app('db')->table('accounts')->where('email', 'like', $fbuser->email)->first();
        if (!empty($user)) {
            // TODO: for now, do nothing; ask user to reset password
            $query = http_build_query(['email' => $fbuser->email, 'facebook_id' => $fbuser->id]);
            return redirect('/index.php?' . $query . '#facebook-connect');
        }
        // attempt to sign this user up
        $uid = GUID(50);
        $salt = uniqid(mt_rand(), true);
        $user_id = app('db')->table('accounts')->insertGetId(['name' => $fbuser->name, 'uid' => $uid, 'email' => $fbuser->email, 'phone' => '', 'logintime' => '0', 'password_hash' => hash('sha512', $salt), 'password_salt' => $salt, 'session' => '0', 'facebook_id' => $fbuser->id]);
        if ($user_id > 0) {
            // manually set session; DB::update doesn't work for some reason
            $cookie_id = $cookies->set_cookie($uid);
            app('db')->table('accounts')->where('id', $user_id)->update(['session' => $cookie_id, 'logintime' => strval(time())]);
            return redirect('/profile.php?p=2&m=6');
        }
    } catch (Exception $e) {
        return 'An error occurred';
    }
    return redirect('/index.php?m=2');
});
// Social Authentication (Facebook) connect
$app->post('/accounts/facebook/connect', function () use($app) {
                preg_match_all($regexLinks, $entryMatches[4][$entryId], $linkMatches);
                foreach ($linkMatches[1] as $linkId => $linkTarget) {
                    $linkText = $linkMatches[2][$linkId];
                    if (strtolower($linkText) == "image") {
                        $imageTag = "info:import[" . strtolower($linkTarget) . "]";
                        $existingImageRow = $database->queryFirstRow("SELECT * FROM image WHERE Title=%s", $imageTag);
                        if ($existingImageRow) {
                            Log::info(sprintf("  Skipping import %s (exists)", $imageTag));
                            $images[] = $existingImageRow["Id"];
                        } else {
                            Log::info(sprintf("  Fetching %s (new)", $imageTag));
                            $imageData = file_get_contents($linkTarget);
                            $newImageId = insertOrUpdateImageByTitle($database, $imageData, $imageTag);
                            $images[] = $newImageId;
                        }
                    } else {
                        $links[] = array("Target" => $linkTarget, "Text" => $linkText);
                    }
                }
            }
            $database->insert("Info", array("Id" => GUID(), "InfoGroupId" => $groupId, "LastChangeDateTimeUtc" => $database->sqleval("utc_timestamp()"), "IsDeleted" => "0", "Title" => trim($entry), "Text" => trim($entryMatches[2][$entryId]), "Position" => $epos, "ImageIds" => json_encode($images), "Urls" => json_encode($links)));
            $epos++;
        }
    }
    Log::info("Commiting changes to database");
    $database->commit();
} catch (Exception $e) {
    var_dump($e->getMessage());
    Log::error("Rolling back changes to database");
    $database->rollback();
}
 private function randInt()
 {
     srand(GUID());
     return rand(10000000, 99999999);
 }
Esempio n. 29
0
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Forms</title>
	<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="dropzone">
	<div class="dropzone-message">Drop files there</div>
</div>
<div class="main-container">
	<form action="/?action=properties-card?guid=<?php 
echo GUID();
?>
" method="POST" class="form-container">
		<div>
			<label>Title</label>
			<input type="text" name="title">
			<div class="error">error</div>
		</div>
		<div>
			<label>Type</label>
			<select name="type">
				<option value="1">villa</option>
				<option value="2">apartment</option>
				<option value="3">land</option>
				<option value="4">hotel</option>
				<option value="5">commercial property</option>
				<option value="6">other</option>
			</select>