Jump to content

long load IPS page


Recommended Posts

12 hours ago, bfarber said:

Without seeing the code it would be very difficult to say

echo '<script src="https://www.forms.funplay.pro/functions/amxbans.js.php"></script>';
$page = 1;
if(isset($_GET['p']) || !empty($_GET['p'])) {
    $page = ceil(intval($_GET['p']));
}
$servername = "";
$username = "";
$password = "";
$connect = new mysqli($servername, $username, $password);
if ($connect->connect_error) {
    exit("Connection failed: " . $connect->connect_error);
}
$sql = "SELECT COUNT(*) from `banlist_csgo`.`ctbanned_players`";
$result = $connect->query($sql);
$pocetbanu = $result->fetch_array(MYSQLI_NUM);
$maxpages = ceil($pocetbanu[0] / 50);
if($page > $maxpages) $page = $maxpages;
$limit = $page * 50 - 50;
$sql = "SELECT * FROM `banlist_csgo`.`ctbanned_players` ORDER BY `banlist_csgo`.`ctbanned_players`.`bantime` DESC LIMIT $limit, 50";
$result = $connect->query($sql);
$steam = \IPS\steam\Profile::load(\IPS\Member::loggedIn()->member_id);
if (strlen($steam->steamid) > 0) {
    $sql = "SELECT `servers`.`players`.`ctbancas` FROM `servers`.`players` WHERE `servers`.`players`.`steamid` = $steam->steamid";
    $isbanned = $connect->query($sql);
    if ($isbanned->num_rows > 0) {
        $row = $isbanned->fetch_assoc();
        if ($row["ctbancas"] > 0 || $row["ctbancas"] == -1) {
            echo '<div class="ipsMessage ipsMessage_warning">Na našich JB serverech máš aktivní CT ban.</div>';
        } else {
            echo '<div class="ipsMessage ipsMessage_success">Na našich JB serverech nemáš aktivní CT ban. Můžeš v klidu hrát za dozorce.</div>';
        }
    }
}
$sql = "SELECT COUNT(*) from `banlist_csgo`.`ctbanned_players` WHERE `banlist_csgo`.`ctbanned_players`.`bantime` >= UNIX_TIMESTAMP() - 86400";
$banu_pocet = $connect->query($sql);
$denbanu = $banu_pocet->fetch_array(MYSQLI_NUM);
$sql = "SELECT COUNT(*) from `banlist_csgo`.`ctbanned_players` WHERE `banlist_csgo`.`ctbanned_players`.`bantime` >= UNIX_TIMESTAMP() - 604800";
$banu_pocet = $connect->query($sql);
$tydenbanu = $banu_pocet->fetch_array(MYSQLI_NUM);
$sql = "SELECT COUNT(*) from `banlist_csgo`.`ctbanned_players` WHERE `banlist_csgo`.`ctbanned_players`.`bantime` >= UNIX_TIMESTAMP() - 2592000";
$banu_pocet = $connect->query($sql);
$mesicbanu = $banu_pocet->fetch_array(MYSQLI_NUM);
echo '<div class="ipsBox main_stats_bg" style="border: 1px solid #751a19;padding-left: 10px;padding-right: 10px;padding-top: 10px;margin-bottom: 10px;line-height: 16px;">
    <ol class="ipsGrid">
        <li class="ipsGrid_span3 ipsType_center">
            <div style="font-size: 28px;background: -webkit-linear-gradient(180deg,#751a19 0%,#ee3531 100%);background: linear-gradient(180deg,#751a19 0%,#ee3531 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;"><i class="fa fa-ban"></i></div>
            <div class="ipsStreamItem_container">
                <div class="ipsStreamItem_header ipsSpacer_top ipsSpacer_half">
                    <span class="ipsType_reset" style="font-weight: 800;">Celkem banů</span>
                </div>
                <span class="font-initial" style="font-weight: 200;color: white;">'.$pocetbanu[0].'</span>
            </div>
        </li>
        <li class="ipsGrid_span3 ipsType_center">
            <div style="font-size: 28px;background: -webkit-linear-gradient(180deg,#751a19 0%,#ee3531 100%);background: linear-gradient(180deg,#751a19 0%,#ee3531 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;"><i class="fa fa-area-chart"></i></div>
            <div class="ipsStreamItem_container">
                <div class="ipsStreamItem_header ipsSpacer_top ipsSpacer_half">
                    <span class="ipsType_reset" style="font-weight: 800;">za den</span>
                </div>
                <span class="font-initial" style="font-weight: 200;color: white;">'.$denbanu[0].'</span>
            </div>
        </li>
        <li class="ipsGrid_span3 ipsType_center">
            <div style="font-size: 28px;background: -webkit-linear-gradient(180deg,#751a19 0%,#ee3531 100%);background: linear-gradient(180deg,#751a19 0%,#ee3531 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;"><i class="fa fa-calendar-o"></i></div>
            <div class="ipsStreamItem_container">
                <div class="ipsStreamItem_header ipsSpacer_top ipsSpacer_half">
                    <span class="ipsType_reset" style="font-weight: 800;">za týden</span>
                </div>
                <span class="font-initial" style="font-weight: 200;color: white;">'.$tydenbanu[0].'</span>
            </div>
        </li>
        <li class="ipsGrid_span3 ipsType_center">
            <div style="font-size: 28px;background: -webkit-linear-gradient(180deg,#751a19 0%,#ee3531 100%);background: linear-gradient(180deg,#751a19 0%,#ee3531 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;"><i class="fa fa-calendar"></i></div>
            <div class="ipsStreamItem_container">
                <div class="ipsStreamItem_header ipsSpacer_top ipsSpacer_half">
                    <span class="ipsType_reset" style="font-weight: 800;">za měsíc</span>
                </div>
                <span class="font-initial" style="font-weight: 200;color: white;">'.$mesicbanu[0].'</span>
            </div>
        </li>
    </ol>
