Pokaż wyniki 1 do 4 z 4

Temat: problem z php

  1. #1
    Zarejestrowany
    Aug 2007
    Postów
    2

    Question problem z php

    witam mogl by mi ktos powiedziec gdzie tkwi problem

    zalozylem sobie prywatne ogame ale mam problem z wartoscia pkt sojuszy poniewaz ona sie zachowuje jak chce a chcem zeby wyliczala srednia czlonkow w pkt i rowniez laczna sume pkt oto kod


    <?php

    define('INSIDE', true);
    $ugamela_root_path = './';
    include($ugamela_root_path . 'extension.inc');
    include($ugamela_root_path . 'common.'.$phpEx);

    if(!check_user()){ header("Location: login.php"); die();}

    includeLang('stat');

    $dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];

    $parse = $lang;
    $who = (isset($_POST["who"]))?$_POST["who"]:$_GET["who"];
    $type = (isset($_POST["type"]))?$_POST["type"]:$_GET["type"];
    $start = (isset($_POST["start"]))?$_POST["start"]:$_GET["start"];
    //
    // Formulario donde se muestran los diferentes tipos de categoria
    // y los rangos
    //
    $parse['who'] = '<option value="player"'.
    (($who == "player") ? " SELECTED" : "").'>Gracz</option>
    <option value="ally"'.
    (($who == "ally") ? " SELECTED" : "").'>Sojusz</option>';


    $parse['type'] = '
    <option value="pts"'.
    (($type == "pts") ? " SELECTED" : "").'>Punkty</option>
    <option value="flt"'.
    (($type == "flt") ? " SELECTED" : "").'>Floty</option>
    <option value="res"'.
    (($type == "res") ? " SELECTED" : "").'>Badania</option>';

    $parse['start'] = '
    <option value="1"'.
    (($start == "1") ? " SELECTED" : "").'>1-100</option>
    <option value="101"'.
    (($start == "101") ? " SELECTED" : "").'>101-200</option>
    <option value="201"'.
    (($start == "201") ? " SELECTED" : "").'>201-300</option>
    <option value="301"'.
    (($start == "301") ? " SELECTED" : "").'>301-400</option>
    <option value="401"'.
    (($start == "401") ? " SELECTED" : "").'>401-500</option>
    <option value="501"'.
    (($start == "501") ? " SELECTED" : "").'>501-600</option>
    <option value="601"'.
    (($start == "601") ? " SELECTED" : "").'>601-700</option>
    <option value="701"'.
    (($start == "701") ? " SELECTED" : "").'>701-800</option>
    <option value="801"'.
    (($start == "801") ? " SELECTED" : "").'>801-900</option>
    <option value="901"'.
    (($start == "901") ? " SELECTED" : "").'>901-1000</option>
    <option value="1001"'.
    (($start == "1001") ? " SELECTED" : "").'>1001-1100</option>
    <option value="1101"'.
    (($start == "1101") ? " SELECTED" : "").'>1101-1200</option>
    <option value="1201"'.
    (($start == "1201") ? " SELECTED" : "").'>1201-1300</option>
    <option value="1301"'.
    (($start == "1301") ? " SELECTED" : "").'>1301-1400</option>
    <option value="1401"'.
    (($start == "1401") ? " SELECTED" : "").'>1401-1500</option>';

    //
    // Parece que fuera ayer, que solo el juego era una fachada.
    // Bueno, Here we go!
    //


    if($who == "ally"){

    $parse['body_table'] =
    parsetemplate(gettemplate('stat_alliancetable_head er'), $parse);
    //peque&#239;&#191;&#189; fix para prevenir desastres
    $start = (is_numeric($start)&&$start>1)?round($start):1;
    //peque&#195;&#177;a condicion
    $start = floor($start / 100 % 100)*100;
    //Realizamos la quiery en la table de jugadores
    $query = doquery('SELECT * FROM {{table}} ORDER BY ally_points DESC
    LIMIT '.($start).',100','alliance');
    $start++;
    $parse['body_values'] = '';//en caso de que no hubieran datos...
    $parse['data'] = $game_config['stats'];
    while ($row = mysql_fetch_assoc($query)){
    $parse['ally_rank'] = $start;

    $parse['ally_rankplus'] = '<font color="lime">?</font>';
    $parse['ally_name'] = '<a
    href="alliance.php?mode=ainfo&tag='.$row['ally_tag'].'">'.$row['ally_name'].'</a>';
    $parse['ally_mes'] = '';//'<a
    href="alliance.php?mode=apply&tag='.$row['ally_tag'].'">
    //<img src="http://ogame321.de/evolution/img/m.gif" border="0"
    alt="Escribir mensaje" /></a>';
    $parse['ally_members'] = $row['ally_members'];
    if($type == "res"){
    $ally_points = $row['ally_points_tech'];
    }elseif($type == "flt"){
    $ally_points = $row['ally_points_fleet'];
    }else{
    $ally_points = floor($row['ally_points']/1000);
    }

    $parse['ally_points'] = pretty_number($ally_points);
    $parse['ally_members_points'] =
    @floor($ally_points/$row['ally_members']);
    $parse['body_values'] .=
    parsetemplate(gettemplate('stat_alliancetable'), $parse);
    $start++;
    }


    }
    else{

    $parse['body_table'] =
    parsetemplate(gettemplate('stat_playertable_header '), $parse);

    //peque&#239;&#191;&#189; fix para prevenir desastres
    $start = (is_numeric($start)&&$start>1)?round($start):1;

    //peque&#195;&#177;a condicion
    $start = floor($start / 100 % 100)*100;
    //Realizamos la quiery en la table de jugadores
    if($type == "res"){
    $query = doquery('SELECT * FROM {{table}} ORDER BY points_tech DESC
    LIMIT '.$start.',100','users');
    }elseif($type == "flt"){
    $query = doquery('SELECT * FROM {{table}} ORDER BY points_fleet DESC
    LIMIT '.$start.',100','users');
    }else{
    $query = doquery('SELECT * FROM {{table}} ORDER BY points_points DESC
    LIMIT '.$start.',100','users');
    }


    $start++;
    $parse['data'] = $game_config['stats'];
    $parse['body_values'] = '';//en caso de que no hubieran datos...
    while ($row = mysql_fetch_assoc($query)){
    $playername_rank = $row['username'];
    $rank_old = $row['rank_old'];
    // $query_rank = doquery("UPDATE {{table}} SET `rank_old`='{$rank_old}'
    WHERE `username` = '{$playername_rank}'" ,"users");
    $parse['player_rank'] = $start;
    $rank_new = $start;
    $ranking = $rank_old - $rank_new;
    if ($ranking == "0")
    {
    $parse['player_rankplus'] = "<font color=\"#87CEEB\">0</font>";
    }
    if ($ranking < "0")
    {
    $parse['player_rankplus'] = "<font color=\"red\">$ranking</font>";
    }
    if ($ranking > "0")
    {
    $parse['player_rankplus'] = "<font color=\"green\">+$ranking</font>";
    }
    // $query_rank = doquery("UPDATE {{table}} SET `rank`='{$start}' WHERE
    `username` = '{$playername_rank}'" ,"users");
    //$parse['player_rankplus'] = '<font color="#87CEEB">?</font>';
    $parse['player_name'] = $row['username'];
    $parse['player_mes'] = '<a
    href="messages.php?mode=write&id='.$row['id'].'">
    <img src="'.$dpath.'img/m.gif" border="0" alt="Napisz
    Wiadomo&#182;&#230;" /></a>';
    $parse['player_alliance'] = $row['ally_name'];

    if($type == "res"){
    $parse['player_points'] = pretty_number($row['points_tech']);
    }elseif($type == "flt"){
    $parse['player_points'] = pretty_number($row['points_fleet']);
    }else{
    $parse['player_points'] = pretty_number($row['points_points']/1000);
    }


    $parse['body_values'] .=
    parsetemplate(gettemplate('stat_playertable'), $parse);
    $start++;
    }

    }

    $page = parsetemplate(gettemplate('stat_body'), $parse);


    z gory dziekuje za pomoc
    Ostatnio edytowane przez cTrl : 08-27-2007 - 21:54

  2. #2
    Zarejestrowany
    Jun 2006
    Skąd
    rand(.eu)
    Postów
    8,748

    Domyślnie

    Skontaktuj sie z autorem skryptu albo support'em Ogame - to ich robota dostarczyc dokumentacje...
    ctrl-alt-del.cc - soft reset site for IT admins and other staff :-)

  3. #3
    Zarejestrowany
    Aug 2007
    Postów
    2

    Domyślnie

    #PKT Sojusze

    $result_ally=mysql_query("SELECT * FROM `$tabela_ally` ",$link);
    while($row_ally = mysql_fetch_array($result_ally,MYSQL_BOTH)){
    $pkt_ally_fleet = $row_ally['ally_points_fleet2'];
    $pkt_ally_fleet_old = $row_ally['ally_points_fleet_old'];
    $pkt_ally_tech = $row_ally['ally_points_tech_old'];
    $pkt_ally_build = $row_ally['ally_points_builds_old'];
    $id_ally = $row_ally['id'];

    $pkt_ally_ogolnie = $pkt_ally_build + $pkt_ally_fleet_old + $pkt_ally_tech;

    mysql_query("UPDATE `$tabela_ally` SET `ally_points` = '$pkt_ally_ogolnie' WHERE `id` = '$id_ally'")
    or die(mysql_error());
    mysql_query("UPDATE `$tabela_ally` SET `ally_points_fleet` = '$pkt_ally_fleet' WHERE `id` = '$id_ally'")
    or die(mysql_error());
    mysql_query("UPDATE `$tabela_ally` SET `ally_points_tech` = '$pkt_ally_tech' WHERE `id` = '$id_ally'")
    or die(mysql_error());

    }
    to kod zliczajacy pkt widzi ktos gdzies blad ?

  4. #4
    Avatar eMCe
    eMCe jest offline Emil Grzegorz Gubała
    Zarejestrowany
    Dec 2006
    Skąd
    Kielce
    Postów
    1,767

    Domyślnie

    dostałeś odpowiedź!!
    Agencja reklamy kielce (mały kilkudniowy case pozycjonerski )

Podobne wątki

  1. postragesql +php
    By ble34 in forum Newbie - dla początkujących!
    Odpowiedzi: 3
    Autor: 07-08-2007, 17:33
  2. php hacking
    By Malcolm in forum Hacking
    Odpowiedzi: 2
    Autor: 06-04-2007, 20:56
  3. PhP
    By Michal_sh in forum Hacking
    Odpowiedzi: 8
    Autor: 04-12-2007, 14:38
  4. php
    By ble34 in forum PHP/CGI/ASP/JSP/J2EE
    Odpowiedzi: 8
    Autor: 03-08-2007, 22:36

Zasady Postowania

  • Nie możesz zakładać nowych tematów
  • Nie możesz pisać wiadomości
  • Nie możesz dodawać załączników
  • Nie możesz edytować swoich postów
  •  
Subskrybuj