• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

PHP Licytacja domków

Erazma

Banned User
Joined
Sep 3, 2012
Messages
265
Reaction score
4
Witam może ktoś ogarnia ten skrypt Licytacja domków ?? ;p mam problem wszystko dziala oprucz jednej rzeczy... wplacilem 5kk wiec kase mam niby sprawdzilem tabele ktore dodalem wszystkie mam w bazie ale gdy licytuje domek pisze ze mam za malo kasy ... ;/ gdzie jest blad?

Code:
 <?PHP
$server = parse_ini_file($config['site']['server_path'].'config.lua');
$id = (int) $_GET['id'];
$auc = $_GET['auc'];
$houses_list = new OTS_HousesList($config['site']['server_path'].'data\world\\'.$server['mapName'].'-house.xml');
if ((empty($id) || !$houses_list->hasHouseId($id)) && !isset($auc)){
    $house_query = $SQL->query('SELECT * FROM houses WHERE owner = 0 ORDER BY price DESC')->fetchAll();
    $counter = 0;
    foreach($house_query as $house){
        if(is_int($counter / 2))
            $bgcolor = $config['site']['darkborder'];
        else
            $bgcolor = $config['site']['lightborder'];
        $counter++;
        $house_town = !empty($towns_list[''.$house['world_id'].''][''.$house['town'].'']) ? $towns_list[''.$house['world_id'].''][''.$house['town'].''] : 'Unnamed';
        $house_name = !empty($house['name']) ? $house['name'] : 'No name House '.$counter;
        $houses .= '<tr bgcolor="'.$bgcolor.'"><td width="30"><center>'.$counter.'.</center></td><td width="125">'.$config['site']['worlds'][''.$house['world_id'].''].'</td><td width="100">'.$house_town.'</td><td width="170">'.    $house_name.'</td><td width="90">'.$house['size'].' sqm</td><td width="170">'.$house['price'].' gols coins</td><td width="100"><a href="'.$_SERVER['REQUEST_URI'].'&id='.$house['id'].'">More info</a></td></tr>';    
    }
$main_content .= '<table border=0 cellspacing=1 cellpadding=4 width=100%><tr bgcolor="'.$config['site']['vdarkborder'].'"><td class=white width="30"><b>Lp.</b></td><td class=white width="125"><b>World</b></td><td class=white width="100"><b>Town</b></td><td class=white width="170"><b>Name</b></td><td class=white width="90"><b>Size</b></td><td class=white width="170"><b>Price</b></td><td class=white width="100"><b>Info</b></td></tr></table><table border=0 cellspacing=1 cellpadding=4 width=100%>'.$houses.'</table>';
}
else{
    $last = $SQL->query('SELECT player_id, bid FROM house_auctions WHERE house_id = '.$id.' ORDER by time DESC')->fetch();
    if ($last)
    $moneys = $SQL->query('SELECT moneys FROM players WHERE id = '.$last['player_id'].'')->fetch();
    if ($logged){
        $account_players = $account_logged->getPlayers();
        foreach($houses_list as $housel){
            if (isset($id) && $id == $housel->getId()){
                if ($housel->getOwner() == NULL){
                    $pos = array('x' => $housel->getEntry()->x, 'y' => $housel->getEntry()->y, 'z' => $housel->getEntry()->z);
                }
            }
        }    
        $main_content .= '<table border=0 cellspacing=1 cellpadding=4 width=100%><tr bgcolor="'.$config['site']['vdarkborder'].'"><td class=white><b>More information about house</b></td></tr></table>';
        $house = $SQL->query('SELECT * FROM houses WHERE id = '.$id.'')->fetch();
        if ($house['owner'] == 0){
            $auction = $SQL->query('SELECT * FROM house_auctions WHERE house_id = '.$id.' AND world_id = '.$house['world_id'].'')->fetch();
            if ($auction){
                $player_name = $SQL->query('SELECT name FROM players WHERE id = '.$auction['player_id'])->fetch();
                $player_name = !empty($player_name['name']) ? ', a zaoferowal ja <a href="?subtopic=characters&name='.urlencode($player_name['name']).'">'.$player_name['name'].'</a>' : '';
            }
            $house_town = !empty($towns_list[''.$house['world_id'].''][''.$house['town'].'']) ? $towns_list[''.$house['world_id'].''][''.$house['town'].''] : 'Unnamed';
            $house_name = !empty($house['name']) ? $house['name'] : 'No name House';
            $house_bid = !empty($auction['bid']) ? $auction['bid'] : $house['price'];
            $house_owner = $house['owner'];
            $house_time = $house['time'] == 0 ? '<br/>Licytacja nie rozpoczela sie.' : '<br/>Aukcja konczy sie '.date('Y-m-d H:m', $house['time']).'';
            if ($house['time'] > time() || $house['time'] == 0){
                $main_content .= '<table border=0 cellspacing=1 cellpadding=4 width=100%><tr><td width="20%"><img src="housemapgenerate.php?x='.$pos['x'].'&y='.$pos['y'].'&z='.$pos['z'].'"</td><td valign="top"><b>'.$house_name.'</b><br/><br/>Ten dom ma <b>'.$house['size'].'</b> metrow kwadratowych. Aktualna cena wynosi <b>'.$house_bid.'</b> gold coins'.$player_name.'. Mieszkanie znajduje sie na swiecie <b>'.$config['site']['worlds'][''.$house['world_id'].''].'</b>, w miescie zwanym <b>'.$house_town.'</b>.<br/> Chcesz go miec? <a href="'.$_SERVER['REQUEST_URI'].'&auc=true">Kup go!</a>'.$house_time.' </td></tr></table>';
            }
                else{
                    if ($house['owner'] == 0){
                        foreach($account_players as $acc_player){
                            if($acc_player->getId() == $last['player_id']){
                                $last_player = $last['player_id'];
                            }
                        }
                        if (!empty($last_player)){
                            $main_content .= '<fieldset><b>Czy jestes pewien, ze chcesz zamieszkac w tym domu? Jesli tak, kliknij <a href="'.$_SERVER['REQUEST_URI'].'&get=true">tutaj</a></b></fieldset>';
                            if ($_GET['get'] == 'true'){                                
                                if ($moneys['moneys'] >= $last['bid']){
                                    $SQL->query('UPDATE houses SET owner = '.$last_player.', time = 0 WHERE id = '.$id.'');
                                    $main_content .= 'Od teraz domek '.$house_name.' znajdujacy sie w '.$house_town.' jest Twoj!.';
                                }
                                else{
                                    $main_content .= 'Nie masz wystarczajacej ilosci pieniedzy na koncie. Wplac minimum '.$last['bid'].' uzywajac komendy <b>!house "deposit, '.$last['bid'].'</b>.';
                                }
                            }
                        }
                        $main_content .= '<fieldset><font color="red"><b>Ta aukcja jest juz zakonczona.</b></font></fieldset>';
                    }
                } 
        }
        if ($auc == 'true'){
                if ($account_players>0){
                        if ($account_logged->isPremium()){
                            $main_content .= 'Aby zalicytowac, musisz zwiekszyc stawke o conajmniej <b>'.$config['site']['minBid'].'</b> gold coins. Sume, ktora chcesz postawic na ten dom musisz zdepozytowac specjalna komenda <b><i>!house "deposit</i></b>. Jezeli jednak przegrasz licytacje mozesz wyplacic swoje pieniadze uzywajac komendy <b><i>!house "withdraw</i></b>.<br/><br/><fieldset title="Licytacja"><legend>Licytacja</legend><table align="center" border=0>';
                            foreach($account_players as $acc_player){
                                if ($acc_player->getLevel() >= $config['site']['levelToHouse'])
                                    $options .= '<option name="'.$acc_player.'">'.$acc_player.'</option>';
                            }
                                if (empty($options))
                                    $main_content .= 'Wymagany poziom do kupienie mieszkania to <b>'.$config['site']['levelToHouse'].'</b>.';    
                                else
                            $main_content .= '<form action="" method="post"><tr><td>Stawka</td><td><input type="text" name="bid"><select name="player">'.$options.'</select></td><tr><td><input type="submit" value="Licytuj" name="sub"></form>';
                            $main_content .= '</table></fieldset>';
                            if (isset($_POST['sub']) && $house_owner == 0){
                                $bid = $_POST['bid'];
                                if ($house_bid + $config['site']['minBid'] < $bid){
                                    $player = $SQL->query('SELECT id, level FROM players WHERE name = "'.$_POST['player'].'"')->fetch();
                                     if ($config['site']['levelToHouse'] < $player['level']){
                                        if ($moneys['moneys'] > $last['bid']){
                                            $SQL->query('INSERT INTO house_auctions(house_id, world_id, player_id, bid, time) VALUES('.$id.', '.$house['world_id'].', '.$player['id'].', '.$bid.', UNIX_TIMESTAMP())');
                                            if ($SQL->query('SELECT id FROM houses WHERE id = '.$id.' and time < 1')){
                                                $time = time() + $config['site']['daysPerAuction']*24*60*60;
                                                $SQL->query('UPDATE houses SET time = '.$time.' WHERE id = '.$id.'');
                                            }
                                            $main_content .= '<font color="green">Zalicytowales domek!';
                                        }
                                        else{
                                            $main_content .= 'Nie masz wystarczajacej ilosci pieniedzy na koncie. Wplac minimum '.$last['bid'].' uzywajac komendy <b>!house "deposit, '.$last['bid'].'</b>.';
                                        }
                                    }
                                    else{
                                        $main_content .= '<font color="red">Twoj poziom jest zbyt maly. Aby licytowac mieszkanie musisz miec minimalnie '.$config['site']['levelToHouse'].' poziom.';
                                    }
                                }
                                else{
                                    $main_content .= '<font color="red">Postawiles za malo! Stawka musi byc wieksza od poprzedniej i powiekszona conajmniej o <b>'.$config['site']['minBid'].'</b>.</font>';
                                }
                            }                    
                        }
                        else{
                            Header('Location: ?subtopic=shopsystem');
                        }
                }
                else{
                    Header('Location: ?subtopic=accountmanagement');
                }
        }
    }
    else{
        Header('Location: ?subtopic=accountmanagement');
    }
}
?>
Jeśli ktoś mi pomoże będzie działać dam doładowanko do wybranej sieci ;p....
 
Back
Top