Example #1
0
 public static function UseCard($order, $card_id)
 {
     if ($order['card_id']) {
         return self::ERR_ORDER;
     }
     $card = Table::Fetch('card', $card_id);
     if (!$card) {
         return self::ERR_NOCARD;
     }
     if ($card['consume'] == 'Y') {
         return self::ERR_USED;
     }
     $today = strtotime(date('Y-m-d'));
     if ($card['begin_time'] > $today || $card['end_time'] < $today) {
         return self::ERR_EXPIRE;
     }
     $team = Table::Fetch('team', $order['team_id']);
     if ($card['partner_id'] > 0 && $card['partner_id'] != $team['partner_id']) {
         return self::ERR_TEAM;
     }
     if ($team['card'] < $card['credit']) {
         return self::ERR_CREDIT;
     }
     $finalcard = $card['credit'] > $order['origin'] ? $order['origin'] : $card['credit'];
     Table::UpdateCache('order', $order['id'], array('card_id' => $card_id, 'card' => $finalcard, 'origin' => array("origin - {$finalcard}")));
     Table::UpdateCache('card', $card_id, array('consume' => 'Y', 'team_id' => $team['id'], 'order_id' => $order['id'], 'ip' => Utility::GetRemoteIp()));
     return true;
 }
 public function submit_reg()
 {
     $email = htmlspecialchars($this->_param("email"));
     if (!Utility::ValidEmail($email)) {
         Session::Set("error", "邮箱格式有误");
         redirect("/register");
     }
     // $code = M("InviteCodes")->getByCode($this->_post('invite_code'));
     // if(!$code) {
     //     Session::Set("error", "无效邀请码");
     //     redirect("/register");
     // }
     $userModel = D("CmsUsers");
     if ($userModel->create()) {
         $userModel->username = $userModel->email;
         $userModel->password = D("CmsUsers")->genPassword($userModel->password);
         $userModel->secret = md5(generate_password());
         $userModel->ip = Utility::GetRemoteIp();
         $userModel->partner_id = intval($this->_param('partner_id'));
         $secret = $userModel->secret;
         $id = $userModel->add();
     } else {
         Session::Set("error", "注册失败,请重新尝试或者联系网站管理员");
         redirect("/register");
     }
     // 绑定邮箱到邀请码
     // $code_data['id'] = $code['id'];
     // $code_data['email'] = $this->_param("email");
     // $code_data['bind_time'] = date('Y-m-d H:i:s');
     // M("InviteCodes")->save($code_data);
     //发验证邮件
     $this->send_verify_mail($id, $email, $secret);
     redirect('/register/preview_verify_email?token=' . Crypt::en($id . '||' . $email));
 }
Example #3
0
 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'];
 }
Example #4
0
	static public function Consume($coupon,$store_id,$doer_id,$verifytype=4) {
		
		if ( !$coupon['consume']=='N' ) return false;
		$u = array(
			'ip' => Utility::GetRemoteIp(),
			'consume_time' => time(),
			'consume' => 'Y',
			'verifytype'=>$verifytype,
			'store_id'=>$store_id,
			'doer_id'=>$doer_id,	
		);
		
		DB::Update('order',$coupon['order_id'],array('had_consume'=>1));
		
		Table::UpdateCache('coupon', $coupon['id'], $u);
		//判断是否点评返利成功,点评并返利成功的订单的消费券可以继续返利
		$orderdp=DB::LimitQuery('order_dp',array(
					'condition'=>array('order_id'=>$coupon['order_id'],'has_return'=>1)
			));
		if(!empty($orderdp)){
			ZFlow::CreateFromCoupon($coupon);
		}
		
		ZCredit::CreateFromConsume($coupon);
		
		return true;
	}
Example #5
0
 public static function Consume($coupon)
 {
     if (!$coupon['consume'] == 'N') {
         return false;
     }
     $u = array('ip' => Utility::GetRemoteIp(), 'consume_time' => time(), 'consume' => 'Y');
     Table::UpdateCache('coupon', $coupon['id'], $u);
     ZFlow::CreateFromCoupon($coupon);
     return true;
 }
Example #6
0
 public static function IncreaseBan($ip)
 {
     $banned = M("BannedIp")->getByIp($ip);
     if ($banned) {
         $banned['count'] = $banned['count'] + 1;
         // $banned['date'] = date("Y-m-d H:i:s");
         M("BannedIp")->save($banned);
     } else {
         $param = array("ip" => Utility::GetRemoteIp(), "date" => date("Y-m-d H:i:s"), "count" => 1, "type" => "login");
         M("BannedIp")->add($param);
     }
 }
 public function saveVisit($module, $module_id, $extra_data)
 {
     //暂时去掉  2013年6月18日
     return;
     $insert['user_id'] = $this->getLoginUserId();
     $insert['ipaddress'] = Utility::GetRemoteIp();
     $insert['module'] = $module;
     // 分list,detail
     $insert['module_id'] = $module_id;
     // 如果是list 标示第几页,如果是detail,是detailid
     $insert['timestamp'] = time();
     $insert['extra_data'] = $extra_data;
     $obj = D('AdminVisits');
     $obj->create($insert);
     return $obj->add();
 }
Example #8
0
 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'];
 }
Example #9
0
 public static function Create($user_row, $uc = true)
 {
     $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(rand(1000000, 9999999) . time() . $user_row['email']);
     $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'];
 }
Example #10
0
 public static function CreateRenRen($user_row, $renren_uid, $uc = true)
 {
     if (function_exists('zuitu_uc_register') && $uc) {
         $pp = $user_row['password'];
         $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'] = $user_row['email'];
     $user_row['id'] = DB::Insert('user', $user_row);
     if ($user_row['id']) {
         $_rid = abs(intval(cookieget('_rid')));
         $user_renren_row['uid'] = $user_row['id'];
         $user_renren_row['renren_uid'] = $renren_uid;
         DB::Insert('user_renren', $user_renren_row);
     }
     return $user_row['id'];
 }
Example #11
0
File: team.php Project: noikiy/mdwp
				'condition' => array(
					'team_id' => $id,
					'user_id' => $login_user_id,
					'state' => 'unpay',
					'rstate' => 'normal',
					),
				'one' => true,
				));
}
/* end order */

/* change attentions */
$current_team = DB::LimitQuery('team', array('condition' => array('id' => $id),'select' => 'attention, ips'));
if(strpos($current_team[0]['ips'], Utility::GetRemoteIp()) === false){
	DB::Update('team', array('id' => $id), array(
	'ips' => '-'. Utility::GetRemoteIp(),
	'attention' => $current_team[0]['attention'] + 1,
	));
}
/* end change attentions */
/*kxx team_type */
if ($team['team_type'] == 'seconds') {
	die(include template('team_view_seconds'));
}
if ($team['team_type'] == 'goods') {
	die(include template('team_view_goods'));
}
/*xxk*/
$ll = $partner['longlat'];
if ($ll) list($lati,$longi) = preg_split('/[,\s]+/',$ll,-1,PREG_SPLIT_NO_EMPTY);
Example #12
0
 public static function Check_alifast($alipay_id, $alipay_name, $alipay_email = null)
 {
     $aliuser = DB::GetTableRow('user', array('alipay_id' => $alipay_id));
     if ($aliuser) {
         if (!empty($alipay_email)) {
             $email_user = DB::GetTableRow('user', array('email' => $alipay_email));
             if (!$email_user) {
                 Table::UpdateCache('user', $aliuser['id'], array('email' => $alipay_email));
             }
         }
         return $aliuser;
     }
     $user['username'] = $alipay_id;
     $user['realname'] = $alipay_name;
     $user['alipay_id'] = $alipay_id;
     if ($alipay_email) {
         $email_user = DB::GetTableRow('user', array('email' => $alipay_email));
         if (!$email_user) {
             $user['email'] = $alipay_email;
         }
     }
     $user['create_time'] = $user['login_time'] = time();
     $user['ip'] = Utility::GetRemoteIp();
     $ali_user['id'] = DB::Insert('user', $user);
     $aliuser = DB::GetTableRow('user', array('id' => $ali_user['id']));
     return $aliuser;
 }
Example #13
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
//今日接受调查人次
$daytime = strtotime(date('Y-m-d'));
$ip = Utility::GetRemoteIp();
$action = $_GET['action'] ? $_GET['action'] : '';
if ($action == 'addSuccess') {
    Session::Set('notice', '提交数据成功,感谢您的参与。');
    redirect(WEB_ROOT . '/vote/index.php');
}
$question_list = DB::LimitQuery('vote_question', array('condition' => array("`is_show` = '1'"), 'order' => 'ORDER BY `order` , id', 'size' => 100, 'offset' => $offset));
foreach ($question_list as $key => $question) {
    $options_list = DB::LimitQuery('vote_options', array('condition' => array("`question_id` = '{$question['id']}'", "`is_show` = '1'"), 'order' => 'ORDER BY `order` , id', 'size' => 100, 'offset' => $offset));
    $question_list[$key]['options_list'] = $options_list;
}
$pagetitle = '用户调查';
include template('vote_index');
Example #14
0
function pay_charge_gopay($total_money, $charge_id)
{
    global $INI;
    if ($total_money <= 0 || !$charge_id) {
        return null;
    }
    $tranCode = '8888';
    $merchantID = $INI['gopay']['mid'];
    $order_id = 'charge';
    $merOrderNum = $charge_id;
    //$merOrderNum = preg_replace('/\-/', '_', $merOrderNum);
    $tranAmt = $total_money;
    $ticketAmt = '';
    $feeAmt = '';
    $orgtranDateTime = '';
    $orgOrderNum = '';
    $authID = '';
    $orgtranAmt = '';
    $currencyType = '156';
    $merURL = $INI['system']['wwwprefix'] . '/order/gopay/return.php';
    $tranDateTime = date("YmdHis");
    $virCardNoIn = $INI['gopay']['acc'];
    $VerficationCode = $INI['gopay']['code'];
    $tranIP = Utility::GetRemoteIp();
    $msgExt = '';
    $isLocked = '';
    $virCardNo = '';
    $orgTxnStat = '';
    $orgTxnType = '';
    $actionUrl = 'https://www.gopay.com.cn/PGServer/Trans/WebClientAction.do';
    $source = "tranCode=[{$tranCode}]merchantID=[{$merchantID}]merOrderNum=[{$merOrderNum}]tranAmt=[{$tranAmt}]ticketAmt=[{$ticketAmt}]tranDateTime=[{$tranDateTime}]currencyType=[{$currencyType}]merURL=[{$merURL}]customerEMail=[]authID=[{$authID}]orgOrderNum=[{$orgOrderNum}]orgtranDateTime=[{$orgtranDateTime}]orgtranAmt=[{$orgtranAmt}]orgTxnType=[{$orgTxnType}]orgTxnStat=[{$orgTxnStat}]msgExt=[]virCardNo=[]virCardNoIn=[{$virCardNoIn}]tranIP=[{$tranIP}]isLocked=[]feeAmt=[{$feeAmt}]respCode=[]VerficationCode=[{$VerficationCode}]";
    $signValue = MD5($source);
    if (is_post() && $_POST['paytype'] != 'gopay') {
        $bankCode = $_POST['paytype'];
        $userType = '1';
    }
    return render('block_pay_gopay', array('order_id' => $order_id, 'tranCode' => $tranCode, 'merchantID' => $merchantID, 'merOrderNum' => $merOrderNum, 'tranAmt' => $tranAmt, 'ticketAmt' => $ticketAmt, 'feeAmt' => $feeAmt, 'orgtranDateTime' => $orgtranDateTime, 'orgOrderNum' => $orgOrderNum, 'authID' => $authID, 'orgtranAmt' => $orgtranAmt, 'currencyType' => $currencyType, 'merURL' => $merURL, 'tranDateTime' => $tranDateTime, 'virCardNoIn' => $virCardNoIn, 'tranIP' => $tranIP, 'msgExt' => $msgExt, 'isLocked' => $isLocked, 'virCardNo' => $virCardNo, 'orgTxnStat' => $orgTxnStat, 'orgTxnType' => $orgTxnType, 'signValue' => $signValue, 'bankCode' => $bankCode, 'userType' => $userType, 'actionUrl' => $actionUrl));
}
Example #15
0
    /* must */
    $sp_billno = $v_oid;
    $transaction_id = $v_mid . date('Ymd') . date('His') . rand(1000, 9999);
    $desc = $title;
    /* end */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $v_mid);
    $reqHandler->setParameter("cs", "UTF-8");
    $reqHandler->setParameter("sp_billno", $sp_billno);
    $reqHandler->setParameter("transaction_id", $transaction_id);
    $reqHandler->setParameter("total_fee", $v_amount);
    $reqHandler->setParameter("return_url", $v_url);
    $reqHandler->setParameter("desc", $desc);
    $reqHandler->setParameter("spbill_create_ip", Utility::GetRemoteIp());
    $reqUrl = $reqHandler->getRequestURL();
    include template('order_charge');
} else {
    if ($_POST['paytype'] == 'alipay') {
        $_input_charset = 'utf-8';
        $service = 'create_direct_pay_by_user';
        $partner = $INI['alipay']['mid'];
        $security_code = $INI['alipay']['sec'];
        $seller_email = $INI['alipay']['acc'];
        $sign_type = 'MD5';
        $out_trade_no = "charge-{$login_user_id}-{$now}-{$randno}";
        $return_url = $INI['system']['wwwprefix'] . '/order/alipay/return.php';
        $notify_url = $INI['system']['wwwprefix'] . '/order/alipay/notify.php';
        $show_url = $INI['system']['wwwprefix'] . "/credit/index.php";
        $subject = $title;
Example #16
0
File: sms.php Project: noikiy/mdwp
                                                if (empty($verifycode)) {
                                                    json('绑定验证码不能为空', 'alert');
                                                }
                                                $exists = Table::Count('user', array('mobile' => $mobile));
                                                if ($exists >= 1) {
                                                    json('此手机号已有会员绑定', 'alert');
                                                }
                                                //验证手机号验证码和IP
                                                $verify = DB::GetQueryResult("SELECT mobile FROM verifycode WHERE mobile='" . $mobile . "' AND verifycode='" . $verifycode . "' AND getip='" . Utility::GetRemoteIp() . "' AND status=4 AND dateline>'" . (time() - 86400) . "'");
                                                //验证码一天内有效
                                                if (!$verify) {
                                                    json('手机号和绑定验证码不匹配', 'alert');
                                                } else {
                                                    DB::GetQueryResult("UPDATE user SET mobile='" . $mobile . "' WHERE id=" . $login_user['id'] . "");
                                                    //更新会员手机号数据
                                                    DB::GetQueryResult("UPDATE verifycode SET reguid=" . $login_user['id'] . ",regdateline='" . time() . "',status=5 WHERE mobile='" . $mobile . "' AND verifycode='" . $verifycode . "' AND getip='" . Utility::GetRemoteIp() . "' AND status=4 AND dateline>'" . (time() - 86400) . "'");
                                                    //更新验证码记录表数据
                                                }
                                                json('手机号:' . $mobile . ' 绑定成功', 'alert');
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 public function new_feedback()
 {
     $last = M('Feedbacks')->order('id desc')->getBySourceIp(Utility::GetRemoteIp());
     if (time() - $last['create_time'] < 10) {
         return json("send_enquiry_callback(0, '发的太快了,等10秒再发')", 'eval');
     }
     $data['user_email'] = $this->_param("email");
     $data['user_phone'] = $this->_param("phone");
     if (!Utility::ValidEmail($data['user_email'])) {
         return json("send_enquiry_callback(0, '邮箱格式有误')", 'eval');
     }
     if (!Utility::IsMobile($data['user_phone'])) {
         return json("send_enquiry_callback(0, '手机格式有误')", 'eval');
     }
     if (!Utility::CaptchaCheck($this->_param('verify'))) {
         return json("send_enquiry_callback(0, '验证码有误')", 'eval');
     }
     $data['user_name'] = $this->_param("name");
     $data['title'] = $this->_param("title");
     $data['message'] = $this->_param("message");
     $data['create_time'] = time();
     $data['source_ip'] = Utility::GetRemoteIp();
     $data['source_url'] = $_SERVER['HTTP_REFERER'];
     $new_id = M("Feedbacks")->saveOrUpdate($data);
     return json("send_enquiry_callback(1, '发送成功! 非常感谢您的留言!')", 'eval');
 }
Example #18
0
<?php

require_once 'globalparam.php';
require_once 'globalfunction.php';
//print_r($_POST);
//exit;
$url = $GLOBALS['tokenReqUrl'];
//报头数据
$callbackUrl = $GLOBALS['callbackUrl'];
$hmac = "";
$ipAddress = Utility::GetRemoteIp();
$merchantId = $GLOBALS['merchantId'];
$notifyUrl = $GLOBALS['notifyUrl'];
$notifyEmail = $GLOBALS['notifyEmail'];
$notifyMobile = $GLOBALS['notifyMobile'];
$requestId = date("YmdHis");
$signType = "MD5";
$type = "DODIRECTPAYMENT";
$version = "1.0.1";
//$productName = mb_convert_encoding($title, 'GBK', 'UTF-8');
//报文体数据
$allowNote = "0";
$amount = strval($_REQUEST["amount"] * 100);
$authorizeMode = "WEB";
$banks = "";
$currency = mb_convert_encoding($_REQUEST["currency"], 'GBK', 'UTF-8');
$deliverFlag = "0";
$invoiceFlag = "0";
$orderDate = date("Ymd");
$orderId = mb_convert_encoding($_REQUEST["orderId"], 'GBK', 'UTF-8');
//商户订单号
Example #19
0
 *************************注意*************************
 * 如果您在接口集成过程中遇到问题,可以按照下面的途径来解决
 * 1、商户服务中心(https://b.alipay.com/support/helperApply.htm?action=consultationApply),提交申请集成协助,我们会有专业的技术工程师主动联系您协助解决
 * 2、商户帮助中心(http://help.alipay.com/support/232511-16307/0-16307.htm?sh=Y&info_type=9)
 * 3、支付宝论坛(http://club.alipay.com/read-htm-tid-8681712.html)
 * 如果不想使用扩展功能请把扩展功能参数赋空值。
 */
header('Content-Type: text/html; charset=UTF-8');
require_once "alipay.config.php";
require_once "lib/alipay_service.class.php";
/**************************请求参数**************************/
//扩展功能参数——防钓鱼//
//防钓鱼时间戳
$anti_phishing_key = '';
//获取客户端的IP地址,建议:编写获取客户端IP地址的程序
$exter_invoke_ip = Utility::GetRemoteIp();
//注意:
//1.请慎重选择是否开启防钓鱼功能
//2.exter_invoke_ip、anti_phishing_key一旦被使用过,那么它们就会成为必填参数
//3.开启防钓鱼功能后,服务器、本机电脑必须支持SSL,请配置好该环境。
//示例:
//$exter_invoke_ip = '202.1.1.1';
//$ali_service_timestamp = new AlipayService($aliapy_config);
//$anti_phishing_key = $ali_service_timestamp->query_timestamp();//获取防钓鱼时间戳函数
/*************************************************************/
//构造要请求的参数数组,无需改动
$parameter = array("anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip);
//构造快捷登录接口
$alipayService = new AlipayService($aliapy_config);
$html_text = $alipayService->alipay_auth_authorize($parameter);
echo $html_text;
Example #20
0
 } else {
     $sended = DB::GetQueryResult("SELECT mobile FROM verifycode WHERE mobile='" . $_POST['mobile'] . "' AND status=3 AND getip='" . Utility::GetRemoteIp() . "' AND dateline>'" . (time() - 3600) . "'");
     if ($sended) {
         Session::Set('error', '每IP每手机号每小时只能找回一次密码');
         redirect(WEB_ROOT . '/account/repass.php');
     } else {
         $user = Table::Fetch('user', strval($_POST['mobile']), 'mobile');
         if ($user) {
             //设置6位随机数字密码
             $new_password = Utility::VerifyCode();
             $content = $INI['system']['sitename'] . " 您的用户名:" . $user['username'] . " 新密码:" . $new_password . " 请及时修改密码。";
             //长度不能超过70个字符
             $ret = sms_send($_POST['mobile'], $content);
             if ($ret === true) {
                 //插入获取验证码数据记录
                 $verifycode_data = array('mobile' => $_POST['mobile'], 'getip' => Utility::GetRemoteIp(), 'verifycode' => $new_password, 'dateline' => time(), 'reguid' => $user['id'], 'regdateline' => time(), 'status' => 3);
                 $table = new Table('verifycode', $verifycode_data);
                 $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'reguid', 'regdateline', 'status'));
                 $password = ZUser::GenPassword($new_password);
                 Table::UpdateCache('user', $user['id'], array('password' => $password, 'recode' => ''));
                 Session::Set('notice', '成功发送找回密码短信到手机号:' . $_POST['mobile'] . ' 请稍候查看短信及时修改密码');
                 redirect(WEB_ROOT . '/account/repass.php');
             } else {
                 Session::Set('error', '找回密码短信发送失败,错误码:' . $ret . '');
                 redirect(WEB_ROOT . '/account/repass.php');
             }
         }
         Session::Set('error', '你的手机号没有在本站注册');
         redirect(WEB_ROOT . '/account/repass.php');
     }
 }