地址: http://www.cnblogs.com/phphuaibei/archive/2012/04/30/2477251.html使用firebug我们可以发现,每次投票都会触发一个http请求,
我们可以把这个http的链接:http://minisite.youku.com/pub2/i_am_legend/vote.php?id=XMjc1NzExMzE2&callback=c&i=0.19621988418141467
我的第一感觉这个是使用getjson方式做的投票,我们把这个放在浏览器里,刷新几次发现数据一直是增加的,,689票,这样就可以刷票??
带着好奇我打开页面发现这个选手的票数情况:
我擦,我第一感觉这个怎么跟我平时做的投票很类似啊,赶紧找列表页的ajax请求文件;果然发现是:[color=#FF0000]http://minisite.youku.com/pub2/i_am_legend/getvote.php?page=1&callback=cc&count=8&i=0.42276474971249034[/color]
这是一个很典型的jquery里面的getjson方式返回的数据(我使用的jquery框架,优酷不是使用jq框架,但是原来类似),我又找了一个这个请求的源码:
?12345678910111213141516171819202122232425262728293031 function vTpListGet(pg, pz, t){ pg = (pg || 1); pz = (pz || 8); t = (t || false); cc = function(oList, total){ if(oList.length > 0){ var html = ""; for(var i=0;i < oList.length;i++){ html += "<ul class=\"x\">\n"; html += " <li class=\"x_thumb\"><a href=\"javascript:;\" onclick=\"vTpSet('"+oList[i].videoid+"','"+oList[i].title+"');\" title=\""+oList[i].title+"\"><img src=\""+oList[i].thumburl+"\" alt=\""+oList[i].title+"\" /></a></li>\n"; html += " <li class=\"x_title\"><a href=\"javascript:;\" onclick=\"vTpSet('"+oList[i].videoid+"','"+oList[i].title+"');\" title=\""+oList[i].title+"\">"+oList[i].title+"</a></li>\n"; html += " <li class=\"x_data\">票数:<span class=\"num\">"+oList[i].total+"</span></li>\n"; html += " <li class=\"x_btn\"><span class=\"btn\" onclick=\"vTpSet('"+oList[i].videoid+"','"+oList[i].title+"');\"></span></li>\n"; html += "</ul>\n"; } html += "<div class=\"clear\"></div>"; //alert(html); document.getElementById('videosTpList').innerHTML = html; if(t){ //显示分页 max_cnt = pz; var js_pager = new jsPager(); js_pager.init(total, pz, pg, "vTpPager"); document.getElementById('videosTpPager').style.display = ""; document.getElementById('videosTpPager').innerHTML = js_pager.getHtml(); } } }; js_request("http://minisite.youku.com/pub2/i_am_legend/getvote.php?page="+pg+"&callback=cc&count="+pz+"&i=" + Math.random());} 再来看优酷关于限制频繁投票的方法:
?1234567891011121314 function vTp(vid){ c = function(num,vid){ alert("投票成功,目前票数为:"+num+"票!"); var exp = new Date (); exp.setTime(exp.getTime() + 3600000); setCookie("nrtp", "true", exp); } if(getCookie("nrtp") != "true"){ js_request("http://minisite.youku.com/pub2/i_am_legend/vote.php?id="+vid+"&callback=c&i=" + Math.random()); }else{ alert("一小时内只能投票一次!"); return false; }}
我们可以把这个http的链接:http://minisite.youku.com/pub2/i_am_legend/vote.php?id=XMjc1NzExMzE2&callback=c&i=0.19621988418141467
我的第一感觉这个是使用getjson方式做的投票,我们把这个放在浏览器里,刷新几次发现数据一直是增加的,,689票,这样就可以刷票??
带着好奇我打开页面发现这个选手的票数情况:
我擦,我第一感觉这个怎么跟我平时做的投票很类似啊,赶紧找列表页的ajax请求文件;果然发现是:[color=#FF0000]http://minisite.youku.com/pub2/i_am_legend/getvote.php?page=1&callback=cc&count=8&i=0.42276474971249034[/color]
这是一个很典型的jquery里面的getjson方式返回的数据(我使用的jquery框架,优酷不是使用jq框架,但是原来类似),我又找了一个这个请求的源码:
?12345678910111213141516171819202122232425262728293031 function vTpListGet(pg, pz, t){ pg = (pg || 1); pz = (pz || 8); t = (t || false); cc = function(oList, total){ if(oList.length > 0){ var html = ""; for(var i=0;i < oList.length;i++){ html += "<ul class=\"x\">\n"; html += " <li class=\"x_thumb\"><a href=\"javascript:;\" onclick=\"vTpSet('"+oList[i].videoid+"','"+oList[i].title+"');\" title=\""+oList[i].title+"\"><img src=\""+oList[i].thumburl+"\" alt=\""+oList[i].title+"\" /></a></li>\n"; html += " <li class=\"x_title\"><a href=\"javascript:;\" onclick=\"vTpSet('"+oList[i].videoid+"','"+oList[i].title+"');\" title=\""+oList[i].title+"\">"+oList[i].title+"</a></li>\n"; html += " <li class=\"x_data\">票数:<span class=\"num\">"+oList[i].total+"</span></li>\n"; html += " <li class=\"x_btn\"><span class=\"btn\" onclick=\"vTpSet('"+oList[i].videoid+"','"+oList[i].title+"');\"></span></li>\n"; html += "</ul>\n"; } html += "<div class=\"clear\"></div>"; //alert(html); document.getElementById('videosTpList').innerHTML = html; if(t){ //显示分页 max_cnt = pz; var js_pager = new jsPager(); js_pager.init(total, pz, pg, "vTpPager"); document.getElementById('videosTpPager').style.display = ""; document.getElementById('videosTpPager').innerHTML = js_pager.getHtml(); } } }; js_request("http://minisite.youku.com/pub2/i_am_legend/getvote.php?page="+pg+"&callback=cc&count="+pz+"&i=" + Math.random());} 再来看优酷关于限制频繁投票的方法:
?1234567891011121314 function vTp(vid){ c = function(num,vid){ alert("投票成功,目前票数为:"+num+"票!"); var exp = new Date (); exp.setTime(exp.getTime() + 3600000); setCookie("nrtp", "true", exp); } if(getCookie("nrtp") != "true"){ js_request("http://minisite.youku.com/pub2/i_am_legend/vote.php?id="+vid+"&callback=c&i=" + Math.random()); }else{ alert("一小时内只能投票一次!"); return false; }}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货