日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

4399积分小游戏_分数提交规则

發(fā)布時間:2023/12/19 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 4399积分小游戏_分数提交规则 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

近日有研究4399的積分小游戲的分數(shù)提交規(guī)則, 但不能太高調(diào)的對做類似外掛的東西...

寫以下代碼..僅供分析研究

?

1 <?php
2 function emMsg($v) {
3 echo($v);
4 }
5
6 include_once 'mysql.php';
7
8 class getList {
9
10 private $db;
11
12 function __construct() {
13 $this->db = MySql::getInstance();
14 }
15
16 function getPkList($tid = null) {
17 $res = $this->db->query('SELECT * FROM gamelist' . (empty($tid) ? '' : ' where gameTid=\'' . $tid . '\''));
18 $list = array();
19 if (!$this->db->num_rows($res))
20 $list = $this->initList_4399();
21 else
22 while ($row = $this->db->fetch_array($res)) {
23 $list[] = $row;
24 }
25 return $list;
26 }
27
28 /*
29 * 初始化積分游戲
30 */
31
32 function initList_4399() {
33 $this->db->query('delete from gamelist');
34
35 $echo_arr = array();
36
37 for ($j = 1; $j < 12; $j++) {
38 $file_contents = iconv('gb2312', 'utf-8//ignore', file_get_contents('http://pk.4399.com/flash/' . $j . '_1.htm'));
39 $out = array();
40 //<a href="http://pk.4399.com/user/377.htm" target="_blank"><img title="野人釣魚" alt="野人釣魚" border="0" src="http://swfpk.4399pk.com:8080/4399pkbak/bak/pkimg/index_img/377.jpg" width="75" height="75"></a>
41 if (preg_match_all('/<li><a href="http:\/\/pk\.4399\.com\/user\/(\d+)\.htm" target="\_blank"><img.*?title="(.*?)".*?src="(.*?)".*?><\/a><p>.*?<\/p><\/li>/', $file_contents, $out)) {
42 //return $out;
43 if (count($out) == 4) {
44 for ($i = 0; $i < count($out[1]); $i++) {
45 $sql = "insert into gamelist (gameId,gameName,gameImg,gameTid) values('{$out[1][$i]}','{$out[2][$i]}','{$out[3][$i]}','{$j}')";
46 $this->db->query($sql);
47 array_push($echo_arr, array($out[1][$i], $out[2][$i], $out[3][$i]));
48 }
49 }
50 }
51 sleep(2);
52 }
53 return $echo_arr;
54 }
55
56 /*
57 * 得到積分
58 * $id 游戲ID
59 * $total 個數(shù)
60 * $model 模式 current 當前 all 總排行 month 月排行 last 上輪
61 */
62
63 function getSocre_4399($id, $model = 'all', $total = 3) {
64 $curl = curl_init();
65 curl_setopt($curl, CURLOPT_URL, 'http://my.4399.com/flashgame.php?ac=score_' . $model . '&gameid=' . $id);
66 curl_setopt($curl, CURLOPT_COOKIE, 'Pauth=403370469|66847612|7082ed77f7c271b74d84de349009452a|1328319929|10002|bbeae2e37479547b7c0d5da25d8eb004|0;');
67 // 403370469|66847612|c389c838712319dc773eef783f972fef|1328331099|10001|60bfe9367afff7e737d00b2f998dd7f8|0
68 // 403370469|66847612|580ea10bd8ccf57035a31c7d2abef941|1328333572|10002|ef2b08825599a1fc7ef0ef399b630ca4|0
69 // 403370469|66847612|0773296261e645a773fc245d039db2a6|1328333608|10002|83a5f67767d051e8f31d26df70445663|0
70 //curl_setopt($curl, CURLOPT_REFERER, 'http://www.360buy.com/');
71 //curl_setopt($curl,CURLOPT_HTTPHEADER,array('Referer:http://www.360buy.com/'));
72 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
73 $file_contents = curl_exec($curl);
74 curl_close($curl);
75 //$file_contents = iconv('gb2312', 'utf-8//ignore', $file_contents);
76 /* <td><a href="flashgame.php?ac=profile&uid=212607398">1051414225</a></td>
77 <td>151478</td>
78 * <td align="center"><a href="flashgame.php?ac=profile&uid=103301144">wawa6346</a></td><td align="center">172895</td>
79 * */
80 //echo $file_contents;
81 $out = array();
82 if (preg_match_all('/<td.*?><a href="flashgame.php\?ac\=profile&uid=.*?">.*?<\/a><\/td>.*?<td.*?>(\d+)<\/td>/s', $file_contents, $out)) {
83 $ret_array = array_slice($out[1], 0, $total);
84 $sql = 'update gamelist set gameScore=\'' . json_encode($ret_array) . "' where gameId='{$id}'";
85 $this->db->query($sql);
86 return $ret_array;
87 }
88 return array();
89 //echo $file_contents;
90 }
91
92 function setSocre_4399($id, $m = null, $arr = null) {
93 if (empty($arr)) {
94 $arr = $this->db->once_fetch_array('SELECT gameScore FROM gamelist where gameId=\'' . $id . '\'');
95 $arr = json_decode($arr['gameScore'], true);
96 }
97 if (empty($arr))
98 return 'error';
99
100 //平均分 冠軍分 亞軍分 季軍分
101 if (empty($m)) {
102 $score = floor(array_sum($arr) / count($arr));
103 } else {
104 $score = $arr[$m - 1];
105 }
106
107 //toKen
108 $token = substr(file_get_contents('http://my.4399.com/flashgame/flashgame_reload_token.php'), 7);
109 $miyao = 'ok123';
110 $orderId = date("YmdHis") . rand(100000, 999999);
111 $link = 'xn';
112 //_root.result + "xn" + _root.orderId + _root.miyao + "xn" + _level0.gameId + "xn" + _root.token
113 //http://my.4399.com/flashgame.php?ac=score_submit&token=73880937914d7521321497fbf27a189beea76f&Mac=257be7e4641d73e9a94c968f986e7516&orderId=20120204234108456451&result=10&gameId=346
114 $md5_token = md5($score . $link . $orderId . $link . $miyao . $link . $id . $link . $token);
115 $url = "http://my.4399.com/flashgame.php?ac=score_submit&token={$token}&Mac={$md5_token}&orderId={$orderId}&result={$score}&gameId={$id}";
116 $curl = curl_init();
117 curl_setopt($curl, CURLOPT_URL, $url);
118 curl_setopt($curl, CURLOPT_COOKIE, 'Pauth=403370469|66847612|7082ed77f7c271b74d84de349009452a|1328319929|10002|bbeae2e37479547b7c0d5da25d8eb004|0;');
119 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
120 //curl_setopt($curl, CURLOPT_POST, TRUE);
121 //curl_setopt($curl, CURLOPT_POSTFIELDS, "source=" . Vendor_Sina::appid . "&target_id={$target_id}");
122 $file_contents = curl_exec($curl);
123 curl_close($curl);
124 $out = array();
125 if (preg_match('/<div class="score_number"><h3>.*?<\/h3><p>(\d+)<\/p><\/div>/', $file_contents, $out)) {
126 if (is_numeric($out[1]))
127 return $out[1];
128 }
129 return 'null';
130 }
131
132 }



轉(zhuǎn)載于:https://www.cnblogs.com/wc1217/archive/2012/03/09/2387721.html

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結(jié)

以上是生活随笔為你收集整理的4399积分小游戏_分数提交规则的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。