</div>';
echo '<div class="ipsBox"><table style="width: 100%;"><tbody>
        <tr class="ipsButtonBar ipsPad_half ipsClearfix ipsClear" style="height: 35px;">
            <td>&nbsp;</td>
            <td style="width:80px;">Datum</td>
            <td>Hráč</td>
            <td>Admin</td>
            <td>Důvod</td>
            <td style="width:120px;">Délka</td>
        </tr>';
$num = 0;
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $num++;
        $script = "'layer_$num'";
        
        $steamid64 = $row["banned_sid64"];
        $adminid64 = $row["admin_sid64"];
        $name;
        $admin_name;
        if(!isset($adminid64) || empty($adminid64) || $adminid64 == '') {
            $admin_name = "Anti-Cheat";
        } else {
            $sql_admin = "SELECT `webid` FROM `banlist_csgo`.`admin_list` WHERE `steamid` = '$adminid64'";
            $result_admin = $connect->query($sql_admin);
            $value = $result_admin->fetch_object();
            $webid = intval($value->webid);
            $admin_name = '{expression="\IPS\Member::load( '.$webid.' )->link()" raw="true"}';
        }
        $lenght = 0;
        if($row["bancas"] == -1) {
            $lenght = "Trvale";
        } else {
            $lenght = $row["bancas"];
            $charl;
            if($lenght <= 3599) {
                $gmdata = $lenght / 60;
                if($gmdata == 1) $charl = minuta;
                else if($gmdata < 5) $charl = minuty;
                else $charl = minut;
                $lenght = "$gmdata $charl";
            } else if($lenght <= 86399) {
                $gmdata = ($lenght / 60) / 60;
                if($gmdata == 1) $charl = hodina;
                else if($gmdata < 5) $charl = hodiny;
                else $charl = hodin;
                $lenght = "$gmdata $charl";
            } else if($lenght >= 86400) {
                $gmdata = (($lenght / 60) / 60) / 24;
                if($gmdata == 1) $charl = den;
                else if($gmdata < 5) $charl = dny;
                else $charl = dní;
                $lenght = "$gmdata $charl";
            }
        }
        $banicon;
        if($row["server_id"] == -1) {
            $banicon = '<i class="fa fa-globe" style="width: 20px;"></i>';
            $steam = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=api_key&steamids=$steamid64", true);
            $steamarray = json_decode($steam, true);
            $name = $steamarray['response']['players'][0]['personaname'];
            $name = str_replace("<", "?", $name);
            $name = str_replace(">", "?", $name);
        } else {
            $server_port = $row["server_id"];
            $banicon = '<img src="https://content.invisioncic.com/o283304/pages_media/0_cs_go_logo_png_351619.png" style="width: 20px;">';
            $sql_name = "SELECT `lastnick` FROM `server_$server_port`.`players` WHERE `steamid` = '$steamid64'";
            $result_name = $connect->query($sql_name);
            $value = $result_name->fetch_object();
            $name = $value->lastnick;
        }
        $hystorybans;
        $sql_bans = "SELECT `pocetban` FROM `servers`.`players` WHERE `steamid` = '$steamid64'";
        $result_bans = $connect->query($sql_bans);
        $value = $result_bans->fetch_object();
        $hystorybans = $value->pocetban;
        $servername = "neznámo kde";
        if($row["server_id"] == 27408) $servername = "Fun Ultimate | FunMod";
        else if($row["server_id"] == 27612) $servername = "Fun Ultimate | FunMod | MONTHLY RESET";
        else if($row["server_id"] == 27563) $servername = "AWP Ultimate | Sniper War";
        else if($row["server_id"] == 27387) $servername = "AWP Ultimate | No Scope Only";
        else if($row["server_id"] == 27105) $servername = "AWP Server | Sniper War";
        else if($row["server_id"] == 27698) $servername = "ScoutzKnivez Ultimate | Flying Scoutsman";
        else if($row["server_id"] == 27522) $servername = "Deagle Ultimate | Deagle Madness";
        else if($row["server_id"] == 27770) $servername = "USP Ultimate | USP Infinity";
        else if($row["server_id"] == 27843) $servername = "AIM Ultimate | AK/M4 Shootout";
        else if($row["server_id"] == 27679) $servername = "JailBreak Ultimate | CZ/SK #1";
        else if($row["server_id"] == 27654) $servername = "JailBreak Ultimate | CZ/SK #2";
        else if($row["server_id"] == 27234) $servername = "AWP Server | Sniper Mayhem";
        else if($row["server_id"] == -1) $servername = "Web Ban";
        echo '<form name="details" metdod="POST"></form>
        <tr onclick="NewToggleLayer('.$script.')" class="ipsDataItem ipsDataItem_responsivePhoto" style="height: 31px;">  
            <td data-ipstruncate="" data-ipstruncate-size="1 lines" data-ipstruncate-type="remove" style="text-align: center;">'.$banicon.'</td>
            <td data-ipstruncate="" data-ipstruncate-size="1 lines" data-ipstruncate-type="remove">'.date("d.m.Y",$row["bantime"]).'</td>
            <td data-ipstruncate="" data-ipstruncate-size="1 lines" data-ipstruncate-type="remove"><i class="ipsFlag ipsFlag-'.strtolower($row["country"]).'"></i> '.$name.'</td>
            <td data-ipstruncate="" data-ipstruncate-size="1 lines" data-ipstruncate-type="remove">'.$admin_name.'</td>
            <td data-ipstruncate="" data-ipstruncate-size="1 lines" data-ipstruncate-type="remove">'.$row["raseon"].'</td>
            <td data-ipstruncate="" data-ipstruncate-size="1 lines" data-ipstruncate-type="remove">'.$lenght.'</td>
        </tr>  
        <tr id=',$script,' style="display:none;">
            <td colspan="9">
                <div style="display:none;" align="center">
                    <input type="hidden" name="bid" value="440">
                    <table class="details">
                        <tbody>
                            <tr class="info">
                                <td style="font-weight: bold;">Nickname</td>
                                <td>'.$name.'</td>
                            </tr>
                            <tr class="info">
                                <td style="font-weight: bold;">Steam ID</td>
                                <td>'.$row["banned_sid2"].'</td>
                            </tr>
                            <tr class="info">
                                <td style="font-weight: bold;">SteamCommunity ID</td>
                                <td>
                                    <a target="_blank" href="http://steamcommunity.com/profiles/'.$steamid64.'" tooltip="Zobrazit Steam profil">'.$steamid64.'</a>
                                </td>
                            </tr>
                            <tr class="info">
                                <td style="font-weight: bold;">Důvod</td>
                                <td>'.$row["raseon"].'</td>
                            </tr>
                            <tr class="info">
                                <td style="font-weight: bold;">Zabanován dne</td>
                                <td>'.date("d.m.Y-H:i:s",$row["bantime"]).'</td>
                            </tr>
                            <tr class="info">
                                <td style="font-weight: bold;">Zabanovaný adminem</td>
                                <td>'.$admin_name.'</td>
                            </tr>
                            <tr class="info">
                                <td style="font-weight: bold;">Zabanovaný na</td>
                                <td>'.$servername.'</td>
                            </tr>
                            <tr class="info" style="border: 0">
                                <td style="font-weight: bold;">Celkem obdržených banů</td>
                                <td>'.$hystorybans.'</td>
                            </tr>
                        </tbody>
                    </table>
                    <span class="ipsDataItem_generic"><a href="https://www.funplay.pro/forums/topic/5-unbanunmute/" class="ipsButton ipsButton_primary ipsButton_verySmall ipsPos_center">Požádat o UnBan</a></span>
                    <span class="ipsDataItem_generic"><a href="" class="ipsButton ipsButton_primary ipsButton_verySmall ipsPos_center">Vykoupit se</a></span>
                </div>
            </td>
        </tr>';
    }
}
    echo '</tbody>
