求高手帮忙把这个script转为PHP

时间:2022-10-22 23:58:52
http://st1.dbank.com/netdisk/js/custom-hp-one.js?v=2.6.0aa

我找了下
nsp_svc:=com.dbank.signin.signin
anticache: Math.floor(Math.random() * 1000)
nsp_sid: g.cookie("session"),
nsp_ts: m + new Date().getTime()
var u = h(w);
v = g.cookie("secret") + u;
nsp_key: g.md5(v).toLocaleUpperCase()


应该是这几个 
nsp_sid这个明白是从COOKIE中获取session值
其他的看不懂。。


最终效果如下
http://api.dbank.com/rest.php?nsp_svc=com.dbank.signin.signin&anticache=135&nsp_sid=kuCoeiUua7n1NuaNghwuaPnZ.YJqLlTBkV1rM.dCSLowAv9Z&nsp_ts=1341795427238&nsp_key=74CE86E17DE7C554FCDBCACEC60C5B3F&nsp_fmt=JS&nsp_cb=_jqjsp

13 个解决方案

#1


干嘛要把script转为PHP,2者不能共存吗?

#2


我需要 获得 nsp_key   anticache这些的PHP获取方式啊。。   

#3


太JB长了, 又没有页面执行环境, 看不起.

#4


 有啊   就dbank.com的签到的。。。 

JS 可以先 JS美化下 可以好看点。

if (jQuery) { (function(g) {
        var b = [],
        m = 0;
        g.jsonp_org = g.jsonp;
        var l = function(r, q) {
            g.extend(r, {
                nsp_sid: g.cookie("session"),
                nsp_ts: m + new Date().getTime()
            });
            if (typeof q == "function") {
                q(r)
            }
            d(r);
            return r
        };
        var d = function(w) {
            var u = h(w);
            var q;
            var v;
            if (g.cookie("secret")) {
                v = g.cookie("secret") + u;
                g.extend(w, {
                    nsp_key: g.md5(v).toLocaleUpperCase()
                })
            } else {
                var t = "secretFlash";
                var r = nsp.netdisk.getConfigInfo(t);
                q = nsp.netdisk.getcommon(r.sharedobject, t);
                if (q != null) {
                    v = q + u;
                    g.extend(w, {
                        nsp_key: g.md5(v).toLocaleUpperCase()
                    })
                } else {
                    g.extend(w, {
                        nsp_key: null
                    })
                }
            }
        };
        var h = function(t) {
            var q = [];
            var u = [];
            g.each(t, 
            function(v) {
                if (v !== "nsp_key") {
                    u.push(v)
                }
            });
            u.sort();
            for (var r = 0; r < u.length; r++) {
                if (u[r] != "nsp_cb") {
                    q.push(u[r] + t[u[r]])
                } else {
                    q.push("nsp_cb_jqjsp")
                }
            }
            return q.join("")
        };
        var n = function(q) {
            this.success = function(t, u) {
                var r = this;
                if (t.error && t.NSP_STATUS === 109 && r.retrynum < 1) {
                    r.retrynum++;
                    if (m === 0) {
                        g.nsp({},
                        function(x, y) {
                            var v = /Date:(.*)/g.exec(y);
                            var w = v[1];
                            m = Date.parse(w) - new Date().getTime();
                            delete q.data.nsp_ts;
                            r.retry()
                        })
                    }
                } else {
                    q.success(t, u);
                    c()
                }
            };
            this.send_request = function() {
                var r = g.extend(true, {},
                q, {
                    success: o,
                    my_handler: this
                });
                if (g.cookie("secret")) {
                    if (!r.data.nsp_cb || !r.data.nsp_ts || r.data.nsp_ts == "" || r.data.nsp_key == null) {
                        g.extend(r.data, {
                            nsp_fmt: "JS",
                            nsp_cb: "_jqjsp"
                        });
                        l(r.data, q.data_post_process)
                    }
                    g.jsonp_org(r)
                } else {
                    Rookie(function() {
                        if (!r.data.nsp_cb || !r.data.nsp_ts || r.data.nsp_ts == "" || r.data.nsp_key == null) {
                            g.extend(r.data, {
                                nsp_fmt: "JS",
                                nsp_cb: "_jqjsp"
                            });
                            l(r.data, q.data_post_process)
                        }
                        g.jsonp_org(r)
                    },
                    function() {
                        if (!r.data.nsp_cb || !r.data.nsp_ts || r.data.nsp_ts == "" || r.data.nsp_key == null) {
                            g.extend(r.data, {
                                nsp_fmt: "JS",
                                nsp_cb: "_jqjsp"
                            });
                            l(r.data, q.data_post_process)
                        }
                        g.jsonp_org(r)
                    })
                }
            };
            this.retrynum = 0;
            this.retry = this.send_request
        };
        var p = function(q, t, r) {
            r.success(q, t)
        };
        var o = function(q, r) {
            p.call(this, q, r, this.my_handler)
        };
        var c = function() {
            if (b.length) {
                var r = b.shift();
                var q = new n(r);
                q.send_request()
            }
        };
        var f = function(t, r, q) {
            using.register("io", true, "global/js/dbank.io.js?v=2.6.0");
            using.register("dom", true, "global/js/dbank.dom.js?v=2.6.0");
            using.register("json", true, "global/js/dbank.json.js?v=2.6.0");
            using.register("deferred", true, "js/deferred.js?v=2.6.0");
            using(["io", "dom", "json", "deferred"], 
            function() {
                var v = "http://api.dbank.com";
                var w = {};
                w.url = "http://api.dbank.com/rest.php";
                w.param = t;
                var u = function(x) {
                    window.console && console.log("return me from xdr once  only !!!");
                    if (typeof r == "function") {
                        window.console && console.log("call onsuccess only once!");
                        r(dbank.json.parse(x.data), x.header)
                    }
                };
                dbank.io.xdr.send(w, u, v)
            })
        };
        g.extend({
            buildData: l,
            nsp: f,
            jsonp: function(q) {
                b.push(q);
                if (b.length === 1) {
                    c()
                }
            },
            iAjaxSetting: function(q) {
                if (typeof(q) === "function") {
                    p = q
                }
                if (typeof(q) === "object" && typeof(q.success) === "function") {
                    p = q.success
                }
            }
        })
    } (jQuery))
}

