public static function Create($user_row, $uc = true) { if (function_exists('zuitu_uc_register') && $uc) { $pp = $user_row['password']; $em = $user_row['email']; $un = $user_row['username']; $ret = zuitu_uc_register($em, $un, $pp); if (!$ret) { return false; } } $user_row['password'] = self::GenPassword($user_row['password']); $user_row['create_time'] = $user_row['login_time'] = time(); $user_row['ip'] = Utility::GetRemoteIp(); $user_row['secret'] = md5(Utility::GenSecret(12)); $user_row['id'] = DB::Insert('user', $user_row); $_rid = abs(intval(cookieget('_rid'))); if ($_rid) { $r_user = Table::Fetch('user', $_rid); if ($r_user) { ZInvite::Create($r_user, $user_row); } } if ($user_row['id'] == 1) { Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => '')); } return $user_row['id']; }
public static function PayCardCreate($query) { $need = $query['quantity']; while (true) { $id = Utility::GenSecret(16, Utility::CHAR_NUM); $paycard = array('id' => $id, 'value' => $query['money'], 'consume' => 'N', 'expire_time' => $query['expire_time']); $need -= DB::Insert('paycard', $paycard) ? 1 : 0; if ($need <= 0) { return true; } } return true; }
public static function CardCreate($query) { $need = $query['quantity']; while (true) { $id = Utility::GenSecret(16, Utility::CHAR_NUM); $card = array('id' => $id, 'code' => $query['code'], 'partner_id' => $query['partner_id'], 'credit' => $query['money'], 'consume' => 'N', 'begin_time' => $query['begin_time'], 'end_time' => $query['end_time']); $need -= DB::Insert('card', $card) ? 1 : 0; if ($need <= 0) { return true; } } return true; }
public static function Create($user_row) { $user_row['password'] = self::GenPassword($user_row['password']); $user_row['create_time'] = $user_row['login_time'] = time(); $user_row['ip'] = Utility::GetRemoteIp(); $user_row['secret'] = md5(Utility::GenSecret(12)); $user_row['id'] = DB::Insert('user', $user_row); if ($_COOKIE['_rid']) { $r_user = Table::Fetch('user', $_COOKIE['_rid']); if ($r_user) { ZInvite::Create($r_user, $user_row); } } if ($user_row['id'] == 1) { Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => '')); } return $user_row['id']; }
public static function Create($order) { $team = Table::Fetch('team', $order['team_id']); $partner = Table::Fetch('partner', $order['partner_id']); $ccon = array('order_id' => $order['id']); $count = Table::Count('coupon', $ccon); while ($count < $order['quantity']) { $id = Utility::GenSecret(8, Utility::CHAR_NUM); $cv = Table::Fetch('coupon', $id); if ($cv) { continue; } $coupon = array('id' => $id, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::GenSecret(6, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time()); DB::Insert('coupon', $coupon); sms_coupon($coupon); $count = Table::Count('coupon', $ccon); } }
public static function Create($order) { if ($order['state'] == 'unpay') { return; } $team = Table::Fetch('team', $order['team_id']); $partner = Table::Fetch('partner', $order['partner_id']); $ccon = array('order_id' => $order['id']); $count = Table::Count('coupon', $ccon); while ($count < $order['quantity']) { $id = Utility::GenSecret(12, Utility::CHAR_NUM); $cv = Table::Fetch('coupon', $id); $coupon = array('id' => Utility::GenSecret(12, Utility::CHAR_NUM), 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::GenSecret(8, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time()); DB::Insert('coupon', $coupon); $count = Table::Count('coupon', $ccon); $user = Table::Fetch('user', $order['user_id']); mail_coupon($team, $partner, $order, $user, $coupon); } }
static public function Create($order) { $team = Table::Fetch('team', $order['team_id']); $partner = Table::Fetch('partner', $order['partner_id']); $ccon = array('order_id' => $order['id']); $count = Table::Count('coupon', $ccon); while($count<$order['quantity']) { /* 配合400验证,ID统一修改为12位伪随机数字,密码为6位数字 */ $id = (ceil(time()/100)+rand(10000000,20000000)); $id = Utility::VerifyCode($id); $cv = Table::Fetch('coupon', $id); if ($cv) continue; $coupon = array( 'id' => $id, 'user_id' => $order['user_id'], 'buy_id' => $order['buy_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::VerifyCode(Utility::GenSecret(6, Utility::CHAR_NUM)), 'expire_time' => $team['expire_time'], 'create_time' => time(), ); DB::Insert('coupon', $coupon); $count = Table::Count('coupon', $ccon); //send_goods_confirm_by_platform /** if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) { alipay_send_goods($order['trade_no']); } */ } sms_all_coupon($order); }
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; $id = abs(intval($_GET['id'])); $order = Table::Fetch('order', $id); if (!$order) { Session::Set('error', '订单不存在!'); redirect('index.php'); } $team = Table::Fetch('team', $order['team_id']); $team['state'] = team_state($team); if ($team['close_time']) { redirect("team.php?id={$id}"); } /* generator unique pay_id */ if (!($order['pay_id'] && (preg_match('#-(\\d+)-(\\d+)-#', $order['pay_id'], $m) && ($m[1] == $order['id'] && $m[2] == $order['quantity'])))) { $randid = strtolower(Utility::GenSecret(4, Utility::CHAR_WORD)); $pay_id = "go-{$order['id']}-{$order['quantity']}-{$randid}"; Table::UpdateCache('order', $order['id'], array('pay_id' => $pay_id)); } /* end */ include template('wap_check');
Session::Set('notice', "表-{$table}-数据备份完成"); } else { Session::Set('error', "备份表-{$table}-失败"); } _go_reload(); } } else { //分卷备份 if (!$_POST['filesize']) { Session::Set('error', "请填写备份文件分卷大小!"); _go_reload(); } $sql = null; $sql .= backup_make_header($table); $p = 1; $filenamep = date("Ymd") . Utility::GenSecret(4) . "_{$table}"; $query = DB::Query("SELECT * FROM `{$table}`"); while ($r = DB::NextRecord($query)) { $sql .= backup_make_record($table, $r); if (strlen($sql) >= $_POST['filesize'] * 1024) { $filename = $filenamep . ("_v" . $p . ".sql"); if (true !== backup_write_file($sql, $filename)) { Session::Set('error', "备份表-{$table}-{$p}-失败"); _go_reload(); } $p++; $sql = null; } } if ($sql) { if (true !== backup_write_file($sql, $filename)) {
public function genInviteCode() { $code = Utility::GenSecret(6, 1); return $this->where('invite_code="%s"', $code)->find() ? $this->genInviteCode() : $code; }
private function generateAuthParam($is_get = true) { $stamp = time(); $token = Utility::GenSecret(30); $signature = $this->getSignature($stamp, $token); if ($is_get) { $auth_param = '?accesskey=' . $this->api_key . '&stamp=' . $stamp . '&token=' . $token . '&signature=' . $signature . '&'; } else { $auth_param['accesskey'] = $this->api_key; $auth_param['stamp'] = $stamp; $auth_param['token'] = $token; $auth_param['signature'] = $signature; } return $auth_param; }
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(); if (is_post() && isset($_POST['giftpay'])) { if (!$_POST['from'] || !$_POST['to'] || !$_POST['amount']) { Session::Set('error', 'Please do not submit it untill finished.'); } $table = new Table('gift_card', $_POST); $table->code = Utility::GenSecret(8, 'mix'); $table->email = $_POST['gift_card']['delivery']['email_address']; $table->create_time = time(); $table->user_id = $login_user_id; $order_id = $table->Insert(array('user_id', 'from', 'to', 'message', 'amount', 'code', 'email', 'create_time', 'paytype')); if (!$order_id || !($order = Table::Fetch('gift_card', $order_id))) { die('404 Not Found'); } $randno = rand(1000, 9999); $total_money = moneyit($order['amount']); /* micdim: paypal support */ if ($order['paytype'] == 'paypal') { /* credit pay $credit = moneyit($order['origin'] - $total_money); if ($order['credit']!=$credit) { Table::UpdateCache('order', $order_id, array('credit'=>$credit,)); } end */ $_input_charset = 'utf-8'; //$service = 'create_direct_pay_by_user'; // what does it mean?? $partner = $INI['paypal']['mid']; $security_code = $INI['paypal']['sec'];
static public function createCardNo(){ $id = Utility::GenSecret(12, Utility::CHAR_NUM); return $id; }