I downloaded the babstat top 10 block (Bab Stats - Server Status v2.0) from this location http://har.entermatrix.net/modules.php?op=modload&name=Downloads&file=index&req=viewdownload&cid=5
I am using postnuke 7.6 on my site.
I uploaded the file to my server
I then added a PHP block to my site and now my whole site is broken..... take a look at this
http://www.4thukbrigade.com
You can see the error..... I dont have a table called bab_stats in my SQL database...I am using Chronos as the table name..... I figured that i need to change the script to show Chronos instead of bab_stats.... BUT....... PLEASE, how do i do this ??????
OR.......is there a way i can simply get my website up and working again ?.... I tried to delete the PHP script and when i do, i am still showing the error ?.
I then thought i would replace the index.php file with a new one.....still didnt work.!!
WHATS going on ??????
Please help....I have members contacting me going nuts as they cant get into the website ??????????
Heres the code:
Code
<?
/*
filename: block-babtop10.php
TOP 10 for Babstats with RANK image.
this is the "pure" code, works in any page and any site
just use:
include("filename.php");
and edit the style.
by LethaLweapon=HAR=
http://har.entermatrix.net
*/
/*
config: info if you using postnuke site and stats are in the same DB,
you can add this comment "//" (without quotes) to all lines below till // end config.
then go admin page and add a "PHP BLOCK" in this new block put include("filename.php");
if PHP-NUKE copy the file to block folder and add it on admin page.
*/
$dbhost = "xxxxxxxx"; //host
$dbuname = "xxxxxxxxxxx"; // database username
$dbpass = "xxxxxxxxxx"; // database password
$dbname = "xxxxxxxxxxxx"; // database name
mysql_connect($dbhost, $dbuname, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
// end config
$isphpnuke = 1; // for phpnuke use 1 for anything else 0
$babstats_folder= "babstats"; // babstats folder.
$ranks_table = "bab_ranks"; // ranks table
$stats_table = "bab_stats"; // stats table
if (eregi("block-babtop10.php",$_SERVER[PHP_SELF]) && $isphpnuke == 1 ) {
header("Location: ../index.php");
die();
}
$mquery = mysql_query(" SELECT * FROM $stats_table ORDER BY total_kills DESC LIMIT 10") or die(mysql_error());
$content = '
<table border="0" width="100%" cellpadding="2" cellspacing="2" align="center">
<tr>
<td valign="top" nowrap>
';
while($mrow = mysql_fetch_array($mquery)) {
$playname = $mrow[player_name] = str_replace("<", "<", str_replace(">", ">", $mrow[player_name]));
$id = $mrow[id];
$rating = CalcRating("$ranks_table", "$stats_table", $mrow[id]);
$rank_query = mysql_query("SELECT * FROM $ranks_table WHERE rating <= $rating AND total_games <= $mrow[total_games] ORDER BY total_games DESC LIMIT 10") or die(mysql_error());
$rank_row = mysql_fetch_array($rank_query);
$pic = $rank_row[image];
$name = $rank_row[name];
$mcontent = " <img src='$babstats_folder/$pic' border='0' width='20' height='20' alt='$name'> <a href='$babstats_folder/index.php?action=player_stats&id=$id' style='text-decoration : none;' title='$name'>$playname</a><br> \n";
$content .= "$mcontent";
}
// html end
$content .= "<BR></td></tr></table>";
if ($isphpnuke !== 1) { echo "$content"; }
//func
function CalcRating($ranks_table, $stats_table, $id) {
$query = mysql_query("SELECT total_kills AS total_kills,
total_deaths AS total_deaths,
total_headshots AS total_headshots,
total_knives AS total_knifings,
total_suicides AS total_suicides,
total_murders AS total_murders,
total_medsaves AS total_medic_saves,
total_kills/total_games AS average_kills,
total_deaths/total_games AS average_deaths,
(total_kills-total_deaths)/total_games AS average_kills_deaths,
total_knives/total_games AS average_knifings,
total_headshots/total_games AS average_headshots,
total_suicides/total_games AS average_suicides,
total_medsaves/total_games AS average_medic_saves,
total_murders/total_games AS average_murders,
avg_kd_ratio AS average_kill_death_ratio,
top_kd_ratio AS top_kill_death_ratio,
top_kd AS top_kills_deaths,
top_knives AS top_knifings,
top_medsaves AS top_medic_saves,
total_koth_score+total_tkoth_score AS total_zone_time,
IF(top_koth_score<top_tkoth_score,top_tkoth_score,top_koth_score) AS top_zone_time,
(total_koth_score+total_tkoth_score)/(koth_games+tkoth_games) AS average_zone_time,
total_ctf_score+total_fb_score AS total_flags_captured,
total_ctf_flags_saved AS total_flags_saved,
total_ctf_flags_picked+total_fb_flags_picked AS total_flags_picked,
(total_ctf_score+total_fb_score)/(ctf_games+fb_games) AS average_flags_captured,
total_ctf_flags_saved/ctf_games AS average_flags_saved,
(total_ctf_flags_picked+total_fb_flags_picked)/(ctf_games+fb_games) AS average_flags_picked,
IF(top_ctf_score<top_fb_score,top_fb_score,top_ctf_score) AS top_flags_captured,
total_ad_score+total_sd_score AS total_targets_destroyed,
(total_ad_score+total_sd_score)/(ad_games+sd_games) AS average_targets_destroyed,
IF(top_ad_score<top_sd_score,top_sd_score,top_ad_score) AS top_targets_destroyed,
total_games AS total_games,
coop_games AS total_coop_games,
dm_games AS total_dm_games,
tdm_games AS total_tdm_games,
koth_games AS total_koth_games,
tkoth_games AS total_tkoth_games,
ctf_games AS total_ctf_games,
fb_games AS total_fb_games,
ad_games AS total_ad_games,
sd_games AS total_sd_games,
avg_coop_rank AS average_coop_rank,
avg_dm_rank AS average_dm_rank,
avg_tdm_rank AS average_tdm_rank,
avg_koth_rank AS average_koth_rank,
avg_tkoth_rank AS average_tkoth_rank,
avg_ctf_rank AS average_ctf_rank,
avg_fb_rank AS average_fb_rank,
avg_ad_rank AS average_ad_rank,
avg_sd_rank AS average_sd_rank,
team_blue AS played_for_blue,
team_red AS played_for_red,
team_yellow AS played_for_yellow,
team_violet AS played_for_violet,
team_games_won AS total_team_games_won,
total_sniper_uses AS total_sniper_uses,
total_mg_uses AS total_machinegun_uses,
total_rifle_uses AS total_rifle_uses,
total_sniper_kills AS total_sniper_kills,
total_mg_kills AS total_machinegun_kills,
total_rifle_kills AS total_rifle_kills,
IF(total_sniper_kills<20,0,total_sniper_kills/(total_sniper_uses+1)*100) AS sniper_accuracy,
IF(total_mg_kills<20,0,total_mg_kills/(total_mg_uses+1)*100) AS machinegun_accuracy,
IF(total_rifle_kills<20,0,total_rifle_kills/(total_rifle_uses+1)*100) AS rifle_accuracy,
(team_games_won)/(team_blue+team_red+team_yellow+team_violet)*100 AS percent_team_games_won
FROM `$stats_table`
WHERE id='$id'
LIMIT 1") or die(mysql_error());
if(mysql_num_rows($query) == 0) return 0;
$row = mysql_fetch_array($query);
// Here you can do your own perfomance rating calculation.
if($row[average_kills_deaths] < 0) $row[average_kills_deaths] = 0;
$dm_rating = 17 - $row[average_dm_rank];
if($dm_rating <= 0) $dm_rating = 0;
if($dm_rating >= 15) $dm_rating = 15;
$dm_rating = $dm_rating*$row[total_dm_games]/($row[total_games]+1);
$tdm_rating = $row[average_kills_deaths]*2+$row[average_kill_death_ratio]*2;
if($tdm_rating <= 0) $tdm_rating = 0;
if($tdm_rating >= 15) $tdm_rating = 15;
$tdm_rating = $tdm_rating*$row[total_tdm_games]/($row[total_games]+1);
$zone_rating = $row[average_kills_deaths]/2+$row[average_zone_time]/30;
if($zone_rating <= 0) $zone_rating = 0;
if($zone_rating >= 15) $zone_rating = 15;
$zone_rating = $zone_rating*($row[total_koth_games]+$row[total_tkoth_games])/($row[total_games]+1);
$flag_rating = $row[average_kills_deaths]/2+$row[average_flags_captured]*5;
if($flag_rating <= 0) $flag_rating = 0;
if($flag_rating >= 15) $flag_rating = 15;
$flag_rating = $flag_rating*($row[total_ctf_games]+$row[total_fb_games])/($row[total_games]+1);
$target_rating = $row[average_kills_deaths]/2+$row[average_targets_destroyed]*5;
if($target_rating <= 0) $target_rating = 0;
if($target_rating >= 15) $target_rating = 15;
$target_rating = $target_rating*($row[total_ad_games]+$row[total_sd_games])/($row[total_games]+1);
return round($dm_rating + $tdm_rating + $zone_rating + $flag_rating + $target_rating,2);
}
?>
/*
filename: block-babtop10.php
TOP 10 for Babstats with RANK image.
this is the "pure" code, works in any page and any site
just use:
include("filename.php");
and edit the style.
by LethaLweapon=HAR=
http://har.entermatrix.net
*/
/*
config: info if you using postnuke site and stats are in the same DB,
you can add this comment "//" (without quotes) to all lines below till // end config.
then go admin page and add a "PHP BLOCK" in this new block put include("filename.php");
if PHP-NUKE copy the file to block folder and add it on admin page.
*/
$dbhost = "xxxxxxxx"; //host
$dbuname = "xxxxxxxxxxx"; // database username
$dbpass = "xxxxxxxxxx"; // database password
$dbname = "xxxxxxxxxxxx"; // database name
mysql_connect($dbhost, $dbuname, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
// end config
$isphpnuke = 1; // for phpnuke use 1 for anything else 0
$babstats_folder= "babstats"; // babstats folder.
$ranks_table = "bab_ranks"; // ranks table
$stats_table = "bab_stats"; // stats table
if (eregi("block-babtop10.php",$_SERVER[PHP_SELF]) && $isphpnuke == 1 ) {
header("Location: ../index.php");
die();
}
$mquery = mysql_query(" SELECT * FROM $stats_table ORDER BY total_kills DESC LIMIT 10") or die(mysql_error());
$content = '
<table border="0" width="100%" cellpadding="2" cellspacing="2" align="center">
<tr>
<td valign="top" nowrap>
';
while($mrow = mysql_fetch_array($mquery)) {
$playname = $mrow[player_name] = str_replace("<", "<", str_replace(">", ">", $mrow[player_name]));
$id = $mrow[id];
$rating = CalcRating("$ranks_table", "$stats_table", $mrow[id]);
$rank_query = mysql_query("SELECT * FROM $ranks_table WHERE rating <= $rating AND total_games <= $mrow[total_games] ORDER BY total_games DESC LIMIT 10") or die(mysql_error());
$rank_row = mysql_fetch_array($rank_query);
$pic = $rank_row[image];
$name = $rank_row[name];
$mcontent = " <img src='$babstats_folder/$pic' border='0' width='20' height='20' alt='$name'> <a href='$babstats_folder/index.php?action=player_stats&id=$id' style='text-decoration : none;' title='$name'>$playname</a><br> \n";
$content .= "$mcontent";
}
// html end
$content .= "<BR></td></tr></table>";
if ($isphpnuke !== 1) { echo "$content"; }
//func
function CalcRating($ranks_table, $stats_table, $id) {
$query = mysql_query("SELECT total_kills AS total_kills,
total_deaths AS total_deaths,
total_headshots AS total_headshots,
total_knives AS total_knifings,
total_suicides AS total_suicides,
total_murders AS total_murders,
total_medsaves AS total_medic_saves,
total_kills/total_games AS average_kills,
total_deaths/total_games AS average_deaths,
(total_kills-total_deaths)/total_games AS average_kills_deaths,
total_knives/total_games AS average_knifings,
total_headshots/total_games AS average_headshots,
total_suicides/total_games AS average_suicides,
total_medsaves/total_games AS average_medic_saves,
total_murders/total_games AS average_murders,
avg_kd_ratio AS average_kill_death_ratio,
top_kd_ratio AS top_kill_death_ratio,
top_kd AS top_kills_deaths,
top_knives AS top_knifings,
top_medsaves AS top_medic_saves,
total_koth_score+total_tkoth_score AS total_zone_time,
IF(top_koth_score<top_tkoth_score,top_tkoth_score,top_koth_score) AS top_zone_time,
(total_koth_score+total_tkoth_score)/(koth_games+tkoth_games) AS average_zone_time,
total_ctf_score+total_fb_score AS total_flags_captured,
total_ctf_flags_saved AS total_flags_saved,
total_ctf_flags_picked+total_fb_flags_picked AS total_flags_picked,
(total_ctf_score+total_fb_score)/(ctf_games+fb_games) AS average_flags_captured,
total_ctf_flags_saved/ctf_games AS average_flags_saved,
(total_ctf_flags_picked+total_fb_flags_picked)/(ctf_games+fb_games) AS average_flags_picked,
IF(top_ctf_score<top_fb_score,top_fb_score,top_ctf_score) AS top_flags_captured,
total_ad_score+total_sd_score AS total_targets_destroyed,
(total_ad_score+total_sd_score)/(ad_games+sd_games) AS average_targets_destroyed,
IF(top_ad_score<top_sd_score,top_sd_score,top_ad_score) AS top_targets_destroyed,
total_games AS total_games,
coop_games AS total_coop_games,
dm_games AS total_dm_games,
tdm_games AS total_tdm_games,
koth_games AS total_koth_games,
tkoth_games AS total_tkoth_games,
ctf_games AS total_ctf_games,
fb_games AS total_fb_games,
ad_games AS total_ad_games,
sd_games AS total_sd_games,
avg_coop_rank AS average_coop_rank,
avg_dm_rank AS average_dm_rank,
avg_tdm_rank AS average_tdm_rank,
avg_koth_rank AS average_koth_rank,
avg_tkoth_rank AS average_tkoth_rank,
avg_ctf_rank AS average_ctf_rank,
avg_fb_rank AS average_fb_rank,
avg_ad_rank AS average_ad_rank,
avg_sd_rank AS average_sd_rank,
team_blue AS played_for_blue,
team_red AS played_for_red,
team_yellow AS played_for_yellow,
team_violet AS played_for_violet,
team_games_won AS total_team_games_won,
total_sniper_uses AS total_sniper_uses,
total_mg_uses AS total_machinegun_uses,
total_rifle_uses AS total_rifle_uses,
total_sniper_kills AS total_sniper_kills,
total_mg_kills AS total_machinegun_kills,
total_rifle_kills AS total_rifle_kills,
IF(total_sniper_kills<20,0,total_sniper_kills/(total_sniper_uses+1)*100) AS sniper_accuracy,
IF(total_mg_kills<20,0,total_mg_kills/(total_mg_uses+1)*100) AS machinegun_accuracy,
IF(total_rifle_kills<20,0,total_rifle_kills/(total_rifle_uses+1)*100) AS rifle_accuracy,
(team_games_won)/(team_blue+team_red+team_yellow+team_violet)*100 AS percent_team_games_won
FROM `$stats_table`
WHERE id='$id'
LIMIT 1") or die(mysql_error());
if(mysql_num_rows($query) == 0) return 0;
$row = mysql_fetch_array($query);
// Here you can do your own perfomance rating calculation.
if($row[average_kills_deaths] < 0) $row[average_kills_deaths] = 0;
$dm_rating = 17 - $row[average_dm_rank];
if($dm_rating <= 0) $dm_rating = 0;
if($dm_rating >= 15) $dm_rating = 15;
$dm_rating = $dm_rating*$row[total_dm_games]/($row[total_games]+1);
$tdm_rating = $row[average_kills_deaths]*2+$row[average_kill_death_ratio]*2;
if($tdm_rating <= 0) $tdm_rating = 0;
if($tdm_rating >= 15) $tdm_rating = 15;
$tdm_rating = $tdm_rating*$row[total_tdm_games]/($row[total_games]+1);
$zone_rating = $row[average_kills_deaths]/2+$row[average_zone_time]/30;
if($zone_rating <= 0) $zone_rating = 0;
if($zone_rating >= 15) $zone_rating = 15;
$zone_rating = $zone_rating*($row[total_koth_games]+$row[total_tkoth_games])/($row[total_games]+1);
$flag_rating = $row[average_kills_deaths]/2+$row[average_flags_captured]*5;
if($flag_rating <= 0) $flag_rating = 0;
if($flag_rating >= 15) $flag_rating = 15;
$flag_rating = $flag_rating*($row[total_ctf_games]+$row[total_fb_games])/($row[total_games]+1);
$target_rating = $row[average_kills_deaths]/2+$row[average_targets_destroyed]*5;
if($target_rating <= 0) $target_rating = 0;
if($target_rating >= 15) $target_rating = 15;
$target_rating = $target_rating*($row[total_ad_games]+$row[total_sd_games])/($row[total_games]+1);
return round($dm_rating + $tdm_rating + $zone_rating + $flag_rating + $target_rating,2);
}
?>
REALLY DESPERATE FOR HELP PLEASE :shock:
