Пример #1
0
             $sumData['info']['money2'] -= 368;
         }
         if ($sumData['info']['money3'] >= 688) {
             //获得一张提醒卡
             $cardData = array();
             $cardData['info']['type'] = 3;
             $cardData['info']['uid'] = $userRow['id'];
             $cardData['info']['out_time'] = time() + 3600 * 24 * 30;
             D('sub_card')->add($cardData);
             $sumData['info']['money3'] -= 688;
         }
         $sumData['info']['uid'] = $userRow['id'];
         $sumModel->add($sumData);
         //获取开乐迪券码
         $kldData = array();
         $kldData['info']['code'] = strtolower(code_random(5));
         $kldData['info']['uid'] = $userRow['id'];
         D('sub_kld')->add($kldData);
     }
 }
 //保存订单表
 $data[info]['num'] = $totalNum;
 $data[info]['money'] = $totalMoney;
 $data[info]['uid'] = $userRow['id'];
 $data[info]['agent_num'] = $userRow['my_num'];
 //代理商编号
 $data[info]['discount'] = $discount;
 //代理商折扣
 $res = $model->add($data);
 //写金额日志
 if ($data['num']['pay_type'] == 1) {
Пример #2
0
include_once "../includes/config.inc.php";
//if(!strpos($_SERVER['HTTP_USER_AGENT'],'MicroMessenger')) die("请在微信浏览器中打开");//判断是否微信打开
$model = new Model_Subtable('sub_user');
//注册
if ($_REQUEST['a'] == 'do') {
    $data = $_POST;
    //手机验证码核对
    if ($data['code'] != $_SESSION['mobile_code'] or empty($data['code'])) {
        echo 'codeerr';
        die;
    }
    $row = $model->where("username='******'username'] . "'")->dataRow();
    //数据修改
    $info['num']['id'] = $row['id'];
    $info['info']['pass'] = md5($data['pass']);
    if ($info['num']['id'] && $info['info']['pass']) {
        $res = $model->add($info);
    } else {
        $res = 0;
    }
    if ($res) {
        $_SESSION['mobile'] = '';
        $_SESSION['mobile_code'] = '';
    }
    echo $res;
    die;
}
//防止恶意请求的随机码
$_SESSION['send_code'] = code_random(6, 1);
$smarty->assign('send_code', $_SESSION['send_code']);
$smarty->setLayout('')->setTpl('mobile/templates/editp.html')->display();
Пример #3
0
<?php

require_once "../includes/config.inc.php";
$mobile = $_POST['mobile'];
$send_code = $_POST['send_code'];
$mobile_code = code_random(4, 1);
if (empty($mobile)) {
    exit('手机号码不能为空');
}
//防用户恶意请求
if (empty($_SESSION['send_code']) or $send_code != $_SESSION['send_code']) {
    exit('请求超时,请刷新页面后重试');
}
$post_data = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。如非本人操作,可不用理会!";
$gets = xml_to_array(send_phone_msg($mobile, $post_data));
//file_put_contents('../data/sms.txt',$post_data);$gets['SubmitResult']['code']=2;
/* if($gets['SubmitResult']['code']==2){
	$_SESSION['mobile'] = $mobile;
	$_SESSION['mobile_code'] = $mobile_code;//手机验证码
	echo 'suc';
}else{
	echo 'err';
} */
$_SESSION['mobile'] = $mobile;
$_SESSION['mobile_code'] = $mobile_code;
//手机验证码
echo 'suc';
die;
Пример #4
0
<?php

/**
* бщжЄТы
*/
session_start();
$x_size = 60;
$y_size = 20;
$seccode = code_random(4);
$_SESSION['imgcode'] = $seccode;
if (function_exists('imagecreate') && function_exists('imagecolorallocate') && function_exists('imagesetpixel') && function_exists('imageString') && function_exists('imagedestroy') && function_exists('imagefilledrectangle') && function_exists('imagerectangle') && (function_exists('imagepng') || function_exists('imagejpeg'))) {
    $aimg = imagecreate($x_size, $y_size);
    $back = imagecolorallocate($aimg, 0xff, 0xff, 0xff);
    $border = imagecolorallocate($aimg, 0xcc, 0xcc, 0xcc);
    imagefilledrectangle($aimg, 0, 0, $x_size - 1, $y_size - 1, $back);
    imagerectangle($aimg, 0, 0, $x_size - 1, $y_size - 1, $border);
    for ($i = 1; $i <= 20; $i++) {
        $dot = imagecolorallocate($aimg, mt_rand(50, 255), mt_rand(50, 255), mt_rand(50, 255));
        imagesetpixel($aimg, mt_rand(2, $x_size - 2), mt_rand(2, $y_size - 2), $dot);
    }
    imageline($aimg, mt_rand(1, 5), mt_rand(1, $y_size), mt_rand(5, $x_size / 2), mt_rand(1, $y_size), $dot);
    imageline($aimg, mt_rand($x_size / 2, $x_size / 2 + 5), mt_rand(1, $y_size), mt_rand($x_size / 2 + 5, $x_size), mt_rand(1, $y_size), $dot);
    for ($i = 0; $i < strlen($seccode); $i++) {
        imageString($aimg, mt_rand(4, 5), $i * $x_size / 4 + mt_rand(2, 5), mt_rand(1, 6), $seccode[$i], imagecolorallocate($aimg, mt_rand(50, 255), mt_rand(0, 120), mt_rand(50, 255)));
    }
    header("Pragma:no-cache");
    header("Cache-control:no-cache");
    if (function_exists('imagepng') && imagepng($aimg)) {
        header("Content-type: image/png");
        imagepng($aimg);
    } else {