{'tank'}); } function getOwner($id,$j){ foreach($j as $val){ if($val->{'tank'}==$id){ return $val->{'owner'}; } } } sort($arr); function seconds2HMS($inputval){ $hh = intval($inputval / 3600); $ss_remaining = ($inputval - ($hh * 3600)); $mm = intval($ss_remaining / 60); $ss = ($ss_remaining - ($mm * 60)); if($hh<10){ $hh='0'.$hh; } if($mm<10){ $mm='0'.$mm; } if($ss<10){ $ss='0'.$ss; } return $hh.':'.$mm.':'.$ss; } if($aquaN){ $GMT=$_POST["GMT"]; include("background/DB_conf.php"); $con=mysql_connect($mysql_host,$mysql_user,$mysql_password); if(!$con){ $con=mysql_connect($mysql_host,$mysql_user,$mysql_password); if(!$con){ $con=mysql_connect($mysql_host,$mysql_user,$mysql_password); } } if($_POST['min']&&$_POST['max']){ $limit= " LIMIT ".$_POST['min'].",".$_POST['max']; } else{ $limit=""; } if($con){ mysql_select_db($mysql_database,$con); if($aquaN=='all'){ $sql=mysql_query("SELECT `glowtime`,`fishcount`,`glowcount`,`tankid`,`players`,`gold` FROM `GlowRecords` WHERE `glowtime`>".(time()-($days*86400))." ORDER BY `glowtime` ASC".$limit); } else{ $sql=mysql_query("SELECT `glowtime`,`fishcount`,`glowcount`,`players`,`gold` FROM `GlowRecords` WHERE `tankid`=".$aquaN." AND `glowtime`>".(time()-($days*86400))." ORDER BY `glowtime` ASC".$limit); } echo 'Back or would you like to go to '; include('../php/pageJump.php'); if($GMT=='idk'){ echo 'Glow Time may be wrong cause I do not know your time zone.'; $GMT=0; } echo ''; if($aquaN=='all'){ echo ''; echo ''; } else{ echo ''; echo ''; } $tdiff=0; $gdiff=0; $count=0; $fcount=0; $gcount=0; $pcount=0; $data=''; $highData=0; # $lowData=100000; $Phigh=0; $Pdata=''; $timeData=''; $glowStr=''; $timeHigh=0; $timeLow=18000; while($row=mysql_fetch_array($sql)){ $count++; echo ''; if($aquaN=='all'){ echo ''; } echo ''; echo ''; echo ''; if($lastGlow){ echo ''; $tdiff+=($row['glowtime']-$lastGlow); $tdiff2=$row['glowtime']-$lastGlow; $timeData.=$tdiff2.','; if($tdiff2>$timeHigh) $timeHigh=$tdiff2; if($tdiff2<$timeLow) $timeLow=$tdiff2; $glowStr.=$row['glowcount'].','; } else{ echo ''; } echo ''; if($aquaN!='all'){ if($lastGlow){ echo ''; $gdiff+=($row['gold']-$lastGold); $gdiff2=$row['gold']-$lastGold; $data.=($row['gold']-$lastGold).","; $Pdata.=$row['players'].','; if($gdiff2>$highData) $highData=$gdiff2; if($row['players']>$Phigh) $Phigh=$row['players']; } else{ echo ''; } } echo ''; $pcount+=$row['players']; echo ''; if($tdiff2){ if($tlow){ if($tlow>$tdiff2){ $tlow=$tdiff2; } } else{ $tlow=$tdiff2; } if($thigh){ if($thigh<$tdiff2&&$tdiff2<16200){ $thigh=$tdiff2; } } else{ $thigh=$tdiff2; } } $fcount+=$row['fishcount']; $gcount+=$row['glowcount']; $lastGlow=$row['glowtime']; $lastGold=$row['gold']; } mysql_close($con); if($aquaN=='all'){ echo ''; } else{ echo ''; } echo ''; echo ''; echo ''; echo ''; if($aquaN=='all'){ echo ''; } else{ echo ''; } echo "
Results for Every Tank
Tank IdGlow TimeNumber of FishNumeber of Glowing FishTime Between GlowsPlayer CountTotal Gold
Results for '.getOwner($aquaN,$j).'\'s Tank
Glow TimeNumber of FishNumeber of Glowing FishTime Between GlowsPlayer CountGlow ProfitTotal Gold
'.$row['tankid'].''.gmdate("m\\/d\\/Y \@ h:i:s A",$row['glowtime']+($GMT*60*60)).''.$row['fishcount'].''.$row['glowcount'].''.seconds2HMS($row['glowtime']-$lastGlow).'N/A'.$row['players'].''.number_format($row['gold']-$lastGold).'N/A'.number_format($row['gold']).'
AverageAverage'.($fcount/$count).''.($gcount/$count).''.seconds2HMS($tdiff/($count-1)).''.($pcount/$count).' '.number_format($gdiff/($count-1)).' 
"; echo 'Time since last recorded glow - '.seconds2HMS(time()-$lastGlow).'
'; if($aquaN!='all'){ if(($tlow-(time()-$lastGlow))<0){ echo 'Next unkown game is predicted to be after '.seconds2HMS(0).' from now and before '.seconds2HMS($thigh-(time()-$lastGlow)).' from now.
'; echo 'In Algebra: '.seconds2HMS(0).'<T<'.seconds2HMS($thigh-(time()-$lastGlow)).'
'; } else{ echo 'Next unkown game is predicted to be after '.seconds2HMS($tlow-(time()-$lastGlow)).' from now and before '.seconds2HMS($thigh-(time()-$lastGlow)).' from now.
'; echo 'In Algebra: '.seconds2HMS($tlow-(time()-$lastGlow)).'<T<'.seconds2HMS($thigh-(time()-$lastGlow)).'
'; } } echo 'Shortest time differnce between glows '.seconds2HMS($tlow).'.
'; echo 'Longest time differnce between glows '.seconds2HMS($thigh).'.
'; echo 'Assuming Glow was missed if time difference is over 4 hours and 30 munites.'; if($data!=''){ $data=substr($data,0,-1); $Pdata=substr($Pdata,0,-1); $timeData=substr($timeData,0,-1); $glowStr=substr($glowStr,0,-1); $timeLow=floor($timeLow/60/60); $timeHigh=ceil($timeHigh/60/60); echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo ''; } } else{ echo 'Failed to connect to database (tried 3 times)'; } } else{ echo 'Stats are old available for users that have there tank advertised on the analyzer.'; echo '
'; echo ''; echo 'View Detailed glow history for '; echo '
Show last days'; echo '
or go to '; include('../php/pageJump.php'); echo '
'; echo ''; } ?>