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/index2.php

<?php
$inc_path = "../../haibo/en/";$ua_sm_compile_dir = "newmember/";
$ua_sm_compile_dir = "newmember/";
require($inc_path."global.php");
require("session.php");
//ini_set('display_errors','On');
//error_reporting(E_ALL);
uses("trade","member","company","membertype","access","area","setting");

$membertype = new Membertypes();
$access = new Accesses();
$trade = new Trades();
$member = new Members();
$company = new Companies();
$setting= new Settings();
if($_SESSION['Version']==''){
	$memberinfo = $member->read("firstname,lastname,gender,service_start_date,service_end_date,last_login,Version",$_SESSION['MemberID'],"members");

$version=$member->version;
for($i=0;$i<count($version);$i++)
{
	if($version[$i]['id']==$memberinfo['Version']){$_SESSION['Versionname']=$version[$i]['name'];
	$_SESSION['Version']=$memberinfo['Version'];
	$_SESSION['pagelang']=$_SESSION['Version'];
	}
	
	}
	
	
	}
$tb_prefix= $_SESSION['Version']."_";


/*
if (!empty($memberinfo)) {

	$total_days = ($memberinfo['service_end_date']-$time_stamp);
class FormatSeconds
{
    var $days;
    var $hours;
    var $minutes;
    var $seconds;

    function getDays()
    {
        return $this->days;        
    }
    function getHours()
    {
        return $this->hours;
    }
    function getMinutes()
    {
        return $this->minutes;
    }
    function getSeconds()
    {
        return $this->seconds;
    }

    function FormatSeconds($sec)
    {
        $this->days = floor($sec / (24*3600));
        $sec = $sec % (24*3600);
        $this->hours = floor($sec / 3600);
        $remainSeconds = $sec % 3600;
        $this->minutes = floor($remainSeconds / 60);
        $this->seconds = intval($sec - $this->hours * 3600 - $this->minutes * 60);
    }
}

$fs = new FormatSeconds("$total_days");
$time=$fs->getDays()."天".$fs->getHours()."小时".$fs->getMinutes()."分钟";

	setvar("service_days",$time);*/
	

$memberinfo = $member->read("firstname,lastname,user_type,gender,service_start_date,service_end_date,last_login,Version,Versions,status",$_SESSION['MemberID'],"members");

if (!empty($memberinfo)) {

	$total_days = ($memberinfo['service_end_date']-$time_stamp);
class FormatSeconds
{
    var $days;
    var $hours;
    var $minutes;
    var $seconds;

    function getDays()
    {
        return $this->days;        
    }
    function getHours()
    {
        return $this->hours;
    }
    function getMinutes()
    {
        return $this->minutes;
    }
    function getSeconds()
    {
        return $this->seconds;
    }

    function __construct($sec)
    {
        $this->days = floor($sec / (24*3600));
        $sec = $sec % (24*3600);
        $this->hours = floor($sec / 3600);
        $remainSeconds = $sec % 3600;
        $this->minutes = floor($remainSeconds / 60);
        $this->seconds = intval($sec - $this->hours * 3600 - $this->minutes * 60);
    }
}


$fs = new FormatSeconds("$total_days");
$time=$fs->getDays()."天".$fs->getHours()."小时".$fs->getMinutes()."分钟";

	setvar("service_days",$time);

	setvar("MemberInfo",$memberinfo);

	setvar("MembertypeName",$membertype->field("name", " id='".intval($memberinfo['status'])."'",'','membertypes'));
	}




$area = new Areas();$company_id = $company->field("id","member_id=".$_SESSION['MemberID']);
$conditions = null;
if ($_POST['save']) {
		if($_POST['kid']){
			$sort_arr = implode(",", $_POST['kid']);
			$sql="DELETE FROM `".$_SESSION['Version']."_contact` WHERE `id` in (".$sort_arr.")";
			$res = $g_db->Query($sql);
		}
		
				$a=array(); 
				if($_POST['content']){
					$a=$_POST['content'];
				}
				
				for($i=1;$i<=count($a);$i++)
				{
						if($a[$i]!='')
					{
					
				$sql="INSERT INTO `".$_SESSION['Version']."_contact` (
				`id` ,
				`member_id` ,
				`type` ,
				`bumen` ,
				`name` ,
				`content` 
				)
				VALUES (
				NULL , '".$_SESSION['MemberID']."', '".$_POST['type'][$i]."', '".$_POST['bumen'][$i]."', '".$_POST['name'][$i]."', '".$a[$i]."'
				)";
				$res = $g_db->Query($sql);
				}}
				$vals = array();
				$vals = $_POST['k'];
	require(LIB_PATH.'controllers/upload.inc.php');
require(LIB_PATH.'controllers/GDImage.inc.php');
	require($inc_path .APP_NAME. 'include/inc.imageWaterMark.php');
if (!empty($_FILES['brand_img']['name'])) {
		
			$f = $_FILES['brand_img'];
			
			ini_set("memory_limit", "32M");
			$check_path = uaCheckMediaPath('..'.DS.'..'.DS.$_SESSION['MemberName'].DS.$_SESSION['Version'].DS.$_SESSION['MemberName'].DS."company".DS);	
			$file_ext = fileext($f['name']);
			$this_product_pic = "b".$_SESSION['MemberID']."_".$pid."_".$time_stamp.$file_ext;
			$u = new upload($f['name']);
			if($u->checkImage()){
				$uploade_file = move_uploaded_file($f['tmp_name'],$check_path.$this_product_pic);
			}else{
				flash("./tip.php","./company.php", $cfg['room']['pic_upload_error'],0);
			}
			if(!$uploade_file){
				flash("./tip.php","./company.php",$cfg['room']['pic_upload_false'],0);
			}else {
				$oldfile = substr($check_path,0,-7).$_POST['oldbrand_img'];
				$oldfile = str_replace("\\","/",$oldfile);
				@unlink($oldfile);
				$oldsmallfile = substr($check_path,0,-11)."small".DS.$_POST['oldbrand_img'];
				@unlink(str_replace("\\","/",$oldsmallfile));
				
			}
			$image = new GDImage2($check_path,uaCheckMediaPath('..'.DS.'..'.DS.$_SESSION['MemberName'].DS.$_SESSION['Version'].DS.$_SESSION['MemberName'].DS."company".DS,"small".DS));
			$image->makeThumb($this_product_pic);
			$set_watermark = $setting->field("ab","aa='watermark'");
			if($set_watermark && empty($pid)){
				$water_text = $setting->field("ab","aa='watertext'");
				$water_color = $setting->field("ab","aa='watercolor'");
				if (empty($water_text)) {
					$water_text = URL;
				}
			
				imageWaterMark($check_path.$this_product_pic,8,"",$water_text,5,$water_color);
			}
	
		if(!empty($this_product_pic)) {	
		
		$sql="select brand_img from ".$_SESSION['Version']."_companies where member_id=".$_SESSION['MemberID']."";
		$rr = $g_db->GetAll($sql);
		foreach($rr as $k=>$v){
			if($_SESSION['Version']=="en") {
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['brand_img']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['brand_img']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['brand_img']);
			} else {
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['brand_img']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['brand_img']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['brand_img']);
				
			}
			
		}
			$vals['brand_img'] = $this_product_pic;
		}
	}

if(!empty($_FILES['picture']['name'])) {
		
			$f = $_FILES['picture'];
		
			ini_set("memory_limit", "32M");
			$check_path = uaCheckMediaPath('..'.DS.'..'.DS.$_SESSION['MemberName'].DS.$_SESSION['Version'].DS.$_SESSION['MemberName'].DS."company".DS);
			$file_ext = fileext($f['name']);
			$this_product_pic = "p".$_SESSION['MemberID']."_".$pid."_".$time_stamp.$file_ext;
			$u = new upload($f['name']);
			if($u->checkImage()){
				$uploade_file = move_uploaded_file($f['tmp_name'],$check_path.$this_product_pic);
			}else{
				flash("./tip.php","./company.php", $cfg['room']['pic_upload_error'],0);
			}
			if(!$uploade_file){
				flash("./tip.php","./company.php",$cfg['room']['pic_upload_false'],0);
			}else {
				$oldfile = substr($check_path,0,-7).$_POST['oldpicture'];
				$oldfile = str_replace("\\","/",$oldfile);
				@unlink($oldfile);
				$oldsmallfile = substr($check_path,0,-11)."small".DS.$_POST['oldpicture'];
				@unlink(str_replace("\\","/",$oldsmallfile));
			}
			$image = new GDImage2($check_path,uaCheckMediaPath('..'.DS.'..'.DS.$_SESSION['MemberName'].DS.$_SESSION['Version'].DS.$_SESSION['MemberName'].DS."company".DS,"small".DS));
			$image->makeThumb($this_product_pic);
			$set_watermark = $setting->field("ab","aa='watermark'");
			if($set_watermark && empty($pid)){
				$water_text = $setting->field("ab","aa='watertext'");
				$water_color = $setting->field("ab","aa='watercolor'");
				if (empty($water_text)) {
					$water_text = URL;
				}
			
				imageWaterMark($check_path.$this_product_pic,8,"",$water_text,5,$water_color);
			}
	
		if(!empty($this_product_pic)) {	
		
		$sql="select picture from ".$_SESSION['Version']."_companies where member_id=".$_SESSION['MemberID']."";
		$rr = $g_db->GetAll($sql);
		foreach($rr as $k=>$v){
			if($_SESSION['Version']=="en") {
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['picture']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['picture']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['picture']);
			} else {
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['picture']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['picture']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['picture']);
				
			}
			
		}
			$vals['picture'] = $this_product_pic;
		}

	}
	if(!empty($_FILES['shuiyin_img']['name'])) {
		
			$f = $_FILES['shuiyin_img'];
		
			ini_set("memory_limit", "32M");
			$check_path = uaCheckMediaPath('..'.DS.'..'.DS.$_SESSION['MemberName'].DS.$_SESSION['Version'].DS.$_SESSION['MemberName'].DS."company".DS);
			$file_ext = fileext($f['name']);
			$this_product_pic = "shuiyin".$_SESSION['MemberID']."_".$pid."_".$time_stamp.$file_ext;
			$u = new upload($f['name']);
			if($u->checkImage()){
				$uploade_file = move_uploaded_file($f['tmp_name'],$check_path.$this_product_pic);
			}else{
				flash("./tip.php","./company.php", $cfg['room']['pic_upload_error'],0);
			}
			if(!$uploade_file){
				flash("./tip.php","./company.php",$cfg['room']['pic_upload_false'],0);
			}else {
				$oldfile = substr($check_path,0,-7).$_POST['oldpicture'];
				$oldfile = str_replace("\\","/",$oldfile);
				@unlink($oldfile);
				$oldsmallfile = substr($check_path,0,-11)."small".DS.$_POST['oldpicture'];
				@unlink(str_replace("\\","/",$oldsmallfile));
			}
			$image = new GDImage2($check_path,uaCheckMediaPath('..'.DS.'..'.DS.$_SESSION['MemberName'].DS.$_SESSION['Version'].DS.$_SESSION['MemberName'].DS."company".DS,"small".DS));
			$image->makeThumb($this_product_pic);
			$set_watermark = $setting->field("ab","aa='watermark'");
			if($set_watermark && empty($pid)){
				$water_text = $setting->field("ab","aa='watertext'");
				$water_color = $setting->field("ab","aa='watercolor'");
				if (empty($water_text)) {
					$water_text = URL;
				}
			
				imageWaterMark($check_path.$this_product_pic,8,"",$water_text,5,$water_color);
			}
	
		if(!empty($this_product_pic)) {	
			$vals['shuiyin_img'] = $this_product_pic;
		}

	}
	
    if($_POST['shuiyin_del']==1)$vals['shuiyin_img']='';
	if($_POST['logo_del']==1){
	
	$sql="select brand_img from ".$_SESSION['Version']."_companies where member_id=".$_SESSION['MemberID']."";
		$rr = $g_db->GetAll($sql);
		foreach($rr as $k=>$v){
			if($_SESSION['Version']=="en") {
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['brand_img']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['brand_img']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['brand_img']);
			} else {
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['brand_img']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['brand_img']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['brand_img']);
				
			}
			
		}
		$vals['brand_img']='';
		};

	if($_POST['branner_del']==1){
	
	$sql="select picture from ".$_SESSION['Version']."_companies where member_id=".$_SESSION['MemberID']."";
		$rr = $g_db->GetAll($sql);
		foreach($rr as $k=>$v){
			if($_SESSION['Version']=="en") {
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['picture']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['picture']);
			@unlink('../../upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['picture']);
			} else {
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/small/'.$v['picture']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/middle/'.$v['picture']);
			@unlink('../../'.$_SESSION['Version'].'/upload/'.$_SESSION['MemberName'].'/upload/big/'.$v['picture']);
				
			}
			
		}
		$vals['picture']='';
	};
		
	if(!empty($company_id)){
		$vals['modified'] = $time_stamp;
		$company->save($vals, "update", $company_id, null, " and member_id=".$_SESSION['MemberID']);
	} else {
		$vals['member_id'] = $_SESSION['MemberID'];
		$vals['created'] = $time_stamp;
		$company->save($vals);
		$last_company_id = $g_db->Insert_ID();
	}
	$vals=array();
	$array_show=array("home_show","about_show","product_show","feedback_show","contact_show","download_show");
	if(!$_POST['home'])$_POST['home']=array();
	foreach($array_show as $v){
		if(in_array($v,$_POST['home']))$vals[$v]=1;else $vals[$v]=0;
		}
		$vals["home_show"]=1;
	$result = $member->save($vals, "update", $_SESSION['MemberID'],'members');
	if(!$result){
		flash("./tip.php",'',$cfg['room']['action_complete'],1);
	}else{
		flash("./tip.php",'',$cfg['room']['action_complete'],1);
	}
}


include("head.php");template("./newmember/index2");

?>