<?
include "config.inc.php";
include "class/member.class.php";
$member=new member();
//update
$query=$_SERVER[QUERY_STRING];
$check_url="http://www.payono.com/checkorder.html?".$query;
//echo $check_url;
$str=file($check_url);
if($str[0]=="TRUE"){
//支付成功
$OrderID=$_GET[OrderID];
$price = $_GET[Cost];
$uname=$_GET[PAYER];
$paras=explode("|",$_GET[PARA]);
$uid=$paras[0];
$quan=$paras[1];
$ctype=$paras[2];
$code=$paras[3];
$c_code=md5($uid.$quan.$ctype);
if($c_code!=$code) error("返回代码错误,请和管理员联系!你的订单号是$OrderID");
$blog=$PlusDB->prefix(bank_log);
//查询此订单是否已经写入
$sql="select count(*) as num from $blog where id='$OrderID'";
$numrow=$PlusDB->query_firstrow($sql);
$checknum=$numrow[num];
if($checknum>0) error("错误代码748,请和管理员联系,您的订单号是$OrderID");
//写入购物记录
$now=date("Y-m-d H:i:s");
$sql="insert into $blog (id,uid,ctype,price,ctime) values ('$OrderID','$uid','$ctype','$price','$now')";
$PlusDB->queryF($sql);
//endend
if($ctype=="Member"){
	$points=$quan*100;
	$member->updateUserPoint($points,$uid,$ctype);
}else{
	$member->updateUserEndTime($uid,$ctype);
}
}
?>