#5


该回复于2012-07-09 11:19:36被版主删除

#6


这个要转成 php做啥呢?cookie 给个文件给php读.其他的需要传递的参数 就用ajax提交给php好了,
没有环境 关一段代码用php重构是比较麻烦的.

引用 4 楼  的回复:
 有啊   就dbank.com的签到的。。。 

JS 可以先 JS美化下 可以好看点。

JScript code
if (jQuery) { (function(g) {
        var b = [],
        m = 0;
        g.jsonp_org = g.jsonp;
        var l = function(r, q) {
      ……

#7


这个我想用PHP写个批量自动签到的 所以要用到  登陆的 搞定了 就这个不行
高手帮忙弄下吧。。

代码应该就在这几行

nsp_svc:=com.dbank.signin.signin
anticache: Math.floor(Math.random() * 1000)
nsp_sid: g.cookie("session"),
nsp_ts: m + new Date().getTime()
var u = h(w);
v = g.cookie("secret") + u;
nsp_key: g.md5(v).toLocaleUpperCase()

#8


JS转换PHP。。。


有什么价值意义么?直接JS引用不可以么?

#9


.......  貌似不行啊 。    还是得转PHP 。
主要是  获取 nsp_key 这几个加密方式

#10


.......   没人干这个差事啊

#11


这玩意没做过……这哥们代码不知道要干啥!

#12


用PHP很简单的哦.

官方就已经给出源码了.

http://open.dbank.com/appDatabase.html?v=2.6.2

<?php
function signRequest($secret, $param) {
  $str = $secret;
  ksort($param);
  foreach ($param as $k=>$v) {
    $str .= $k .$v;
  }
 
  return strtoupper(md5($str));
}
?>

#13


这些,官方一般独有例子给你copy。

#1


干嘛要把script转为PHP,2者不能共存吗?

#2


我需要 获得 nsp_key   anticache这些的PHP获取方式啊。。   

#3


太JB长了, 又没有页面执行环境, 看不起.

#4


 有啊   就dbank.com的签到的。。。 

JS 可以先 JS美化下 可以好看点。

if (jQuery) { (function(g) {
        var b = [],
        m = 0;
        g.jsonp_org = g.jsonp;
        var l = function(r, q) {
            g.extend(r, {
                nsp_sid: g.cookie("session"),
                nsp_ts: m + new Date().getTime()
            });
            if (typeof q == "function") {
                q(r)
            }
            d(r);
            return r
        };
        var d = function(w) {
            var u = h(w);
            var q;
            var v;
            if (g.cookie("secret")) {
                v = g.cookie("secret") + u;
                g.extend(w, {
                    nsp_key: g.md5(v).toLocaleUpperCase()
                })
            } else {
                var t = "secretFlash";
                var r = nsp.netdisk.getConfigInfo(t);
                q = nsp.netdisk.getcommon(r.sharedobject, t);
                if (q != null) {
                    v = q + u;
                    g.extend(w, {
                        nsp_key: g.md5(v).toLocaleUpperCase()
                    })
                } else {
                    g.extend(w, {
                        nsp_key: null
                    })
                }
            }
        };
        var h = function(t) {
            var q = [];
            var u = [];
            g.each(t, 
            function(v) {
                if (v !== "nsp_key") {
                    u.push(v)
                }
            });
            u.sort();
            for (var r = 0; r < u.length; r++) {
                if (u[r] != "nsp_cb") {
                    q.push(u[r] + t[u[r]])
                } else {
                    q.push("nsp_cb_jqjsp")
                }
            }
            return q.join("")
        };
        var n = function(q) {
            this.success = function(t, u) {
                var r = this;
                if (t.error && t.NSP_STATUS === 109 && r.retrynum < 1) {
                    r.retrynum++;
                    if (m === 0) {
                        g.nsp({},
                        function(x, y) {
                            var v = /Date:(.*)/g.exec(y);
                            var w = v[1];
                            m = Date.parse(w) - new Date().getTime();
                            delete q.data.nsp_ts;
                            r.retry()
                        })
                    }
                } else {
                    q.success(t, u);
                    c()
                }
            };
            this.send_request = function() {
                var r = g.extend(true, {},
                q, {
                    success: o,
                    my_handler: this
                });
                if (g.cookie("secret")) {
                    if (!r.data.nsp_cb || !r.data.nsp_ts || r.data.nsp_ts == "" || r.data.nsp_key == null) {
                        g.extend(r.data, {
                            nsp_fmt: "JS",
                            nsp_cb: "_jqjsp"
                        });
                        l(r.data, q.data_post_process)
                    }
                    g.jsonp_org(r)
                } else {
                    Rookie(function() {
                        if (!r.data.nsp_cb || !r.data.nsp_ts || r.data.nsp_ts == "" || r.data.nsp_key == null) {
                            g.extend(r.data, {
                                nsp_fmt: "JS",
                                nsp_cb: "_jqjsp"
                            });
                            l(r.data, q.data_post_process)
                        }
                        g.jsonp_org(r)
                    },
                    function() {
                        if (!r.data.nsp_cb || !r.data.nsp_ts || r.data.nsp_ts == "" || r.data.nsp_key == null) {
                            g.extend(r.data, {
                                nsp_fmt: "JS",
                                nsp_cb: "_jqjsp"
                            });
                            l(r.data, q.data_post_process)
                        }
                        g.jsonp_org(r)
                    })
                }
            };
            this.retrynum = 0;
            this.retry = this.send_request
        };
        var p = function(q, t, r) {
            r.success(q, t)
        };
        var o = function(q, r) {
            p.call(this, q, r, this.my_handler)
        };
        var c = function() {
            if (b.length) {
                var r = b.shift();
                var q = new n(r);
                q.send_request()
            }
        };
        var f = function(t, r, q) {
            using.register("io", true, "global/js/dbank.io.js?v=2.6.0");
            using.register("dom", true, "global/js/dbank.dom.js?v=2.6.0");
            using.register("json", true, "global/js/dbank.json.js?v=2.6.0");
            using.register("deferred", true, "js/deferred.js?v=2.6.0");
            using(["io", "dom", "json", "deferred"], 
            function() {
                var v = "http://api.dbank.com";
                var w = {};
                w.url = "http://api.dbank.com/rest.php";
                w.param = t;
                var u = function(x) {
                    window.console && console.log("return me from xdr once  only !!!");
                    if (typeof r == "function") {
                        window.console && console.log("call onsuccess only once!");
                        r(dbank.json.parse(x.data), x.header)
                    }
                };
                dbank.io.xdr.send(w, u, v)
            })
        };
        g.extend({
            buildData: l,
            nsp: f,
            jsonp: function(q) {
                b.push(q);
                if (b.length === 1) {
                    c()
                }
            },
            iAjaxSetting: function(q) {
                if (typeof(q) === "function") {
                    p = q
                }
                if (typeof(q) === "object" && typeof(q.success) === "function") {
                    p = q.success
                }
            }
        })
    } (jQuery))
}

#5


该回复于2012-07-09 11:19:36被版主删除

#6


这个要转成 php做啥呢?cookie 给个文件给php读.其他的需要传递的参数 就用ajax提交给php好了,
没有环境 关一段代码用php重构是比较麻烦的.

引用 4 楼  的回复:
 有啊   就dbank.com的签到的。。。 

JS 可以先 JS美化下 可以好看点。

JScript code
if (jQuery) { (function(g) {
        var b = [],
        m = 0;
        g.jsonp_org = g.jsonp;
        var l = function(r, q) {
      ……

#7


这个我想用PHP写个批量自动签到的 所以要用到  登陆的 搞定了 就这个不行
高手帮忙弄下吧。。

代码应该就在这几行

nsp_svc:=com.dbank.signin.signin
anticache: Math.floor(Math.random() * 1000)
nsp_sid: g.cookie("session"),
nsp_ts: m + new Date().getTime()
var u = h(w);
v = g.cookie("secret") + u;
nsp_key: g.md5(v).toLocaleUpperCase()

#8


JS转换PHP。。。


有什么价值意义么?直接JS引用不可以么?

#9


.......  貌似不行啊 。    还是得转PHP 。
主要是  获取 nsp_key 这几个加密方式

#10


.......   没人干这个差事啊

#11


这玩意没做过……这哥们代码不知道要干啥!

#12


用PHP很简单的哦.

官方就已经给出源码了.

http://open.dbank.com/appDatabase.html?v=2.6.2

<?php
function signRequest($secret, $param) {
  $str = $secret;
  ksort($param);
  foreach ($param as $k=>$v) {
    $str .= $k .$v;
  }
 
  return strtoupper(md5($str));
}
?>

#13


这些,官方一般独有例子给你copy。