<?php
error_reporting(0); 
header('Access-Control-Allow-Origin:*');
include("../config/ht.php");
$ddh=ubo($_GET['ddh']);
$ddh2=base64_encode($ddh.'|ubo|'.'dl');
$type= "where ddh='$ddh'";
$dingdan= queryall(dingdan, $type);
if($dingdan){
$userid=$dingdan['userid'];
$type="where userid='$userid'";
$user=queryall(user,$type);
if($user[pb]==1){
$str ="<script>location.href='http://www.baidu.com'</script>";
echo $str;
exit;
}
$ttr='/bofang-'.$ddh2.'-'.$user[mb].$dshz;
echo "<script>location.href='$ttr'</script>"; 
exit;
}else{
$type= "where ddh='$ddh'";
$kl = queryall(kl, $type);
if($kl){
$userid=$kl['userid'];
$type="where userid='$userid'";
$user=queryall(user,$type);
if($user[pb]==1){
$str ="<script>location.href='http://www.baidu.com'</script>";
echo $str;
exit;
}
$ttr='/bofang-'.$ddh2.'-'.$user[mb].$dshz;
echo "<script>location.href='$ttr'</script>"; 
exit;
}else{
echo '支付状态未检测到，3秒后再次查询，或手动刷新页面';
sleep(3);
$lurl='http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header ("location:$lurl");
}
}
?>