Advertisement
Guest User

malware issue

a guest
Jul 29th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.58 KB | None | 0 0
  1. <?
  2. include("header.php");
  3.  
  4.  
  5. if(strlen($_GET['pre'])>1)
  6. {include($_GET['pre'].".php");}
  7. else{include("presets.php");}
  8.  
  9.  
  10. date_default_timezone_set('Australia/Brisbane'); // set timezone to hobowars time
  11.  
  12.  
  13. if(isset($_POST['id_list']))
  14. {
  15. $id_list_str = $_POST['id_list'];
  16. $_POST['id_list'] = explode(',',preg_replace('/\s+/','',$_POST['id_list']));
  17. }
  18.  
  19.  
  20. function csvtoarray($csvdata) // create a function to put csv file into an array
  21. {
  22. $rows = explode("\n", trim($csvdata)); // use the newline as a delimiter to separate rows
  23. $temp_array[0] = explode(',', preg_replace('/\s+/','',$rows[0])); // get headers, types of stats. remove whitespace from stat names
  24. for($i = 1; $i < count($rows); $i++) // run a loop for each row
  25. {
  26. $temp = explode(', ', $rows[$i]); //exploding each row at commas
  27. for($i2 = 0; $i2 < count($temp); $i2++) //run a loop for each stat in the row
  28. {
  29. $temp_array[$temp[1]][$temp_array[0][$i2]]=($temp[$i2]); //for each member, make an array key with the ID as value, then a sub-key with the stat name as key, and stat vaule as value
  30. }
  31. }
  32. return $temp_array; // returning the results of the function
  33. }
  34.  
  35.  
  36. function ex_range($ez,$v)
  37. {
  38. $ez=explode('-',$ez);
  39. if($v>=$ez[0] AND $v<=$ez[1])
  40. {return true;}
  41. else
  42. {return false;}
  43. }
  44.  
  45.  
  46. function array_orderby()
  47. {
  48. $args = func_get_args();
  49. $data = array_shift($args);
  50. foreach ($args as $n => $field) {
  51. if (is_string($field)) {
  52. $tmp = array();
  53. foreach ($data as $key => $row)
  54. $tmp[$key] = $row[$field];
  55. $args[$n] = $tmp;
  56. }
  57. }
  58. $args[] = &$data;
  59. call_user_func_array('array_multisort', $args);
  60. return array_pop($args);
  61. }
  62.  
  63.  
  64. if($_POST['colored_names'] == 'y')
  65. {
  66. if($_POST['startcolor']=="rr")
  67. {
  68. $rr_colors=array('cc0000','ff9900','66cc00','339966','0099cc','3366ff','3300cc');
  69. for($lc=0; $lc < ($_POST['top_num']); $lc++)
  70. {
  71. $color['r'][$lc]=hexdec(substr($rr_colors[($lc % count($rr_colors))],0,2));
  72. $color['g'][$lc]=hexdec(substr($rr_colors[($lc % count($rr_colors))],2,2));
  73. $color['b'][$lc]=hexdec(substr($rr_colors[($lc % count($rr_colors))],4,2));
  74. }
  75. }
  76. elseif($_POST['startcolor']=="hw")
  77. {
  78. $rr_colors=array('FA8202','000000','E67700','66411A');
  79. for($lc=0; $lc < ($_POST['top_num']); $lc++)
  80. {
  81. $color['r'][$lc]=hexdec(substr($rr_colors[($lc % count($rr_colors))],0,2));
  82. $color['g'][$lc]=hexdec(substr($rr_colors[($lc % count($rr_colors))],2,2));
  83. $color['b'][$lc]=hexdec(substr($rr_colors[($lc % count($rr_colors))],4,2));
  84. }
  85. }
  86. else
  87. {
  88. $color['r'][0]=hexdec(substr($_POST['startcolor'],0,2));
  89. $color['g'][0]=hexdec(substr($_POST['startcolor'],2,2));
  90. $color['b'][0]=hexdec(substr($_POST['startcolor'],4,2));
  91.  
  92. for($lc=1; $lc < $_POST['top_num']; $lc++)
  93. {
  94. $color['r'][$lc]=$color['r'][0]-(floor($color['r'][0]/$_POST['top_num'])*$lc);
  95. $color['g'][$lc]=$color['g'][0]-(floor($color['g'][0]/$_POST['top_num'])*$lc);
  96. $color['b'][$lc]=$color['b'][0]-(floor($color['b'][0]/$_POST['top_num'])*$lc);
  97. }
  98. }
  99. }
  100.  
  101.  
  102.  
  103.  
  104.  
  105. $old_stats=csvtoarray($_POST['data_old_view']); // make old data array
  106. $new_stats=csvtoarray($_POST['data_new_view']); // make new data array
  107. $old_time_epoch=strtotime($_POST['old_time']); // convert old time from plain text to unix epoch
  108. $new_time_epoch=strtotime($_POST['new_time']); // convert new time from plain text to unix epoch
  109.  
  110.  
  111.  
  112.  
  113. $mc=0;
  114. foreach ($new_stats as $value)
  115. { // for each member
  116. if($value['ID'] > 0)
  117. { // if ID is greather than zero
  118. $lc=0; // setting the loop count to zero
  119. foreach ($value as $value2)
  120. { // for each stat
  121. if(in_array($new_stats[0][$lc],array('Name','ID','Age','LastActive','Chamber'))){$difference[$mc][$new_stats[0][$lc]]=$value2;} // if current loop is calulating items in array, set gains array to current (new data) value
  122.  
  123. elseif(($old_stats[$value['ID']][$new_stats[0][$lc]]=='' OR $value2=='') AND !in_array($new_stats[0][$lc],array('Exp','BegIncome','Cash','Points','Tokens','DPs'))){$difference[$mc][$new_stats[0][$lc]]=0;
  124. $old_stats[$value['ID']][$new_stats[0][$lc]]=$value2;}
  125.  
  126. elseif($value2 < $old_stats[$value['ID']][$new_stats[0][$lc]] AND in_array($new_stats[0][$lc],array('Exp','BegIncome')))
  127. {$difference[$mc][$new_stats[0][$lc]]=$value2;}
  128.  
  129. else{$difference[$mc][$new_stats[0][$lc]]=$value2-$old_stats[$value['ID']][$new_stats[0][$lc]];} // if none of the above, subtract old stat from new stat, and set that for gains array
  130. $lc++; // increment the loop counter
  131. } // for each stat
  132. } // if ID greater than zero
  133. $mc++;
  134. } // for each member
  135.  
  136. include("formula.php");
  137. include("datastore.php");
  138.  
  139.  
  140.  
  141. echo'<form action="" method="get">
  142. <input type="button" value="Highlight All Output" onClick="javascript:this.form.output.focus();this.form.output.select();">
  143. (Push Ctrl-C to copy, or right click and select copy after highlighting)<br />';
  144.  
  145.  
  146.  
  147.  
  148. echo '<textarea name="textarea" id="output" wrap="off" cols="85" rows="48">';
  149.  
  150.  
  151. echo"Gains from [b]".$_POST['old_time']."[/b] to [b]".$_POST['new_time']."[/b] ";
  152. echo "(".round((strtotime($_POST['new_time'])-strtotime($_POST['old_time']))/86400,2)." Days)\n";
  153. if($_POST['bold_gains']=='y'){echo"[b]";}
  154. echo"\n";
  155.  
  156. if(isset($_POST['gain_type']))
  157. {
  158. foreach($_POST['gain_type'] as $stat_type)
  159. { // for each stat type to show
  160. $type_total=0;
  161. $type_show_count=0;
  162. if($_POST['bold_gains']<>'y'){echo "[b]";}
  163.  
  164. if(strlen($_POST['formula_alt']) > 1 AND $stat_type=='Formula'){echo "***".$_POST['formula_alt']."***";}
  165. else
  166. {
  167. echo "***".$stat_type;
  168. if($stat_type<>'Formula'){echo " Difference";}
  169. echo "***";
  170. }
  171. if($_POST['bold_gains']<>'y'){echo "[/b]";}
  172. echo"\n";
  173.  
  174.  
  175.  
  176. $sorted2 = array_orderby($difference, $stat_type, SORT_DESC);
  177. //$sorted2 = $difference;
  178. //eval("$_POST['id_list']=array(".$_POST['id_list'].");";
  179.  
  180. /*if(isset($_POST['id_list']))
  181. {
  182. $_POST['id_list'] = explode(',',preg_replace('/\s+/','',$_POST['id_list']));
  183. }
  184. */
  185.  
  186. foreach($sorted2 as $member)
  187. { // for each gang member
  188. if(
  189. ($member[$stat_type] > 0 AND $_POST['ex_pos'] == 'y') OR
  190. ($member[$stat_type] == 0 AND $_POST['ex_zer'] == 'y') OR
  191. ($member[$stat_type] < 0 AND $_POST['ex_neg'] == 'y') OR
  192. ex_range($_POST['ex_range'],$member[$stat_type]) OR
  193. ($_POST['id_list_type']=='blk' AND in_array($member['ID'],$_POST['id_list'])) OR
  194. ($_POST['id_list_type']=='wht' AND !in_array($member['ID'],$_POST['id_list']))
  195. )
  196.  
  197. {$noshow='';} //if exculded due to direction of or lack of gain
  198.  
  199. else{ //if not excluded
  200. $type_total=$type_total+$member[$stat_type];
  201. if($_POST['colored_names'] == 'y' AND $type_show_count < $_POST['top_num'])
  202. {
  203. echo "[hex=".
  204. str_pad(dechex($color['r'][$type_show_count]), 2, "0", STR_PAD_LEFT).
  205. str_pad(dechex($color['g'][$type_show_count]), 2, "0", STR_PAD_LEFT).
  206. str_pad(dechex($color['b'][$type_show_count]), 2, "0", STR_PAD_LEFT).
  207. "]";
  208. }
  209.  
  210.  
  211. if($_POST['comma_gains']=='y'){echo number_format($member[$stat_type])." - ";}else{echo $member[$stat_type]." - ";}
  212.  
  213. if($_POST['hoboname']=='y'){echo "[hoboname=".$member['ID']."]";}
  214.  
  215. else{
  216.  
  217. echo $member['Name']." (";
  218. if($_POST['link_names']=='y'){echo"[hobo=".$member['ID']."]";}
  219. echo $member['ID'];
  220. if($_POST['link_names']=='y'){echo"[/hobo]";}
  221. echo ")";
  222.  
  223. }
  224.  
  225. if($_POST['colored_names'] == 'y' AND $type_show_count < $_POST['top_num']){echo"[/hex]";}
  226. echo "\n";
  227. $type_show_count++;
  228. } // if not excluded
  229. } // for each gang member
  230. echo "\nTotal: ".number_format($type_total)."\n";
  231. echo "\n\n";
  232. } // for each stat type to show
  233. }
  234. if($_POST['bold_gains']=='y'){echo "[/b]";}
  235. echo "</textarea>";
  236. echo"</form>";
  237. ?>
  238.  
  239. </td>
  240. </tr>
  241. </table>
  242. <?
  243. include("footer.php");
  244. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement