<?php

	defined('IN_TS') or die('Access Denied.');
	
	$goodid 	= _get('goodid','intval');
	$size 		= _get('size');
	$color 		= _get('color');
	$msg 		= _get('msg');
	$num 		= _get('num','intval');
	$addressid	= _get('addressid','intval');
	$orderkey	= date("YmdHis");
	$paytype	= _get('paytype','intval');

	if($paytype	=='1'){
			$db->query("insert into ".dbprefix."order (`goodid`,`size`,`color`,`msg`,`num`,`addressid`,`orderkey`,`addtime`) values ('$goodid','$size','$color','$msg','$num','$addressid','$orderkey','".time()."')");
	$orderid=mysql_insert_id();
    if($orderid){
			?>
			 <script>
			  window.location='index.php?app=pubs&ac=plugin&plugin=aipay&in=index&id='+<?php echo $orderid?>;
			 </script>
			 <?php
			 break;
	    }else{
		   qiMsg("系统出错，请请联系网站管理员！");
		}

	}elseif($paytype=='2'){
			$db->query("insert into ".dbprefix."order (`goodid`,`size`,`color`,`msg`,`num`,`addressid`,`orderkey`,`addtime`) values ('$goodid','$size','$color','$msg','$num','$addressid','$orderkey','".time()."')");
	$orderid=mysql_insert_id();
    if($orderid){
			?>
			 <script>
			  window.location='index.php?app=pubs&ac=plugin&plugin=chinabank&in=index&id='+<?php echo $orderid?>;
			 </script>
			 <?php
			 break;
	    }else{
		   qiMsg("系统出错，请请联系网站管理员！");
		}
		}else{
			qiMsg("服务暂未开通，请选择其他的支付方式！");
		}


	
	
	