WebsiteBaker 2.13.9 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
// gets information from table$result = mysql_query("SELECT * FROM ".TABLE_PREFIX."users WHERE group_id=7 ORDER BY user_id ASC") or die(mysql_error());echo "<table border='1' bordercolor='#cccccc' cellspacing='0' cellpadding='3'>";echo "<tr bgcolor='#cccccc'> <td>ID</td><td>Name</td><td>Username</td><td>E-mail</td></tr>";// gets results from tablewhile($row = mysql_fetch_array( $result )){ // prints content row by rowecho "<tr><td>"; echo $row['user_id'];echo "</td><td>"; echo "<b>"; echo $row['display_name']; echo "</b>";echo "</td><td>"; echo $row['username'];echo "</td><td>"; echo "<b>";echo $row['email']; echo "</b>";echo "</td></tr>"; }echo "</table>";
global $database, $wb;$return = " ";$query = "SELECT * FROM ".TABLE_PREFIX."users WHERE display_name<>'Admin' ORDER BY group_id";$result = $database->query($query);$return .= "<ul>";while($row = $result->fetchRow()) { $return .= "<li>".$row["display_name"]."</li>";# $return .= "<br>"; } $return .= "</ul>";return $return;
made a droplet for eliteforcemars.nl a while ago [
global $database, $wb;$return = " ";$query = "SELECT * FROM ".TABLE_PREFIX."users WHERE display_name<>'Admin' ORDER BY group_id";$result = $database->query($query);$return .= "";while($row = $result->fetchRow()) { $return .= "http://bfbc2.statsverse.com/sig/detail1/ps3/".$row["display_name"].".png"."<br>";# $return .= "<br>"; } $return .= "";return $return;
global $database, $wb;$return = " ";$query = "SELECT * FROM ".TABLE_PREFIX."users WHERE display_name<>'Admin' ORDER BY group_id";$result = $database->query($query);$return .= "";while($row = $result->fetchRow()) { $return .= "<img src="http://bfbc2.statsverse.com/sig/detail1/ps3/".$row["display_name"].".png">"."<br>";# $return .= "<br>"; } $return .= "";return $return;
<?php // not this line ;-)global $database, $wb;$return = " ";$query = "SELECT * FROM `".TABLE_PREFIX."users` WHERE `display_name`<>'Admin' ORDER BY group_id";$result = $database->query($query);while( true == ($row = $result->fetchRow())) { $return .= "<img src=\"http://bfbc2.statsverse.com/sig/detail1/ps3/".$row["display_name"].".png\" alt='' /><br />";} return $return;
// gets information from table$result = mysql_query("SELECT * FROM ".TABLE_PREFIX."users WHERE group_id=7 ORDER BY user_id ASC") or die(mysql_error());// gets results from tablewhile($row = mysql_fetch_array( $result ))echo $row['username'];
//prep the members$members = "user1,user2,user3";
<?php//prep the members// The most important piece. Add all your friends separated by commas.$members = "user1,user2,user3";$rankpoints=array(1 => 0,2 => 11000,3 => 18500,4 => 28000,5 => 40000,6 => 53000,7 => 68000,8 => 84000,9 => 100000,10 => 120000,11 => 138000,12 => 158000,13 => 179000,14 => 200000,15 => 224000,16 => 247000,17 => 272000,18 => 297000,19 => 323000,20 => 350000,21 => 377000,22 => 405000,23 => 437000,24 => 472000,25 => 537000,26 => 620000,27 => 720000,28 => 832000,29 => 956000,30 => 1092000,31 => 1240000,32 => 1400000,33 => 1572000,34 => 1756000,35 => 1952000,36 => 2160000,37 => 2380000,38 => 2612000,39 => 2856000,40 => 3112000,41 => 3380000,42 => 3660000,43 => 3952000,44 => 4256000,45 => 4572000,46 => 4900000,47 => 5240000,48 => 5592000,49 => 5956000,50 => 6332000); //grab the stats!$url = 'http://api.bfbcs.com/api/ps3';$postdata = 'players='.$members.'&fields=general';$ch = curl_init($url);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);$data = curl_exec($ch);curl_close($ch);$data = json_decode($data,true);if(isset($_GET['debug'])){ var_dump($data); echo '<br /><br />';}//loop through the data and store stats in an array$stats = array();for($x=0;$x<count($data['players']);$x++){ $name = $data['players'][$x]['name']; $rank = $data['players'][$x]['rank']; $score = $data['players'][$x]['score']; $kills = $data['players'][$x]['kills']; $deaths = $data['players'][$x]['deaths']; $raw_time = sec2hms($data['players'][$x]['time']); $ratio = number_format($kills/$deaths, 2, '.', ''); $dogtags = $data['players'][$x]['general']['dogt']; $total_time=$data['players'][$x]['time']; $SPM=number_format($score/($total_time/60), 2, '.', ''); $KPM=number_format($kills/($total_time/60), 2, '.', ''); $DPM=number_format($deaths/($total_time/60), 2, '.', ''); $score_general = $data['players'][$x]['general']['sc_general']; $score_award = $data['players'][$x]['general']['sc_award']; $score_bonus = $data['players'][$x]['general']['sc_bonus']; $score_team = $data['players'][$x]['general']['sc_team']; $score_squad = $data['players'][$x]['general']['sc_squad']; //calculate which class they use $assault = $data['players'][$x]['general']['sc_assault']; $recon = $data['players'][$x]['general']['sc_recon']; $demo = $data['players'][$x]['general']['sc_demo']; $support = $data['players'][$x]['general']['sc_support']; $the_classes = array(); $the_classes[0] = array('name'=>'assault','score'=>$assault); $the_classes[1] = array('name'=>'recon','score'=>$recon); $the_classes[2] = array('name'=>'demo','score'=>$demo); $the_classes[3] = array('name'=>'support','score'=>$support); //sort the classes array by score usort($the_classes,'compare_stats'); $most_used = $the_classes[0]['name']; $NextRank=intval($rank+1); // Search next rank if( empty($NextRank) ) $nextRankID = $rank; else { if($rankpoints[$rank] == $rankpoints[($rank + 1)]) { $nextRankID = 0; for ($m=($rank + 1);$m<(count($rankpoints)-1);$m++) { if( ($rankpoints[$m] > $rankpoints[$rank]) && ($nextRankID == 0) ) $nextRankID = $m; } } else $nextRankID = ($rank + 1); } if($rank < 10) { $rank = "0".$rank; } $stats[$x] = array('name'=>$name,'rank'=>$rank,'score'=>$score,'kills'=>$kills,'deaths'=>$deaths,'ratio'=>$ratio,'time'=>$raw_time,'most_used'=>$most_used,'dogtags'=>$dogtags,'SPM'=>$SPM,'KPM'=>$KPM,'DPM'=>$DPM,'sc_general'=>$score_general,'sc_award'=>$score_award,'sc_bonus'=>$score_bonus,'sc_team'=>$score_team,'sc_squad'=>$score_squad,'score_rank'=> $score - $rankpoints[$nextRankID-1],'diff_score'=> $rankpoints[$nextRankID] - $rankpoints[$nextRankID-1],'nextrankid'=> $nextRankID,'nextrankscore' => $rankpoints[$nextRankID]);}function sec2hms ($sec, $padHours = false) { $hms = ""; $hours = intval(intval($sec) / 3600); $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' : $hours. 'h '; $minutes = intval(($sec / 60) % 60); $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). 'm '; $seconds = intval($sec % 60); $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT).'s'; return $hms;}function compare_stats($x,$y){ if($x['score'] == $y['score']) { return 0; } elseif($x['score'] < $y['score']) { return 1; } else { return -1; }}//sort the stats array by scoreusort($stats,'compare_stats');?> <div align="center"> <table border="0" width="100%" id="table1"> <tr> <td align="center"> </td> <td><b>Player</b></td> <td align="center"><b>Kills</b></td> <td align="center"><b>Deaths</b></td> <td align="center"><b>KDR</b></td> <td align="center"><b>Total Time</b></td> </tr> <?php for($out=0;$out<count($stats);$out++) { $pos = $out + 1; ?> <tr><td width="29" align="center"><img src="http://battlefieldbadcompany2.com/files/gui/img/stats/ranks/tiny/R0<?php echo ''.$stats[$out]['rank'].'' ?>.png" alt="<?php echo ''.$stats[$out]['rank'].'' ?>" /></td> <td><a href="http://bfbcs.com/stats_ps3/<?php echo ''.$stats[$out]['name'].'' ?>" target="_blank"><?php echo ''.$stats[$out]['name'].'' ?></a></td> <td align="center"><?php echo ''.$stats[$out]['kills'].'' ?></td> <td align="center"><?php echo ''.$stats[$out]['deaths'].'' ?></td> <td align="center"><?php echo ''.$stats[$out]['ratio'].'' ?></td> <td align="center"><?php echo ''.$stats[$out]['time'].'' ?></td> </tr> <?php } ?></table></div><?phpif(!empty($data['players_nodata'])){ echo '<br><div align="center" id="stats_waiting">'.count($data['players_nodata']).' playerststs waiting in que.</div>'; }?><br><div align="center">Stats updated every six hours.</div><br><p align="center">Powered by: <a target="_blank" href="http://bfbcs.com/ps3">bfbcs.com</a></p>