Your IP : 216.73.216.170


Current Path : /home/zqegovsj/public_html/us3.supplierlist.com/member/master/
Upload File :
Current File : /home/zqegovsj/public_html/us3.supplierlist.com/member/master/freemember2.php

<?php
$inc_path = "../../haibo/en/";$ua_sm_compile_dir = "newmember/";
require($inc_path."global.php");
require($inc_path .APP_NAME. 'lang/'.$app_lang.'/room.inc.php');
require($inc_path .APP_NAME. 'include/inc.discuz.php');
require($inc_path .APP_NAME. 'configs/db_session.php');
$sql="select username,user_reg from members where id=".$session_id;
$rest = $g_db->GetArray($sql);
$sql="select user_reg from members where id=".$_SESSION['MemberID'];
$res = $g_db->GetArray($sql);
if($res[0][0]!=0&&$res[0][0]!=$session_id&&$session_id!=48)die("Please visit the registration site!");
if($res[0][0]!=0)setvar("logoutname",$rest[0][0]);
setvar("imgpath", "../../".$rest[0][0]."/en/".$rest[0][0]."/");
uses("product","producttype","member","access");

require($inc_path.APP_NAME.'include/page.php');



$tpl_file = "freemember3";

$access = new Accesses();
$product = new Products();
$producttype = new Producttypes();
$conditions = null;
$table = $product->getTable(true);
$conditions = "member_id = ".$session_id;
$conditions.=" and level=0";

	$ts = $producttype->findAll($producttype->common_cols,$conditions," id DESC",0,30);
	
	 $count1=$producttype->findAll('count(*)',"1=1"," id DESC",0,50);
        $count2=$producttype->findAll('count(*)',$conditions," id DESC",0,50);

for($i=0;$i<$count2[0][0];$i++)
{ 

    $a[$i]= $producttype->findAll($producttype->common_cols,"level='".$ts[$i][0]."'"," id DESC",0,50);  
	
	 $ct=$producttype->findAll('count(*)',"level='".$ts[$i][0]."'"," id DESC",0,50);
  if($i==0){$typeres[0]=$ts[0];
	 for($j=0;$j<$ct[0][0];$j++){
		
		$typeres[$j+1]=$a[$i][$j];
		 }if($ts[1]!=''){$typeres[$ct[0][0]+1]=$ts[1];$x=$ct[0][0]+1;}
	 }else{
		 for($j=0;$j<$ct[0][0];$j++){
		$typeres[$x+1+$j]=$a[$i][$j];
		 }
		  $x+=$ct[0][0]+1;
		  if($x==$count1[0][0])break;
	if($ts[$i+1]!='')$typeres[$x]=$ts[$i+1];
		 }
}
$conditions = "member_id = ".$session_id;
if ($_GET['action'] == "state") {
	switch ($_GET['type']) {
		case "up":
			$state = 1;
			break;
		case "down":
	
			$state = 0;
			break;
		default:
			$state = 0;
			break;
	}
	if ($_GET['id']) {
		$vals['state'] = $state;
	
		$updated = $product->save($vals, "update", $_GET['id'], null, " and ".$conditions);
		if ($updated) {
			$msg = $cfg['room']['action_complete'];
		}else{
			$msg = $cfg['room']['not_defined_error'];
		}
	}else{
		$msg = $msg = $cfg['room']['not_defined_error'];
	}
}
setvar("ProductTypes",$typeres);
if ($_GET['act'] == "del" && !empty($_GET['id'])) {
	$res = $product->read("id",$_GET['id']);
	if($res){
		if($product->del($_GET['id'], "member_id=".$session_id)){
			$msg = $cfg['room']['action_complete'];
		}
	}else {
		$msg = $cfg['room']['no_data_deleted'];
	}
}
if (!empty($_GET['sid'])) {
	$sql = "select id from ".$_SESSION['Version']."_producttypes where member_id='".$session_id."' and level ='".$_GET['sid']."'";
$result = $g_db->GetAll($sql);
function array_multi2single($array) 
{ 
    static $result_array=array(); 
    foreach($array as $value) 
    { 
        if(is_array($value)) 
        { 
            array_multi2single($value); 
        } 
        else  
            $result_array[]=$value; 
    } 
    return $result_array; 
} 
$r=array_multi2single($result); 
$r=array_unique($r);
if($result[0][0]!=''){

$r = implode(",", $r);


	$conditions = " Product.member_id='".$session_id ."' and Product.producttype_id in (".$_GET['sid'].",".$r.") ";}else
	{$conditions = " Product.member_id='".$session_id ."' and Product.producttype_id =".$_GET['sid'];}
}else {
	$conditions = "Product.member_id = ".$session_id;
}
$sql = "select status AS ProductStatus,count(id) AS ProductAmount from ".$product->getTable()." where member_id = ".$session_id." group by status";
$res = $g_db->GetArray($sql);
foreach ($res as $key=>$val) {
	$a[$val['ProductStatus']] = $val['ProductAmount'];
}

if (!empty($a)) {
	$amount = array_sum($a);
}else{
	$amount = $product->findCount($conditions,"Product.id");
}
$a['max'] = $access->field("max_product","membertype_id=".$ua_user['user_type']);
if ($a['max']==0) {
	$a['max'] = $cfg['room']['no_limit'];
	$remain = $cfg['room']['no_limit'];
}else{
	$remain = $a['max']-$amount;
}
setvar("CountProduct",$a);
$conditions.=" and status ='2'";
if(isset($_GET['hot']))$conditions.= " and state='1'";
$sql = "select ". $product->common_cols .",Product.producttype_id, en_producttypes.name FROM ".$_SESSION['Version']."_products AS Product
LEFT JOIN en_producttypes ON en_producttypes.id = Product.producttype_id
WHERE ".$conditions."  
";

$res = $g_db->GetArray($sql);

pageft($amount,12);



for ($i = 0; $i < count($res); $i++){
   
   $res[$i]['Description']=stripslashes($res[$i]['Description']);
   $res[$i]['Description']=html_entity_decode($res[$i]['Description']);

}
setvar("ProductList",$res);
setvar("CheckStatus", $product->check_status);
uaAssign(array("Amount"=>$amount,"ByPages"=>$pagenav,"Msg"=>$msg,"Remain"=>($remain)));
setvar("ProductSorts",$product->product_sorts);



include("head.php");template("newmember/".$tpl_file);
?>