Fork me on GitHub

** URGENT - DESPERATE HELP REQUIRED **  Bottom

  • Guys,

    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("<", "&lt;", str_replace(">", "&gt;", $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 = "&nbsp;<img src='$babstats_folder/$pic' border='0' width='20' height='20' alt='$name'> &nbsp; <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:
  • Please use more descriptive thread titles.

    If you have phpMyAdmin installed, which you should, you can disable the block by deactiving it in the blocks table. I cant tell you off the top of my head exactly how to do it, but that should started. Try searching the forum for "disable block phpMyAdmin", without the quotes. Make sure u check the radio button for searching all the terms or whatever. It displayed about 5 results for me.
  • Sorry....yes i am using phpMyAdmin with SQL and i have done a search for disable block phpMyAdmin and the search returns a Blank Page.....

    Narrowed this down to disable block and i get over 268 pages of results...... I really dont have time to view every single page and topic....so would really appreciate some guidance from yourself if possible please ? :)
  • Its ok..... I deleted the block i had a problem with through phpMyAdmin and the site is now back to where it was before....phew.... Thanks for pointing me in the right direction. ie: deleting a block through phpMyAdmin..... i wouldn't have thought of this.

    Thanks :)

    However.........I would still be interested to know how to get this working properly
  • as far as i can tell its not even a block for postnuke, its for phpnuke.
  • Thats strange as the guy on his website indicates very clearly that this is for Postnuke but can also be used for phpnuke.....in the code, he says that its raw code and it can be used anywhere....

    I am not a programmer so i dont really know what to look for.

    Does anyone know of postnuke code for recording chronos babstats in a block ?????

    I have been looking for ages for something that does this...... I have even installed phpnuke and run the phpnuke block and it works great.... but I dont want to swop over to phpnuke as my site is reasonbly established now, which would mean everyone signing up again for the new site.....

    I would have thought by now, someone may have ported this over to postnuke.....

    I will keep looking :(
  • Quote


    /*
    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");
    */


    name the file chronos.php and put it in your postnuke root directory. Then make a PHP block and use this just paste in: include("chronos.php");

    edit the config area of the chronos.php file with your DB information and such. Make sure you set the phpnuke part of the config to 0. That just might work for u. Good luck.
  • Thanks for the advice but could you help with one last thing?

    Quote

    use this just paste in: include("chronos.php");


    Whereabouts do i paste this within the code? or do i simple change the name of the file to Chronos? Sorry....am not a coder so am a little unsure about this.

    Thanks in advance for your help :D
  • hi, i made this block, him just download the wrong thing, him wanted a "chronos" block, but this is for BABSTATS, so obvious there is no chronos table, as i told him in my forum, i think him were getting error when trying to delete the block because him deleted the file from server, so it probably giving an error, him could just go block admin control and delete it icon_lol

    ya it work anywhere, just need to make a include for postnuke...
  • Sorry.... can you tell me what you mean by "making an include" ?

    Can you provide step by step instructions for me ?.... I am sure other people would also like to know.

    Thanks in advance :)
  • :shock:

    Quote


    include("filename.php");



    inside PHP block or PHP file, there is alreaddy an info about that, i aslo said, this is not for chronos!

This list is based on users active over the last 60 minutes.