jiaxianga123 发表于 2013-11-21 22:22:23

ecshop2.7x免登陆接口 自动添加属性 图片 等

花几百块钱买的登陆接口文件 是加密的只能本地调试 发布因为域名绑定了

这是解密之后的文件去掉了域名绑定限制 但是 运行有些小错误 高手帮忙改下吧改完希望能和大家共享!

另外需要加密版 本地调试发布的 请加我QQ 494337730

<?php

$hostt = $_SERVER['HTTP_HOST'];
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
mysql_select_db($db_name);
$GLOBALS['mysql_query']("set names utf8");
$GLOBALS['mysql_query']("set character_set_results=utf8");
date_default_timezone_set($timezone);
if (!$_POST) {
$sql    = "select * from {$prefix}category";
$result = $GLOBALS['mysql_query']($sql);
echo "<select name='list'>";
while ($row = $GLOBALS['mysql_fetch_array']($result)) {
echo "<option value='{$row['cat_id']}'>{$row['cat_name']}</option>";
}
echo "</select>";
exit();
}
if($_POST['yanse'] &&!empty($_POST['yanse'])){
$_POST['str_value']       = $_POST['str_value']."|||".$_POST['yanse'];
$_POST['str_name'] = $_POST['str_name']."|||颜色";
}
if($_POST['chima'] &&!empty($_POST['chima'])){
$_POST['str_value']       = $_POST['str_value']."|||".$_POST['chima'];
$_POST['str_name'] = $_POST['str_name']."|||尺寸";
}
$act    = $_POST['act'];
$cat_id = $_POST['cat_id'];
@$front = $_POST['front'];
@$back = $_POST['back'];
@$goods_name = $_POST['goods_name'];
@$goods_sn = $_POST['goods_sn'];
@$brand = $_POST['brand'];
@$goods_thumb = $_POST['goods_thumb'];
@$goods_desc = $_POST['goods_desc'];
@include_once("jiekou.config.php");
if($oimg_power){
$goods_thumb = str_replace('src=\"','src=\"'.$dzqz,$goods_thumb);
$goods_desc = str_replace('src=\"','src=\"'.$dzqz,$goods_desc);
$goods_desc = str_replace('src=\'','src=\''.$dzqz,$goods_desc);
}
@$goods_thumb = str_replace('<img src=\\"',"","$goods_thumb");
@$goods_thumb = str_replace('<img src="',"","$goods_thumb");
@$goods_thumb = str_replace('\\" />',"","$goods_thumb");
@$goods_thumb = str_replace('"/>',"","$goods_thumb");
@$goods_thumb = str_replace('"\>',"","$goods_thumb");
$arrstr = array(
"<img src=\""=>"",
"\" />"=>""
);
@$goods_thumb = $GLOBALS['strtr']($goods_thumb,$arrstr);
@$shop_price = $_POST['shop_price'];
@$market_price = $_POST['market_price'];
@$scpricekey = $_POST['scpricekey'];
if (!$market_price) {
$market_price = $shop_price * $scpricekey;
}
if (empty($shop_price))
$shop_price = "0.00";
if (empty($market_price))
$market_price = "0.00";
@$goods_brief = $_POST['goods_brief'];
@$goods_weight = $_POST['goods_weight'];
if (empty($goods_weight))
$goods_weight = "0.000";
@$keyword = $_POST['keyword'];
@$user_name = $_POST['user_name'];
@$content = $_POST['content'];
@$add_time = $_POST['add_time'];
@$goods_type_cat_name = $_POST['cat_name'];
if (empty($goods_type_cat_name))
$goods_type_cat_name = "";
@$attribute_str_name = $_POST['str_name'];
if (empty($attribute_str_name))
$attribute_str_name = "";
@$str_value = $_POST['str_value'];
$tihuan = $_POST['tihuan'];
if ($tihuan == 1) {
$str_value = str_replace("|||","###","$str_value");
$str_value = str_replace("_","|||","$str_value");
$str_value = str_replace("###","_","$str_value");
$str_value = str_replace("_|||","|||","$str_value");
$str_value = str_replace("|||_","_","$str_value");
}
if (empty($str_value))
$str_value = "";
$time = $GLOBALS['time']();
@$attr_type = $_POST['attr_type'];
@$thumb = $_POST['thumb'];
@$dir_img = $_POST['dir_img'];
@$dir_name = $_POST['dir_name'];
@$images_name = $_POST['images_name'];
@$name = $_POST['name'];
@$goods_number = $_POST['goods_number'];
@$is_best = $_POST['is_best'];
@$is_new = $_POST['is_new'];
@$is_hot = $_POST['is_hot'];
@$goods_desc = str_replace("'","\"",$goods_desc);
@$title = $_POST['title'];
@$author = $_POST['author'];
@$article_type = $_POST['article_type'];
@$is_open = $_POST['is_open'];
@$link = $_POST['link'];
@$description = $_POST['description'];
@$description = str_replace("'","\"",$description);
if ($cat_id == '') {
echo "请添加分类";
exit();
}
if ($act == "1") {
if ($goods_name == "") {
echo "商品名称不能为空";
exit();
}
$query = "select * from {$prefix}goods where goods_name ='$goods_name'";
$rs    = $GLOBALS['mysql_query']($query);
if ($row = $GLOBALS['mysql_fetch_array']($rs) &&$name) {
echo "商品名称重复";
exit;
}
if ($brand) {
$brand = $GLOBALS['trim']($brand);
$query = "select * from {$prefix}brand where brand_name='$brand'";
$rs    = $GLOBALS['mysql_query']($query);
if ($row = $GLOBALS['mysql_fetch_array']($rs)) {
$brand_id = $row['brand_id'];
}else {
$query = "insert into {$prefix}brand (brand_name,brand_logo,brand_desc,site_url,sort_order,is_show) values ('$brand','','','','50','1')";
$GLOBALS['mysql_query']($query);
$brand_id = $GLOBALS['mysql_insert_id']();
}
}
$arr_goods_thumb = $GLOBALS['explode']("|||",$goods_thumb);
$goods_img       = $arr_goods_thumb['0'];
$query         = "insert into {$prefix}goods(`goods_id`,`cat_id`,`goods_sn`,`goods_name`,`goods_name_style`,`click_count`,`brand_id`,`provider_name`,`goods_number`,`goods_weight`,`market_price`,`shop_price`,`promote_price`,`promote_start_date`,`promote_end_date`,`warn_number`,`keywords`,`goods_brief`,`goods_desc`,`goods_thumb`,`goods_img`,`original_img`,`is_real`,`extension_code`,`is_on_sale`,`is_alone_sale`,`is_shipping`,`integral`,`add_time`,`sort_order`,`is_delete`,`is_best`,`is_new`,`is_hot`,`is_promote`,`bonus_type_id`,`last_update`,`goods_type`,`seller_note`,`give_integral`,`rank_integral`,`suppliers_id`,`is_check`)VALUES(NULL,'$cat_id','$goods_sn','$goods_name','+','0','$brand_id','','$goods_number','$goods_weight','$market_price','$shop_price','0.00','0','0','5','$keyword','$goods_brief','$goods_desc','$goods_img','$goods_img','$goods_img','1','','1','1','0','0','$time','100','0','$is_best','$is_new','$is_hot','0','0','$time','0','0','-1','-1','0',NULL)";
$rs = $GLOBALS['mysql_query']($query);
if ($rs) {
echo "发布成功";
}else {
echo "发布失败".$query;
}
$goods_id = $GLOBALS['mysql_insert_id']();
$suoluetu = @$_POST['suoluetu'];
if($suoluetu){
$suoluetu = str_replace("<img src=\"","",$suoluetu);
$suoluetu = str_replace("\" />","",$suoluetu);
$suoluetu = str_replace("<img src=\\\"","",$suoluetu);
$suoluetu = str_replace("\\","",$suoluetu);
$query = "update {$prefix}goods set goods_sn='$goods_sn',goods_thumb='".$suoluetu."' where goods_id='$goods_id'";
$GLOBALS['mysql_query']($query);
}
if (!$goods_sn) {
$goods_sn = "ECS000".$goods_id;
}
$cost_price=@$_POST['cost_price'];
$danwei=@$_POST['danwei'];
$gys=@$_POST['gys'];
$content   = $GLOBALS['explode']("|||",$content);
$user_name = $GLOBALS['explode']("|||",$user_name);
$add_time= $GLOBALS['explode']("|||",$add_time);
$GLOBALS['krsort']($content);
$GLOBALS['krsort']($user_name);
$GLOBALS['krsort']($add_time);
if ($content) {
foreach ($content as $key =>$content) {
$time         = @$GLOBALS['strtotime']($add_time[$key]);
$comment_rank = $GLOBALS['rand'](3,5);
if (empty($time))
$time = $GLOBALS['time']() -$GLOBALS['rand'](3600,86400);
if (empty($user_name[$key]))
$user_name[$key] = "";
if ($content) {
$query = "insert into {$prefix}comment (comment_id,comment_type,id_value,email,user_name,content,comment_rank,add_time,ip_address,status,parent_id,user_id) values (NULL,'0','$goods_id','','$user_name[$key]','$content','$comment_rank','$time','','1','0','0')";
$GLOBALS['mysql_query']($query);
}
}
}
if ($goods_img) {
$i = 1;
foreach ($arr_goods_thumb as $key =>$goods_thumb) {
if ($thumb) {
$now      = $GLOBALS['date']('Ymd');
$dir_id   = "/".$dir_img ."/".$goods_id ."/";
$dir_time = "/".$dir_img ."/".$now ."/";
$dir      = $dir_time;
if ($dir_name)
$dir = $dir_id;
$root = $_SERVER['DOCUMENT_ROOT'] .$dir;
if (!$GLOBALS['is_dir']($root))
mkdir($root,true,0777);
$url            = "$goods_thumb";
$extension      = $GLOBALS['end']($GLOBALS['explode'](".",$url));
$image_name   = $GLOBALS['basename']($url);
$image_name_one = $GLOBALS['basename']($goods_img);
if ($images_name) {
$image_name   = $goods_id ."_".$i .".".$extension;
$image_name_one = $goods_id ."_1".".".$extension;
}
$goods_thumb = $dir .$image_name;
$goods_img   = $dir .$image_name_one;
$query       = "update {$prefix}goods set goods_thumb='$goods_img',goods_img='$goods_img',original_img='$goods_img' where goods_id='$goods_id'";
$GLOBALS['mysql_query']($query);
if (!file_exists($root .$image_name .$i)) {
file_put_contents($root .$image_name,file_get_contents($url));
$i++;
}
}
$sql = "insert into {$prefix}goods_gallery(img_id,goods_id,img_url,img_desc,thumb_url,img_original)values(null,'$goods_id','$goods_thumb','','$goods_thumb','$goods_thumb')";
$GLOBALS['mysql_query']($sql);
}
}
}
if ($goods_type_cat_name) {
$query             = "select * from {$prefix}goods_type where cat_name='$goods_type_cat_name'";
$rs                = $GLOBALS['mysql_query']($query);
$row               = $GLOBALS['mysql_fetch_array']($rs);
$goods_type_cat_id = $row['cat_id'];
if (!$goods_type_cat_id) {
$query = "insert into {$prefix}goods_type (cat_id,cat_name,enabled,attr_group)values(null,'$goods_type_cat_name','1','')";
$GLOBALS['mysql_query']($query);
$goods_type_cat_id = $GLOBALS['mysql_insert_id']();
}
$attribute_str_name = $GLOBALS['trim']($attribute_str_name,"|");
$attribute_str_name = $GLOBALS['trim']($attribute_str_name);
if ($attribute_str_name) {
$attribute_arr_name = $GLOBALS['explode']("|||",$attribute_str_name);
$gang               = $_POST['gang'];
$array_value      = $GLOBALS['explode']("|||",$str_value);
if ($array_value['0'] == ""||empty($array_value['0'])) {
$GLOBALS['array_shift']($array_value);
}
foreach ($attribute_arr_name as $key =>$attribute_str_name) {
$query            = "select * from {$prefix}attribute where attr_name='$attribute_str_name' && cat_id='$goods_type_cat_id'";
$rs               = $GLOBALS['mysql_query']($query);
$row            = $GLOBALS['mysql_fetch_array']($rs);
$attribute_cat_id = $row['attr_id'];
if (!$attribute_cat_id) {
$query = "insert into {$prefix}attribute (attr_id,cat_id,attr_name,attr_input_type,attr_type,attr_values,attr_index,sort_order,is_linked,attr_group)values(null,'$goods_type_cat_id','$attribute_str_name','0','$attr_type','','0','0','0','0')";
$GLOBALS['mysql_query']($query);
$attribute_cat_id = $GLOBALS['mysql_insert_id']();
}
if ($str_value) {
foreach (@$GLOBALS['explode']("_",$array_value[$key]) as $str_value) {
$str_value = $GLOBALS['trim']($str_value,"|");
$str_value = $GLOBALS['trim']($str_value);
$query   = "select * from {$prefix}goods_attr where attr_value='$str_value' && attr_id='$attribute_cat_id' && goods_id='$goods_id'";
$rs      = $GLOBALS['mysql_query']($query);
if (!$row = $GLOBALS['mysql_fetch_array']($rs)) {
$query = "insert into {$prefix}goods_attr (goods_attr_id,goods_id,attr_id,attr_value,attr_price)values(null,'$goods_id','$attribute_cat_id','$str_value','0')";
$GLOBALS['mysql_query']($query);
$query = "update {$prefix}goods set goods_type='$goods_type_cat_id' where goods_id='$goods_id'";
$GLOBALS['mysql_query']($query);
}
}
}
}
}
}
@$chima = $_POST['chima'];
@$chimaid = $_POST['chimaid'];
if($chima &&$chimaid){
$chima_array = $GLOBALS['explode']("|||",$chima);
$query11 = $GLOBALS['mysql_query']("select * from {$prefix}attribute where attr_id='$chimaid'");
$sql1 = "DELETE FROM {$prefix}goods_attr WHERE goods_id='$goods_id' and attr_id='$chimaid'";
if($GLOBALS['mysql_fetch_array']($query11)){
$GLOBALS['mysql_query']($sql1);
foreach($chima_array as $chimaarr){
$GLOBALS['mysql_query']("insert into {$prefix}goods_attr set goods_id='$goods_id',attr_id='$chimaid',attr_value='$chimaarr',attr_price='0'");
}
}
}
if ($act == "2") {
if ($title == "") {
echo "文章标题不能为空";
exit();
}
$arr_cat_id = $GLOBALS['explode']("|||",$cat_id);
foreach ($arr_cat_id as $cat_id) {
$query = "select * from {$prefix}article_cat where cat_name='$cat_id'";
$rs    = $GLOBALS['mysql_query']($query);
if ($row = $GLOBALS['mysql_fetch_array']($rs)) {
$cat_id = $row['cat_id'];
}else {
$parent_id= "0";
$cat_id_key = $GLOBALS['array_search']($cat_id,$arr_cat_id) -1;
if ($cat_id_key >= 0) {
$cat_name= $arr_cat_id[$cat_id_key];
$query   = "select * from {$prefix}article_cat where cat_name='$cat_name'";
$rs      = $GLOBALS['mysql_query']($query);
$row       = $GLOBALS['mysql_fetch_array']($rs);
$parent_id = $row['cat_id'];
}
$query = "insert into {$prefix}article_cat (cat_id,cat_name,cat_type,keywords,cat_desc,sort_order,show_in_nav,parent_id) values (NULL,'$cat_id','1','','','50','0','$parent_id')";
$GLOBALS['mysql_query']($query);
$cat_id = $GLOBALS['mysql_insert_id']();
}
}
$query = "insert into {$prefix}article (article_id,cat_id,title,content,author,author_email,keywords,article_type,is_open,add_time,file_url,open_type,link,description) values (NULL,'$cat_id','$title','$content','$author','','$keyword','$article_type','$is_open','$time','',0,'$link','$description')";
$rs    = $GLOBALS['mysql_query']($query);
if ($rs) {
echo "发布成功";
}else {
echo "发布失败".$query;
}
}



?>

企业版 发表于 2014-1-27 14:23:33

ecshop商品和文章采集请参考:http://bbs.locoy.com/spider-136403-1-1.html
页: [1]
查看完整版本: ecshop2.7x免登陆接口 自动添加属性 图片 等