</table>';
    echo '<div class="ipsButtonBar ipsPad_half ipsClearfix ipsClear">';
    echo '<div data-role="tablePagination">';
    echo '<ul class="ipsPagination" id="elPagination_878b1deee75de787a7bf387365458ac0_1649182512" data-ipspagination-seopagination="true" data-pages="'.$maxpage.'" data-ipspagination="" data-ipspagination-pages="'.$maxpage.'" data-ipspagination-perpage="50">';
        if($page == 1) {
            $prevpage = $page - 1;
            echo '<li class="ipsPagination_first ipsPagination_inactive" style="margin-right: 3px;"><a href="" rel="first" data-page="1" data-ipstooltip="" title="První stránka"><i class="fa fa-angle-double-left"></i></a></li>';
            echo '<li class="ipsPagination_prev ipsPagination_inactive" style="margin-right: 3px;"><a href="" rel="prev" data-page="'.$prevpage.'" data-ipstooltip="" title="Předchozí stránka">Předchozí</a></li>';
        }
        else {
            $prevpage = $page - 1;
            echo '<li class="ipsPagination_first" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/" rel="first" data-page="1" data-ipstooltip="" title="První stránka"><i class="fa fa-angle-double-left"></i></a></li>';
            echo '<li class="ipsPagination_prev" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$prevpage.'" rel="prev" data-page="'.$prevpage.'" data-ipstooltip="" title="Předchozí stránka">Předchozí</a></li>';
        }
        if($page - 3 >= 1) {
            $thispage = $page - 3;
            echo '<li class="ipsPagination_page" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$thispage.'" data-page="'.$thispage.'">'.$thispage.'</a></li>';
        }
        if($page - 2 >= 1) {
            $thispage = $page - 2;
            echo '<li class="ipsPagination_page" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$thispage.'" data-page="'.$thispage.'">'.$thispage.'</a></li>';
        }
        if($page - 1 >= 1) {
            $thispage = $page - 1;
            echo '<li class="ipsPagination_page" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$thispage.'" data-page="'.$thispage.'">'.$thispage.'</a></li>';
        }
        echo '<li class="ipsPagination_page ipsPagination_active" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$page.'" data-page="'.$page.'">'.$page.'</a></li>';
        if($page + 1 <= $maxpages) {
            $thispage = $page + 1;
            echo '<li class="ipsPagination_page" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$thispage.'" data-page="'.$thispage.'">'.$thispage.'</a></li>';
        }
        if($page + 2 <= $maxpages) {
            $thispage = $page + 2;
            echo '<li class="ipsPagination_page" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$thispage.'" data-page="'.$thispage.'">'.$thispage.'</a></li>';
        }
        if($page + 3 <= $maxpages) {
            $thispage = $page + 3;
            echo '<li class="ipsPagination_page" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$thispage.'" data-page="'.$thispage.'">'.$thispage.'</a></li>';
        }
        if($page == $maxpages) {
            $nextpage = $page + 1;
            echo '<li class="ipsPagination_next ipsPagination_inactive" style="margin-right: 3px;"><a href="" rel="next" data-page="'.$nextpage.'" data-ipstooltip="" _title="Další stránka">Další</a></li>';
            echo '<li class="ipsPagination_last ipsPagination_inactive" style="margin-right: 3px;"><a href="" rel="last" data-page="'.$maxpages.'" data-ipstooltip="" _title="Poslední stránka"><i class="fa fa-angle-double-right"></i></a></li>';
        }
        else {
            $nextpage = $page + 1;
            echo '<li class="ipsPagination_next" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$nextpage.'" rel="next" data-page="'.$nextpage.'" data-ipstooltip="" _title="Další stránka">Další</a></li>';
            echo '<li class="ipsPagination_last" style="margin-right: 3px;"><a href="https://www.funplay.pro/banlist/csgoctbans/?p='.$maxpages.'" rel="last" data-page="'.$maxpages.'" data-ipstooltip="" _title="Poslední stránka"><i class="fa fa-angle-double-right"></i></a></li>';
        }
        echo '<li class="ipsPagination_pageJump">
        <a href="#" data-ipsmenu="" data-ipsmenu-closeonclick="false" data-ipsmenu-appendto="#elPagination_878b1deee75de787a7bf387365458ac0_1649182512" id="elPagination_878b1deee75de787a7bf387365458ac0_1649182512_jump">Stránka 1 z '.$maxpages.' &nbsp;<i class="fa fa-caret-down"></i></a>
        </li>
        <div class="ipsMenu ipsMenu_narrow ipsPad ipsHide ipsMenu_topCenter" id="elPagination_878b1deee75de787a7bf387365458ac0_1649182512_jump_menu" style="left: 131.141px; top: 2235.33px; position: absolute; z-index: 5050; opacity: 1; display: none;" animating="false">
                    <form accept-charset="utf-8" method="get" action="https://www.funplay.pro/banlist/csgoctbans/" data-role="pageJump">
                        <ul class="ipsForm ipsForm_horizontal">
                            <li class="ipsFieldRow">
                                <input type="number" min="1" max="'.$maxpages.'" placeholder="Číslo stránky" class="ipsField_fullWidth" name="p">
                            </li>
                            <li class="ipsFieldRow ipsFieldRow_fullWidth">
                                <input type="submit" class="ipsButton_fullWidth ipsButton ipsButton_verySmall ipsButton_primary" value="Jdi">
                            </li>
                        </ul>
                    </form>
                </div>
            </ul>
        </div>
    </div></div>';
$connect->close();

 

Edited by Zdeněk Tůma
Link to comment
Share on other sites

So what is different about ctbans.php exactly? Is it still loading our framework?

Reason I ask is because there are several potential possibilities with this code (it's a significant amount of code to visually browse and try to just guess at issues), so identifying the differences between the two pages is step 1.

I notice for instance you're making an external HTTP request inside a loop which could surely be a cause:

$steam = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=api_key&steamids=$steamid64", true);

This code sample is also loading members inside a loop so that could potentially add overhead not present in a standalone file. But I don't exactly know what the differences are between the two files to know for sure.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...