真奇怪 ecshop不知道怎样提交添加商品数据的
程序员文章站
2022-06-03 11:10:07
...
添加商品的时候,我抓了下包;数据如下。
提交处理的时候,act是等于insert才对的。
可ecshop 却依然调用了添加页面的 add。
而在request_playload中 发现了
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="act"
insert
真是奇怪,没看过这样的提交方式;不知道是怎样实现的。 查了ecshop的js,好像是用fckeditor控件来实现的。压缩了的js狠难理解。 求高人解释 谢谢!!
Request URL:http://127.0.0.1/ecshop/admin/goods.php?act=add
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:5449
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryGOLQryEg8iRpGIYC
Cookie:ECS_LastCheckOrder=Tue%2C%2027%20Aug%202013%2002%3A37%3A55%20GMT; ECS[visit_times]=2; ECSCP_ID=4b60487471b9cb778258d82e6f44c5685cd773e8
Host:127.0.0.1
Origin:http://127.0.0.1
Referer:http://127.0.0.1/ecshop/admin/goods.php?act=add
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Query String Parametersview sourceview URL encoded
act:add
Request Payload
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="MAX_FILE_SIZE"
2097152
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_name"
MINGCHENG
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_name_color"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_name_style"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_sn"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="cat_id"
7
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="addedCategoryName"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="addedBrandName"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="suppliers_id"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="shop_price"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_price[]"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_rank[]"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_price[]"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_rank[]"
3
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_price[]"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_rank[]"
2
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="volume_number[]"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="volume_price[]"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="market_price"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="give_integral"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="rank_integral"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="integral"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="promote_start_date"
2013-08-27
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="promote_end_date"
2013-09-27
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_img"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_img_url"
ÉÌƷͼƬÍⲿURL
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="auto_thumb"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_desc"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_weight"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="weight_unit"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_number"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="warn_number"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="is_on_sale"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="is_alone_sale"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="keywords"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_brief"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="seller_note"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_type"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="img_desc[]"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="img_url[]"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="img_file[]"
»òÕßÊäÈëÍⲿͼƬÁ´½ÓµØÖ·
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="cat_id1"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id1"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="keyword1"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="is_single"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="cat_id2"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id2"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="keyword2"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="price2"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="article_title"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_id"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="act"
insert
------WebKitFormBoundaryGOLQryEg8iRpGIYC--
Response Headersview source
Cache-Control:no-cache, must-revalidate
Connection:Keep-Alive
Content-Type:text/html; charset=gbk
Date:Tue, 27 Aug 2013 02:38:31 GMT
Expires:Fri, 14 Mar 1980 20:53:00 GMT
Keep-Alive:timeout=5, max=99
Last-Modified:Tue, 27 Aug 2013 02:38:31 GMT
Pragma:no-cache
Server:Apache/2.2.4 (Win32) PHP/5.2.3
Set-Cookie:ECSCP[last_choose]=7%7C1; expires=Wed, 28-Aug-2013 02:38:32 GMT
Transfer-Encoding:chunked
X-Powered-By:PHP/5.2.3
的是数据段
其中:
----WebKitFormBoundaryGOLQryEg8iRpGIYC 分隔符,表示一段开始(也可以说是上一段结束)
分隔符是动态产生的,这样申明的
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id" 一个字段,name 属性指示字段名
最后是值
http 协议中传送数据的格式有好几种,这是其中的一种
除非你想用 Socket 编程实现数据传输,并无了解这些细节的必要
提交处理的时候,act是等于insert才对的。
可ecshop 却依然调用了添加页面的 add。
而在request_playload中 发现了
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="act"
insert
真是奇怪,没看过这样的提交方式;不知道是怎样实现的。 查了ecshop的js,好像是用fckeditor控件来实现的。压缩了的js狠难理解。 求高人解释 谢谢!!
Request URL:http://127.0.0.1/ecshop/admin/goods.php?act=add
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:5449
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryGOLQryEg8iRpGIYC
Cookie:ECS_LastCheckOrder=Tue%2C%2027%20Aug%202013%2002%3A37%3A55%20GMT; ECS[visit_times]=2; ECSCP_ID=4b60487471b9cb778258d82e6f44c5685cd773e8
Host:127.0.0.1
Origin:http://127.0.0.1
Referer:http://127.0.0.1/ecshop/admin/goods.php?act=add
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Query String Parametersview sourceview URL encoded
act:add
Request Payload
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="MAX_FILE_SIZE"
2097152
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_name"
MINGCHENG
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_name_color"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_name_style"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_sn"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="cat_id"
7
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="addedCategoryName"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="addedBrandName"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="suppliers_id"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="shop_price"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_price[]"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_rank[]"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_price[]"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_rank[]"
3
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_price[]"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="user_rank[]"
2
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="volume_number[]"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="volume_price[]"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="market_price"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="give_integral"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="rank_integral"
-1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="integral"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="promote_start_date"
2013-08-27
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="promote_end_date"
2013-09-27
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_img"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_img_url"
ÉÌƷͼƬÍⲿURL
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="auto_thumb"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_desc"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_weight"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="weight_unit"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_number"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="warn_number"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="is_on_sale"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="is_alone_sale"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="keywords"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_brief"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="seller_note"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_type"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="img_desc[]"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="img_url[]"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="img_file[]"
»òÕßÊäÈëÍⲿͼƬÁ´½ÓµØÖ·
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="cat_id1"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id1"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="keyword1"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="is_single"
1
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="cat_id2"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id2"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="keyword2"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="price2"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="article_title"
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="goods_id"
0
------WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="act"
insert
------WebKitFormBoundaryGOLQryEg8iRpGIYC--
Response Headersview source
Cache-Control:no-cache, must-revalidate
Connection:Keep-Alive
Content-Type:text/html; charset=gbk
Date:Tue, 27 Aug 2013 02:38:31 GMT
Expires:Fri, 14 Mar 1980 20:53:00 GMT
Keep-Alive:timeout=5, max=99
Last-Modified:Tue, 27 Aug 2013 02:38:31 GMT
Pragma:no-cache
Server:Apache/2.2.4 (Win32) PHP/5.2.3
Set-Cookie:ECSCP[last_choose]=7%7C1; expires=Wed, 28-Aug-2013 02:38:32 GMT
Transfer-Encoding:chunked
X-Powered-By:PHP/5.2.3
回复讨论(解决方案)
楼上无聊人发广告 !
形如
------WebKitFormBoundaryGOLQryEg8iRpGIYCContent-Disposition: form-data; name="brand_id"1
的是数据段
其中:
----WebKitFormBoundaryGOLQryEg8iRpGIYC 分隔符,表示一段开始(也可以说是上一段结束)
分隔符是动态产生的,这样申明的
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryGOLQryEg8iRpGIYC
Content-Disposition: form-data; name="brand_id" 一个字段,name 属性指示字段名
最后是值
http 协议中传送数据的格式有好几种,这是其中的一种
除非你想用 Socket 编程实现数据传输,并无了解这些细节的必要
ecshop添加商品的内容相对较多,但是是直接提交到本页面的php文件,和js无关。
上一篇: PHP设计模式漫谈之迭代器模式