• 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!

AAC [Znote] adding house rent due date information.

ots49

Member
Joined
Jun 7, 2022
Messages
61
Reaction score
17
Hello people!

Is there a way to add information on when the next rent is due on znote AAC?

I'm assuming it's something you need to add to house.php?

For example in real tibia: The house has been rented byPLAYERNAME . He has paid the rent until Jun 30 2022, 11:08:41 CEST.

Is this possible? :)

House.php:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(3);
}

$house = (isset($_GET['id']) && (int)$_GET['id'] > 0) ? (int)$_GET['id'] : false;

if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
    $house_SQL = "SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='$house';";
    $house = mysql_select_single($house_SQL);
    $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
    if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);

    if ($config['houseConfig']['shopPoints']['enabled']) {
        $house['points'] = $house['size'];

        foreach ($config['houseConfig']['shopPoints']['cost'] AS $cost_sqm => $cost_points) {
            if ($cost_sqm < $house['size']) $house['points'] = $cost_points;
        }
    }

    //data_dump($house, false, "House data");

    //////////////////////
    // Bid on house logic
    $bid_char = &$_POST['char'];
    $bid_amount = &$_POST['amount'];
    if ($bid_amount && $bid_char) {
        $bid_char = (int)$bid_char;
        $bid_amount = (int)$bid_amount;
        $player = mysql_select_single("SELECT `id`, `account_id`, `name`, `level`, `balance` FROM `players` WHERE `id`='$bid_char' LIMIT 1;");

        if (user_logged_in() === true && $player['account_id'] == $session_user_id) {
            // Does player have or need premium?
            $premstatus = ($config['houseConfig']['requirePremium'] && $user_data['premdays']  == 0) ? false : true;
            if ($premstatus) {
                // Can player have or bid on more houses?
                $pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");
                if ($pHouseCount['value'] < $config['houseConfig']['housesPerPlayer']) {
                    // Is character level high enough?
                    if ($player['level'] >= $config['houseConfig']['levelToBuyHouse']) {
                        // Can player afford this bid?
                        if ($player['balance'] > $bid_amount) {
                            // Is bid higher than previous bid?
                            if ($bid_amount > $house['bid']) {
                                // Is bid higher than lowest bid?
                                if ($bid_amount > $minbid) {
                                    // Should only apply to external players, allowing a player to up his pledge without
                                    // being forced to pay his full previous bid.
                                    if ($house['highest_bidder'] != $player['id']) $lastbid = $house['bid'] + 1;
                                    else {
                                        $lastbid = $house['last_bid'];
                                        echo "<b><font color='green'>You have raised the house pledge to ".$bid_amount."gp!</font></b><br>";
                                    }
                                    // Has bid already started?
                                    if ($house['bid_end'] > 0) {
                                        if ($house['bid_end'] > time()) {
                                            mysql_update("UPDATE `houses` SET `highest_bidder`='". $player['id'] ."', `bid`='$bid_amount', `last_bid`='$lastbid' WHERE `id`='". $house['id'] ."' LIMIT 1;");
                                            $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
                                        }
                                    } else {
                                        $lastbid = $minbid + 1;
                                        $bidend = time() + $config['houseConfig']['auctionPeriod'];
                                        mysql_update("UPDATE `houses` SET `highest_bidder`='". $player['id'] ."', `bid`='$bid_amount', `last_bid`='$lastbid', `bid_end`='$bidend' WHERE `id`='". $house['id'] ."' LIMIT 1;");
                                        $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
                                    }
                                    echo "<b><font color='green'>You have the highest bid on this house!</font></b>";
                                } else echo "<b><font color='red'>You need to place a bid that is higher or equal to {$minbid}gp.</font></b>";
                            } else {
                                // Check if current bid is higher than last_bid
                                if ($bid_amount > $house['last_bid']) {
                                    // Should only apply to external players, allowing a player to up his pledge without
                                    // being forced to pay his full previous bid.
                                    if ($house['highest_bidder'] != $player['id']) {
                                        $lastbid = $bid_amount + 1;
                                        mysql_update("UPDATE `houses` SET `last_bid`='$lastbid' WHERE `id`='". $house['id'] ."' LIMIT 1;");
                                        $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
                                        echo "<b><font color='orange'>Unfortunately your bid was not higher than previous bidder.</font></b>";
                                    } else {
                                        echo "<b><font color='orange'>You already have a higher pledge on this house.</font></b>";
                                    }
                                } else {
                                    echo "<b><font color='red'>Too low bid amount, someone else has a higher bid active.</font></b>";
                                }
                            }
                        } else echo "<b><font color='red'>You don't have enough money to bid this high.</font></b>";
                    } else echo "<b><font color='red'>Your character is to low level, must be higher level than ", $config['houseConfig']['levelToBuyHouse']-1 ," to buy a house.</font></b>";
                } else echo "<b><font color='red'>You cannot have more houses.</font></b>";
            } else echo "<b><font color='red'>You need premium account to purchase houses.</font></b>";
        } else echo "<b><font color='red'>You may only bid on houses for characters on your account.</font></b>";
    }

    ////////////////////////////////////////
    // Instantly buy house with shop points
    if ($config['houseConfig']['shopPoints']['enabled']
        && isset($_POST['instantbuy'])
        && $bid_char
        && $house['owner'] == 0
        && isset($house['points'])) {

        $account_points = (int)$user_znote_data['points'];

        if ($account_points >= $house['points']) {

            $bid_char = (int)$bid_char;
            $player = mysql_select_single("SELECT `id`, `account_id`, `name`, `level` FROM `players` WHERE `id`='$bid_char' LIMIT 1;");
            $pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");

            if (user_logged_in() === true
                && $player['account_id'] == $session_user_id
                && $player['level'] >= $config['houseConfig']['levelToBuyHouse']
                && $pHouseCount['value'] < $config['houseConfig']['housesPerPlayer']) {

                $house_points = (int)$house['points'];
                $house_id = $house['id'];

                // Remove points from account
                mysql_update("
                    UPDATE `znote_accounts`
                    SET `points` = `points`-{$house_points}
                    WHERE `account_id`={$session_user_id}
                    LIMIT 1;
                ");

                // Give new ownership to house
                mysql_update("
                    UPDATE `houses`
                    SET `owner` = {$bid_char}
                    WHERE `id` = {$house_id}
                    LIMIT 1;
                ");

                // Log purchase in znote_shop_logs and znote_shop_orders
                $time = time();
                mysql_insert("
                    INSERT INTO `znote_shop_logs`
                    (`account_id`, `player_id`, `type`, `itemid`, `count`, `points`, `time`) VALUES
                    ({$session_user_id}, {$bid_char}, 7, {$house_id}, 1, {$house_points}, {$time})
                ");
                mysql_insert("
                    INSERT INTO `znote_shop_orders`
                    (`account_id`, `type`, `itemid`, `count`, `time`) VALUES
                    ({$session_user_id}, 7, {$house_id}, {$bid_char}, {$time})
                ");

                // Reload house data
                $house = mysql_select_single($house_SQL);
                $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
                if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);

                // Congratulate user and tell them they still has to pay rent (if rent > 0)
                ?>
                <p><strong>Congratulations!</strong>
                    <br>You now own this house!
                    <br>Remember to say <strong>!shop</strong> in-game to process your ownership!
                    <?php if ($house['rent'] > 0): ?>
                        <br>Keep in mind you still need to pay rent on this house, make sure you have enough bank balance to cover it!
                    <?php endif; ?>
                </p>
                <?php
            } else {
                ?>
                <p><strong>Error:</strong>
                    <br>Either your level is too low, or your player already have or is bidding on another house.
                    <br>Your level: <?php echo $player['level']; ?>. Minimum level to buy house: <?php echo $config['houseConfig']['levelToBuyHouse']; ?>
                    <br>Your house/bid count: <?php echo $pHouseCount['value']; ?>. Maximum house per player: <?php echo $config['houseConfig']['housesPerPlayer']; ?>.
                </p>
                <?php
            }
        }
    }

    // HTML structure and logic
    ?>
    <h1>House: <?php echo $house['name']; ?></h1>
    <ul>
        <li><b>Town</b>:
        <?php
        $town_name = &$config['towns'][$house['town_id']];
        echo "<a href='houses.php?id=". $house['town_id'] ."'>". ($town_name ? $town_name : 'Specify town id ' . $house['town_id'] . ' name in config.php first.') ."</a>";
        ?></li>
        <li><b>Size</b>: <?php echo $house['size']; ?></li>
        <li><b>Beds</b>: <?php echo $house['beds']; ?></li>
        <li><b>Owner</b>: <?php
        if ($house['owner'] > 0) echo "<a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a>";
        else echo "Available for auction.";
        ?></li>
        <li><b>Rent</b>: <?php echo $house['rent']; ?></li>
        <?php if ($house['owner'] == 0 && isset($house['points'])): ?>
            <li><b>Shop points</b>: <?php echo $house['points']; ?></li>
        <?php endif; ?>
    </ul>
    <?php
    // AUCTION MARKUP INIT
    if ($house['owner'] == 0) {
        ?>
        <h2>This house is up on auction!</h2>
        <?php
        if ($house['highest_bidder'] == 0) echo "<b>This house don't have any bidders yet.</b>";
        else {
            $bidder = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='". $house['highest_bidder'] ."' LIMIT 1;");
            echo "<b>This house have bidders! If you want this house, now is your chance!</b>";
            echo "<br><b>Active bid:</b> ". $house['last_bid'] ."gp";
            echo "<br><b>Active bid by:</b> <a href='characterprofile.php?name=". $bidder['name'] ."' target='_BLANK'>". $bidder['name'] ."</a>";
            echo "<br><b>Bid will end on:</b> ". getClock($house['bid_end'], true);
        }

        if ($house['bid_end'] == 0 || $house['bid_end'] > time()) {
            if (user_logged_in()) {
                // Your characters, indexed by char_id
                $yourChars = mysql_select_multi("SELECT `id`, `name`, `balance` FROM `players` WHERE `account_id`='". $user_data['id'] ."';");
                if ($yourChars !== false) {
                    $charData = array();
                    foreach ($yourChars as $char) {
                        $charData[$char['id']] = $char;
                    }
                    ?>
                    <form class="house_form_bid" action="" method="post">
                        <select name="char">
                            <?php
                            foreach ($charData as $id => $char) {
                                echo "<option value='$id'>". $char['name'] ." [". $char['balance'] ."]</option>";
                            }
                            ?>
                        </select>
                        <input type="text" name="amount" placeholder="Min bid: <?php echo $minbid + 1; ?>">
                        <input type="submit" value="Bid on this house">
                    </form>
                    <?php if ($house['owner'] == 0 && isset($house['points'])): ?>
                        <br>
                        <?php if ((int)$user_znote_data['points'] >= $house['points']): ?>
                            <form class="house_form_buy" action="" method="post">
                                <p>Your account has <strong><?php echo $user_znote_data['points']; ?></strong> available shop points.</p>
                                <select name="char">
                                    <?php
                                    foreach ($charData as $id => $char) {
                                        echo "<option value='$id'>". $char['name'] ."</option>";
                                    }
                                    ?>
                                </select>
                                <input type="submit" name="instantbuy" value="Buy now for <?php echo $house['points']; ?> shop points!">
                            </form>
                        <?php else: ?>
                            <p>Your account has <strong><?php echo $user_znote_data['points']; ?></strong> available shop points.
                                <br>You don't have enough shop points to instantly buy this house.</p>
                        <?php endif; ?>
                    <?php endif; ?>
                    <?php
                } else echo "<br>You need a character to bid on this house.";
            } else echo "<br>You need to login before you can bid on houses.";
        } else echo "<br><b>Bid has ended! House transaction will proceed next server restart assuming active bidder have sufficient balance.</b>";
    }
} else {
    ?>
    <h1>No house selected.</h1>
    <p>Go back to the <a href="houses.php">house list</a> and select a house for further details.</p>
    <?php
}
include 'layout/overall/footer.php'; ?>

Thanks in advance!
 
Solution
Hello people!

Is there a way to add information on when the next rent is due on znote AAC?

I'm assuming it's something you need to add to house.php?

For example in real tibia: The house has been rented byPLAYERNAME . He has paid the rent until Jun 30 2022, 11:08:41 CEST.

Is this possible? :)

House.php:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(3);
}

$house = (isset($_GET['id']) && (int)$_GET['id'] > 0) ? (int)$_GET['id'] : false;

if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
    $house_SQL = "SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`...
Hello people!

Is there a way to add information on when the next rent is due on znote AAC?

I'm assuming it's something you need to add to house.php?

For example in real tibia: The house has been rented byPLAYERNAME . He has paid the rent until Jun 30 2022, 11:08:41 CEST.

Is this possible? :)

House.php:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(3);
}

$house = (isset($_GET['id']) && (int)$_GET['id'] > 0) ? (int)$_GET['id'] : false;

if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
    $house_SQL = "SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='$house';";
    $house = mysql_select_single($house_SQL);
    $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
    if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);

    if ($config['houseConfig']['shopPoints']['enabled']) {
        $house['points'] = $house['size'];

        foreach ($config['houseConfig']['shopPoints']['cost'] AS $cost_sqm => $cost_points) {
            if ($cost_sqm < $house['size']) $house['points'] = $cost_points;
        }
    }

    //data_dump($house, false, "House data");

    //////////////////////
    // Bid on house logic
    $bid_char = &$_POST['char'];
    $bid_amount = &$_POST['amount'];
    if ($bid_amount && $bid_char) {
        $bid_char = (int)$bid_char;
        $bid_amount = (int)$bid_amount;
        $player = mysql_select_single("SELECT `id`, `account_id`, `name`, `level`, `balance` FROM `players` WHERE `id`='$bid_char' LIMIT 1;");

        if (user_logged_in() === true && $player['account_id'] == $session_user_id) {
            // Does player have or need premium?
            $premstatus = ($config['houseConfig']['requirePremium'] && $user_data['premdays']  == 0) ? false : true;
            if ($premstatus) {
                // Can player have or bid on more houses?
                $pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");
                if ($pHouseCount['value'] < $config['houseConfig']['housesPerPlayer']) {
                    // Is character level high enough?
                    if ($player['level'] >= $config['houseConfig']['levelToBuyHouse']) {
                        // Can player afford this bid?
                        if ($player['balance'] > $bid_amount) {
                            // Is bid higher than previous bid?
                            if ($bid_amount > $house['bid']) {
                                // Is bid higher than lowest bid?
                                if ($bid_amount > $minbid) {
                                    // Should only apply to external players, allowing a player to up his pledge without
                                    // being forced to pay his full previous bid.
                                    if ($house['highest_bidder'] != $player['id']) $lastbid = $house['bid'] + 1;
                                    else {
                                        $lastbid = $house['last_bid'];
                                        echo "<b><font color='green'>You have raised the house pledge to ".$bid_amount."gp!</font></b><br>";
                                    }
                                    // Has bid already started?
                                    if ($house['bid_end'] > 0) {
                                        if ($house['bid_end'] > time()) {
                                            mysql_update("UPDATE `houses` SET `highest_bidder`='". $player['id'] ."', `bid`='$bid_amount', `last_bid`='$lastbid' WHERE `id`='". $house['id'] ."' LIMIT 1;");
                                            $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
                                        }
                                    } else {
                                        $lastbid = $minbid + 1;
                                        $bidend = time() + $config['houseConfig']['auctionPeriod'];
                                        mysql_update("UPDATE `houses` SET `highest_bidder`='". $player['id'] ."', `bid`='$bid_amount', `last_bid`='$lastbid', `bid_end`='$bidend' WHERE `id`='". $house['id'] ."' LIMIT 1;");
                                        $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
                                    }
                                    echo "<b><font color='green'>You have the highest bid on this house!</font></b>";
                                } else echo "<b><font color='red'>You need to place a bid that is higher or equal to {$minbid}gp.</font></b>";
                            } else {
                                // Check if current bid is higher than last_bid
                                if ($bid_amount > $house['last_bid']) {
                                    // Should only apply to external players, allowing a player to up his pledge without
                                    // being forced to pay his full previous bid.
                                    if ($house['highest_bidder'] != $player['id']) {
                                        $lastbid = $bid_amount + 1;
                                        mysql_update("UPDATE `houses` SET `last_bid`='$lastbid' WHERE `id`='". $house['id'] ."' LIMIT 1;");
                                        $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='". $house['id'] ."';");
                                        echo "<b><font color='orange'>Unfortunately your bid was not higher than previous bidder.</font></b>";
                                    } else {
                                        echo "<b><font color='orange'>You already have a higher pledge on this house.</font></b>";
                                    }
                                } else {
                                    echo "<b><font color='red'>Too low bid amount, someone else has a higher bid active.</font></b>";
                                }
                            }
                        } else echo "<b><font color='red'>You don't have enough money to bid this high.</font></b>";
                    } else echo "<b><font color='red'>Your character is to low level, must be higher level than ", $config['houseConfig']['levelToBuyHouse']-1 ," to buy a house.</font></b>";
                } else echo "<b><font color='red'>You cannot have more houses.</font></b>";
            } else echo "<b><font color='red'>You need premium account to purchase houses.</font></b>";
        } else echo "<b><font color='red'>You may only bid on houses for characters on your account.</font></b>";
    }

    ////////////////////////////////////////
    // Instantly buy house with shop points
    if ($config['houseConfig']['shopPoints']['enabled']
        && isset($_POST['instantbuy'])
        && $bid_char
        && $house['owner'] == 0
        && isset($house['points'])) {

        $account_points = (int)$user_znote_data['points'];

        if ($account_points >= $house['points']) {

            $bid_char = (int)$bid_char;
            $player = mysql_select_single("SELECT `id`, `account_id`, `name`, `level` FROM `players` WHERE `id`='$bid_char' LIMIT 1;");
            $pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");

            if (user_logged_in() === true
                && $player['account_id'] == $session_user_id
                && $player['level'] >= $config['houseConfig']['levelToBuyHouse']
                && $pHouseCount['value'] < $config['houseConfig']['housesPerPlayer']) {

                $house_points = (int)$house['points'];
                $house_id = $house['id'];

                // Remove points from account
                mysql_update("
                    UPDATE `znote_accounts`
                    SET `points` = `points`-{$house_points}
                    WHERE `account_id`={$session_user_id}
                    LIMIT 1;
                ");

                // Give new ownership to house
                mysql_update("
                    UPDATE `houses`
                    SET `owner` = {$bid_char}
                    WHERE `id` = {$house_id}
                    LIMIT 1;
                ");

                // Log purchase in znote_shop_logs and znote_shop_orders
                $time = time();
                mysql_insert("
                    INSERT INTO `znote_shop_logs`
                    (`account_id`, `player_id`, `type`, `itemid`, `count`, `points`, `time`) VALUES
                    ({$session_user_id}, {$bid_char}, 7, {$house_id}, 1, {$house_points}, {$time})
                ");
                mysql_insert("
                    INSERT INTO `znote_shop_orders`
                    (`account_id`, `type`, `itemid`, `count`, `time`) VALUES
                    ({$session_user_id}, 7, {$house_id}, {$bid_char}, {$time})
                ");

                // Reload house data
                $house = mysql_select_single($house_SQL);
                $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
                if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);

                // Congratulate user and tell them they still has to pay rent (if rent > 0)
                ?>
                <p><strong>Congratulations!</strong>
                    <br>You now own this house!
                    <br>Remember to say <strong>!shop</strong> in-game to process your ownership!
                    <?php if ($house['rent'] > 0): ?>
                        <br>Keep in mind you still need to pay rent on this house, make sure you have enough bank balance to cover it!
                    <?php endif; ?>
                </p>
                <?php
            } else {
                ?>
                <p><strong>Error:</strong>
                    <br>Either your level is too low, or your player already have or is bidding on another house.
                    <br>Your level: <?php echo $player['level']; ?>. Minimum level to buy house: <?php echo $config['houseConfig']['levelToBuyHouse']; ?>
                    <br>Your house/bid count: <?php echo $pHouseCount['value']; ?>. Maximum house per player: <?php echo $config['houseConfig']['housesPerPlayer']; ?>.
                </p>
                <?php
            }
        }
    }

    // HTML structure and logic
    ?>
    <h1>House: <?php echo $house['name']; ?></h1>
    <ul>
        <li><b>Town</b>:
        <?php
        $town_name = &$config['towns'][$house['town_id']];
        echo "<a href='houses.php?id=". $house['town_id'] ."'>". ($town_name ? $town_name : 'Specify town id ' . $house['town_id'] . ' name in config.php first.') ."</a>";
        ?></li>
        <li><b>Size</b>: <?php echo $house['size']; ?></li>
        <li><b>Beds</b>: <?php echo $house['beds']; ?></li>
        <li><b>Owner</b>: <?php
        if ($house['owner'] > 0) echo "<a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a>";
        else echo "Available for auction.";
        ?></li>
        <li><b>Rent</b>: <?php echo $house['rent']; ?></li>
        <?php if ($house['owner'] == 0 && isset($house['points'])): ?>
            <li><b>Shop points</b>: <?php echo $house['points']; ?></li>
        <?php endif; ?>
    </ul>
    <?php
    // AUCTION MARKUP INIT
    if ($house['owner'] == 0) {
        ?>
        <h2>This house is up on auction!</h2>
        <?php
        if ($house['highest_bidder'] == 0) echo "<b>This house don't have any bidders yet.</b>";
        else {
            $bidder = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='". $house['highest_bidder'] ."' LIMIT 1;");
            echo "<b>This house have bidders! If you want this house, now is your chance!</b>";
            echo "<br><b>Active bid:</b> ". $house['last_bid'] ."gp";
            echo "<br><b>Active bid by:</b> <a href='characterprofile.php?name=". $bidder['name'] ."' target='_BLANK'>". $bidder['name'] ."</a>";
            echo "<br><b>Bid will end on:</b> ". getClock($house['bid_end'], true);
        }

        if ($house['bid_end'] == 0 || $house['bid_end'] > time()) {
            if (user_logged_in()) {
                // Your characters, indexed by char_id
                $yourChars = mysql_select_multi("SELECT `id`, `name`, `balance` FROM `players` WHERE `account_id`='". $user_data['id'] ."';");
                if ($yourChars !== false) {
                    $charData = array();
                    foreach ($yourChars as $char) {
                        $charData[$char['id']] = $char;
                    }
                    ?>
                    <form class="house_form_bid" action="" method="post">
                        <select name="char">
                            <?php
                            foreach ($charData as $id => $char) {
                                echo "<option value='$id'>". $char['name'] ." [". $char['balance'] ."]</option>";
                            }
                            ?>
                        </select>
                        <input type="text" name="amount" placeholder="Min bid: <?php echo $minbid + 1; ?>">
                        <input type="submit" value="Bid on this house">
                    </form>
                    <?php if ($house['owner'] == 0 && isset($house['points'])): ?>
                        <br>
                        <?php if ((int)$user_znote_data['points'] >= $house['points']): ?>
                            <form class="house_form_buy" action="" method="post">
                                <p>Your account has <strong><?php echo $user_znote_data['points']; ?></strong> available shop points.</p>
                                <select name="char">
                                    <?php
                                    foreach ($charData as $id => $char) {
                                        echo "<option value='$id'>". $char['name'] ."</option>";
                                    }
                                    ?>
                                </select>
                                <input type="submit" name="instantbuy" value="Buy now for <?php echo $house['points']; ?> shop points!">
                            </form>
                        <?php else: ?>
                            <p>Your account has <strong><?php echo $user_znote_data['points']; ?></strong> available shop points.
                                <br>You don't have enough shop points to instantly buy this house.</p>
                        <?php endif; ?>
                    <?php endif; ?>
                    <?php
                } else echo "<br>You need a character to bid on this house.";
            } else echo "<br>You need to login before you can bid on houses.";
        } else echo "<br><b>Bid has ended! House transaction will proceed next server restart assuming active bidder have sufficient balance.</b>";
    }
} else {
    ?>
    <h1>No house selected.</h1>
    <p>Go back to the <a href="houses.php">house list</a> and select a house for further details.</p>
    <?php
}
include 'layout/overall/footer.php'; ?>

Thanks in advance!
Yes, is, I know how to do, but not sure if is the correct way, when I get in my PC, I'll help you.

Take a look in Nerana (http://n-s1.servegame.com)
Search for GM Nerana
Post automatically merged:

Hello people!

Is there a way to add information on when the next rent is due on znote AAC?

I'm assuming it's something you need to add to house.php?

For example in real tibia: The house has been rented byPLAYERNAME . He has paid the rent until Jun 30 2022, 11:08:41 CEST.

Is this possible? :)

Thanks in advance!

just search for:
PHP:
        <li><b>Owner</b>: <?php
        if ($house['owner'] > 0) echo "<a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a>";
else echo "Available for auction.";
?></li>

and replace for:
PHP:
    <li><b>Owner</b>: <?php //owner? ate quando o rent foi pago?
        if ($house['owner'] > 0) {
            $ownersex = mysql_select_single("SELECT `sex` FROM `players` WHERE `id` = '{$house['owner']}' LIMIT 1;");
            $paid = date('d M Y, H:i:s', $house['paid']);
            echo "The house has been rented by <b><a href='characterprofile.php?name={$house['ownername']}' target='_BLANK'>{$house['ownername']}</b></a>.";
            if ($ownersex['sex'] > 0) {
                echo " He has paid the rent until {$paid}.";
            } else {
                echo " She has paid the rent until {$paid}.";
            }
        } elseif ($house['owner'] == 0 && $house['highest_bidder'] != 0) {
            $bid_end = date('d M Y, H:i:s', $house['bid_end']);
            $bidder = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='{$house['highest_bidder']}' LIMIT 1;");
            echo "The house is currently being auctioned. The auction will end at {$bid_end}.<br>";
            echo "The highest bid so far is <b>{$house['last_bid']}</b> gold and has been submitted by <b><a href='characterprofile.php?name={$bidder['name']}' target='_BLANK'>{$bidder['name']}</a></b>.";
        } else {
            echo "The house is currently being auctioned. No bid has been submitted so far.";
        }
        ?></li>
 
Last edited:
Solution
Yes, is, I know how to do, but not sure if is the correct way, when I get in my PC, I'll help you.

Take a look in Nerana (http://n-s1.servegame.com)
Search for GM Nerana
Post automatically merged:



just search for:
PHP:
        <li><b>Owner</b>: <?php
        if ($house['owner'] > 0) echo "<a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a>";
else echo "Available for auction.";
?></li>

and replace for:
PHP:
    <li><b>Owner</b>: <?php //owner? ate quando o rent foi pago?
        if ($house['owner'] > 0) {
            $ownersex = mysql_select_single("SELECT `sex` FROM `players` WHERE `id` = '{$house['owner']}' LIMIT 1;");
            $paid = date('d M Y, H:i:s', $house['paid']);
            echo "The house has been rented by <b><a href='characterprofile.php?name={$house['ownername']}' target='_BLANK'>{$house['ownername']}</b></a>.";
            if ($ownersex['sex'] > 0) {
                echo " He has paid the rent until {$paid}.";
            } else {
                echo " She has paid the rent until {$paid}.";
            }
        } elseif ($house['owner'] == 0 && $house['highest_bidder'] != 0) {
            $bid_end = date('d M Y, H:i:s', $house['bid_end']);
            $bidder = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='{$house['highest_bidder']}' LIMIT 1;");
            echo "The house is currently being auctioned. The auction will end at {$bid_end}.<br>";
            echo "The highest bid so far is <b>{$house['last_bid']}</b> gold and has been submitted by <b><a href='characterprofile.php?name={$bidder['name']}' target='_BLANK'>{$bidder['name']}</a></b>.";
        } else {
            echo "The house is currently being auctioned. No bid has been submitted so far.";
        }
        ?></li>
Perfect thank you! I saw on GM Nerana that this info can be displayed on characterprofile as well, do you mind sharing that code too?
 
send me the characterprofile.php
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(4);
}
if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
    $name = $_GET['name'];
 
    if (user_character_exist($name)) {
        $user_id = user_character_id($name);
        if ($config['TFSVersion'] == 'TFS_10') {
                $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'town_id', 'group_id', 'sex');
                $profile_data['online'] = user_is_online_10($user_id);
        } else $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'town_id', 'online');
        $profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
    
        $guild_exist = false;
        if (get_character_guild_rank($user_id) > 0) {
                $guild_exist = true;
                $guild = get_player_guild_data($user_id);
                $guild_name = get_guild_name($guild['guild_id']);
        }
        ?>
    
        <!-- PROFILE MARKUP HERE-->
        <h1>Character Profile:</h1>
        <table>
                        <!-- Player Position -->
                <?php if ($profile_data['group_id'] > 1): ?>
                    <tr>
                        <td>Position:</td>
                        <td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
                    </tr>
                <?php endif; ?>
            <tr class="yellow"><th><left>Name:</th><th><?php echo $profile_data['name']; ?></left> <?php
                // pending deletion?($name)
                $deletion_time = mysql_select_single("SELECT `time` FROM `znote_deleted_characters` WHERE `character_name`='{$name}' AND `done` = '0' LIMIT 1;");
                if ($deletion_time !== false): ?>
                - is scheduled for deletion at <?php echo $deletion_time['time']; ?>.
                <?php endif; ?>
                <!-- end deletion part --></th></tr>
            <tr><td>Level:</td><td><?php echo $profile_data['level']; ?></td></tr>
            <tr><td>Vocation:</td><td><?php echo vocation_id_to_name($profile_data['vocation']); ?></td></tr>
            <tr>
               <td>Sex:</td>
               <td><?php echo $profile_data['sex'] == 0 ? 'Female' : 'Male'; ?></td>
            </tr>
            <tr>
                <td>Guild Membership:</td>
                <td><?php
                        if ($guild_exist) {
                        ?>
                        <?php echo $guild['rank_name']; ?> of <a href="guilds.php?name=<?php echo $guild_name; ?>"><?php echo $guild_name; ?></a>
                        <?php
                        }
                        else {
                        echo 'None';
                        }
                ?></td>
            </tr>
                            <!-- Display house start -->
                <?php
                if ($config['ServerEngine'] !== 'TFS_02') {
                    // Compatibility fix
                    $column_town_id = array(
                        'OTHIRE' => 'townid',
                        'TFS_03' => 'town'
                        // Default: town_id
                    );
                    $column_town_id = (isset($column_town_id[$config['ServerEngine']]))
                    ? $column_town_id[$config['ServerEngine']]
                    : 'town_id';

                    $houses = mysql_select_multi("
                        SELECT `id`, `owner`, `name`, `{$column_town_id}` AS `town_id`
                        FROM `houses`
                        WHERE `owner` = {$user_id};
                    ");

                    if ($houses !== false) {
                        foreach ($houses as $h): ?>
                            <tr>
                                <td>House:</td>
                                <td><?php echo $h['name'] . ', ' . $config['towns'][$h['town_id']]; ?></td>
                            </tr>
                        <?php endforeach;
                    }
                }
                ?>
            <tr>
                <td>Residence:</td>
                <td><?php echo $config['towns'][$profile_data['town_id']]; ?></td>
            </tr>
            <tr>
                <td>Last Login:</td>
                <td><?php
                    if ($profile_data['lastlogin'] != 0) { echo getClock($profile_data['lastlogin'], true, false); } else { echo 'Never.'; }
                ?></td>
            </tr>
            <tr>
                <td>Status:</td>
                <td><?php
                    if ($config['TFSVersion'] == 'TFS_10') {
                        if ($profile_data['online']) {
                            echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
                        } else {
                            echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
                        }
                    } else {
                        if ($profile_data['online'] == 1) {
                            echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
                        } else {
                            echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
                        }
                    }
                ?></td>
            </tr>
            <tr>
                <td>Created:</td>
                <td><?php echo getClock($profile_znote_data['created'], true); ?></td>
            </tr>
            <tr>
                 <td>Account Status:</td>
                 <td><?php
                    $account = mysql_select_single("SELECT `accounts`.`premdays` FROM `players` INNER JOIN `accounts` ON `players`.`account_id` = `accounts`.`id` WHERE `players`.`id` = '$user_id' LIMIT 1;");
                    ?>
                    <font class="profile_font" name="profile_font_pacc"> <?php echo ($account['premdays'] > 0) ? '<b><font color="green">Premium Account</font></b>' : '<b><font color="red">Free Account</font></b>'; ?></font>
                    </li>
                 </td>
            </tr>
        </table>
<?php
/*/
/   Znote AAC 1.4+ detailed character info (HP, MP, lvL, Exp, skills)
/   HTML code based on code from Gesior
/*/
$tableWidth = 540;
if ($config['TFSVersion'] != 'TFS_10') {
    $playerData = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='$user_id' LIMIT 7;");
    $playerData['fist'] = $playerData[0]['value']; unset($playerData[0]);
    $playerData['club'] = $playerData[1]['value']; unset($playerData[1]);
    $playerData['sword'] = $playerData[2]['value']; unset($playerData[2]);
    $playerData['axe'] = $playerData[3]['value']; unset($playerData[3]);
    $playerData['dist'] = $playerData[4]['value']; unset($playerData[4]);
    $playerData['shield'] = $playerData[5]['value']; unset($playerData[5]);
    $playerData['fish'] = $playerData[6]['value']; unset($playerData[6]);

    $player = mysql_select_single("SELECT `health`, `healthmax`, `mana`, `manamax`, `experience`, `maglevel`, `level` FROM `players` WHERE `id`='$user_id' LIMIT 1;");
    $playerData['magic'] = $player['maglevel'];
    $playerData['exp'] = array(
        'now' => $player['experience'],
        'next' => (int)(level_to_experience($player['level']+1) - $player['experience']),
        'percent' => (int)(($player['experience'] - level_to_experience($player['level'])) / (level_to_experience($player['level']+1) - $player['experience']) * 100)
    );
    $playerData['health'] = array(
        'now' => $player['health'],
        'max' => $player['healthmax'],
        'percent' => (int)($player['health'] / $player['healthmax'] * 100),
    );
    $playerData['mana'] = array(
        'now' => $player['mana'],
        'max' => $player['manamax'],
        'percent' => (int)($player['mana'] / $player['manamax'] * 100),
    );
} else {
    $player = mysql_select_single("SELECT `health`, `healthmax`, `mana`, `manamax`, `experience`, `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing`, `maglevel`, `level` FROM `players` WHERE `id`='$user_id' LIMIT 1;");
    $playerData = array(
        'fist' => $player['skill_fist'],
        'club' => $player['skill_club'],
        'sword' => $player['skill_sword'],
        'axe' => $player['skill_axe'],
        'dist' => $player['skill_dist'],
        'shield' => $player['skill_shielding'],
        'fish' => $player['skill_fishing'],
        'magic' => $player['maglevel'],
        'exp' => array(
            'now' => $player['experience'],
            'next' => (int)(level_to_experience($player['level']+1) - $player['experience']),
            'percent' => (int)(($player['experience'] - level_to_experience($player['level'])) / (level_to_experience($player['level']+1) - $player['experience']) * 100)
        ),
        'health' => array(
            'now' => $player['health'],
            'max' => $player['healthmax'],
            'percent' => (int)($player['health'] / $player['healthmax'] * 100),
        ),
        'mana' => array(
            'now' => $player['mana'],
            'max' => $player['manamax'],
            'percent' => (int)($player['mana'] / $player['manamax'] * 100),
        )
    );
}
// Incase they have more health/mana than they should due to equipment bonus etc
if ($playerData['exp']['percent'] > 100) $playerData['exp']['percent'] = 100;
if ($playerData['health']['percent'] > 100) $playerData['health']['percent'] = 100;
if ($playerData['mana']['percent'] > 100) $playerData['mana']['percent'] = 100;
//data_dump($playerData, false, "Player Data");
?>
<!-- PLAYER SKILLS TABLE -->
</table></center>
        <!-- Player Comment -->
        <?php if (!empty($profile_znote_data['comment'])): ?>
            <div class="Panel bordered" style="background-image:url('imgs/background1.jpg');background-repeat: repeat;">   
                <center>
            <table class="comment">
                <thead>
                    <tr class="yellow">
                        <td><font class="profile_font" name="profile_font_comment">Comment:</font></td>
                    </tr>
                    <tr>
                        <td><?php echo preg_replace('/\v+|\\\r\\\n/','<br/>',$profile_znote_data['comment']); ?></td>
                    </tr>
                </tbody>
            </table></center></div>
        <?php endif; ?>
<!-- DEATH LIST -->
<h1>Death List:</h1><br>
<table id="characterprofileTable" class="table table-striped table-hover">
    <tr class="yellow">
        <th>Date:</th>
        <th>Level:</th>
        <th>Killed by:</th>
    </tr>
    <?php
    if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
        $array = user_fetch_deathlist($user_id);
        if ($array) {
            
                // Design and present the list
                foreach ($array as $value) {
                    echo '<tr>';
                    // $value[0]
                    $value['time'] = getClock($value['time'], true);                                   
                    if ($value['is_player'] == 1) {
                        $value['killed_by'] = 'player: <a href="characterprofile.php?name='. $value['killed_by'] .'">'. $value['killed_by'] .'</a>';
                    } else {
                        $value['killed_by'] = 'monster: '. $value['killed_by'] .'.';
                    }
                
                    echo '<td>'. $value['time'] .'</td>
                    <td> Killed at level '. $value['level'] .'</td>
                    <td>'. $value['killed_by'];'</td>
                    </tr>';
                }
            
            } else {
                echo '<b><font color="green">This player has never died.</font></b>';
            }
            //Done.
        } else if ($config['TFSVersion'] == 'TFS_03') {
            $array = user_fetch_deathlist03($user_id);
            if ($array) {
        
                // Design and present the list
                foreach ($array as $value) {
                    echo '<tr>';
                    $value[3] = user_get_killer_id(user_get_kid($value['id']));
                    if ($value[3] !== false && $value[3] >= 1) {
                        $namedata = user_character_data((int)$value[3], 'name');
                        if ($namedata !== false) {
                            $value[3] = $namedata['name'];
                            $value[3] = '<a href="characterprofile.php?name='. $value[3] .'">'. $value[3] .'</a>';
                        } else {
                            $value[3] = 'deleted player.';
                        }
                    } else {
                        $value[3] = user_get_killer_m_name(user_get_kid($value['id']));
                        if ($value[3] === false) $value[3] = 'deleted player.';
                    }
                    echo '<td>'. getClock($value['date'], true) .'</td> <td>Killed at level '. $value['level'] .'.</td> <td>'. $value[3];
                    '</td></tr>';
                }
        
            } else {
                echo '<b><font color="green">This player has never died.</font></b>';
            }
        }
        ?>
</table>
<!-- END DEATH LIST -->         
<!-- CHARACTER LIST -->
<?php
if (user_character_hide($profile_data['name']) != 1 && user_character_list_count(user_character_account_id($name)) > 1) {
?>
    <h1>Other visible characters on this account:</h1><br>
    <?php
    $characters = user_character_list(user_character_account_id($profile_data['name']));
    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online
    if ($characters && count($characters) > 1) {
        ?>
        <table id="characterprofileTable" class="table table-striped table-hover">
            <tr class="yellow">
                <th>Name:</th>
                <th>Level:</th>
                <th>Vocation:</th>
                <th>Last login:</th>
                <th>Status:</th>
            </tr>
            <?php
            // Design and present the list
            foreach ($characters as $char) {
                if ($char['name'] != $profile_data['name']) {
                    if (hide_char_to_name(user_character_hide($char['name'])) != 'hidden') {
                        echo '<tr>';
                        echo '<td><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
                        echo '<td>'. $char['level'] .'</td>';
                        echo '<td>'. $char['vocation'] .'</td>';
                        echo '<td>'. $char['lastlogin'] .'</td>';
                        echo '<td>'. $char['online'] .'</td>';
                        echo '</tr>';
                    }
                }
            }
            ?>
        </table>
        <?php
    } else {
        echo '<b><font color="green">This player has never died.</font></b>';
    }
    //Done.
}
?>
<h1>Search Character:</h1>
    <div class="postHolder">
    <div class="well">
        <div class="header">
        </div>
        <div class="body">
            <form type="submit" action="characterprofile.php" method="get">
                <input type="text" name="name" class="search">
                <input type="submit" name="submitName" value="Search">
            </form>
        </div>
    </div>
</div>
<!-- END CHARACTER LIST -->
<font class="profile_font" name="profile_font_share_url">Address: <a href="<?php
        if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
        else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
?>"><?php
        if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
        else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
?></a></font>
<!-- END PROFILE MARKUP HERE-->
<?php
} else {
    echo htmlentities(strip_tags($name, ENT_QUOTES)).' does not exist.';
}
} else {
    header('Location: index.php');
}
include 'layout/overall/footer.php'; ?>

I really liked that it showed date of rent on characterprofile and that the house was linked to house.php directly through clicking on house name in profile.
 
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(4);
}
if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
    $name = $_GET['name'];
 
    if (user_character_exist($name)) {
        $user_id = user_character_id($name);
        if ($config['TFSVersion'] == 'TFS_10') {
                $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'town_id', 'group_id', 'sex');
                $profile_data['online'] = user_is_online_10($user_id);
        } else $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'town_id', 'online');
        $profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
   
        $guild_exist = false;
        if (get_character_guild_rank($user_id) > 0) {
                $guild_exist = true;
                $guild = get_player_guild_data($user_id);
                $guild_name = get_guild_name($guild['guild_id']);
        }
        ?>
   
        <!-- PROFILE MARKUP HERE-->
        <h1>Character Profile:</h1>
        <table>
                        <!-- Player Position -->
                <?php if ($profile_data['group_id'] > 1): ?>
                    <tr>
                        <td>Position:</td>
                        <td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
                    </tr>
                <?php endif; ?>
            <tr class="yellow"><th><left>Name:</th><th><?php echo $profile_data['name']; ?></left> <?php
                // pending deletion?($name)
                $deletion_time = mysql_select_single("SELECT `time` FROM `znote_deleted_characters` WHERE `character_name`='{$name}' AND `done` = '0' LIMIT 1;");
                if ($deletion_time !== false): ?>
                - is scheduled for deletion at <?php echo $deletion_time['time']; ?>.
                <?php endif; ?>
                <!-- end deletion part --></th></tr>
            <tr><td>Level:</td><td><?php echo $profile_data['level']; ?></td></tr>
            <tr><td>Vocation:</td><td><?php echo vocation_id_to_name($profile_data['vocation']); ?></td></tr>
            <tr>
               <td>Sex:</td>
               <td><?php echo $profile_data['sex'] == 0 ? 'Female' : 'Male'; ?></td>
            </tr>
            <tr>
                <td>Guild Membership:</td>
                <td><?php
                        if ($guild_exist) {
                        ?>
                        <?php echo $guild['rank_name']; ?> of <a href="guilds.php?name=<?php echo $guild_name; ?>"><?php echo $guild_name; ?></a>
                        <?php
                        }
                        else {
                        echo 'None';
                        }
                ?></td>
            </tr>
                            <!-- Display house start -->
                <?php
                if ($config['ServerEngine'] !== 'TFS_02') {
                    // Compatibility fix
                    $column_town_id = array(
                        'OTHIRE' => 'townid',
                        'TFS_03' => 'town'
                        // Default: town_id
                    );
                    $column_town_id = (isset($column_town_id[$config['ServerEngine']]))
                    ? $column_town_id[$config['ServerEngine']]
                    : 'town_id';

                    $houses = mysql_select_multi("
                        SELECT `id`, `owner`, `name`, `{$column_town_id}` AS `town_id`
                        FROM `houses`
                        WHERE `owner` = {$user_id};
                    ");

                    if ($houses !== false) {
                        foreach ($houses as $h): ?>
                            <tr>
                                <td>House:</td>
                                <td><?php echo $h['name'] . ', ' . $config['towns'][$h['town_id']]; ?></td>
                            </tr>
                        <?php endforeach;
                    }
                }
                ?>
            <tr>
                <td>Residence:</td>
                <td><?php echo $config['towns'][$profile_data['town_id']]; ?></td>
            </tr>
            <tr>
                <td>Last Login:</td>
                <td><?php
                    if ($profile_data['lastlogin'] != 0) { echo getClock($profile_data['lastlogin'], true, false); } else { echo 'Never.'; }
                ?></td>
            </tr>
            <tr>
                <td>Status:</td>
                <td><?php
                    if ($config['TFSVersion'] == 'TFS_10') {
                        if ($profile_data['online']) {
                            echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
                        } else {
                            echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
                        }
                    } else {
                        if ($profile_data['online'] == 1) {
                            echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
                        } else {
                            echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
                        }
                    }
                ?></td>
            </tr>
            <tr>
                <td>Created:</td>
                <td><?php echo getClock($profile_znote_data['created'], true); ?></td>
            </tr>
            <tr>
                 <td>Account Status:</td>
                 <td><?php
                    $account = mysql_select_single("SELECT `accounts`.`premdays` FROM `players` INNER JOIN `accounts` ON `players`.`account_id` = `accounts`.`id` WHERE `players`.`id` = '$user_id' LIMIT 1;");
                    ?>
                    <font class="profile_font" name="profile_font_pacc"> <?php echo ($account['premdays'] > 0) ? '<b><font color="green">Premium Account</font></b>' : '<b><font color="red">Free Account</font></b>'; ?></font>
                    </li>
                 </td>
            </tr>
        </table>
<?php
/*/
/   Znote AAC 1.4+ detailed character info (HP, MP, lvL, Exp, skills)
/   HTML code based on code from Gesior
/*/
$tableWidth = 540;
if ($config['TFSVersion'] != 'TFS_10') {
    $playerData = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='$user_id' LIMIT 7;");
    $playerData['fist'] = $playerData[0]['value']; unset($playerData[0]);
    $playerData['club'] = $playerData[1]['value']; unset($playerData[1]);
    $playerData['sword'] = $playerData[2]['value']; unset($playerData[2]);
    $playerData['axe'] = $playerData[3]['value']; unset($playerData[3]);
    $playerData['dist'] = $playerData[4]['value']; unset($playerData[4]);
    $playerData['shield'] = $playerData[5]['value']; unset($playerData[5]);
    $playerData['fish'] = $playerData[6]['value']; unset($playerData[6]);

    $player = mysql_select_single("SELECT `health`, `healthmax`, `mana`, `manamax`, `experience`, `maglevel`, `level` FROM `players` WHERE `id`='$user_id' LIMIT 1;");
    $playerData['magic'] = $player['maglevel'];
    $playerData['exp'] = array(
        'now' => $player['experience'],
        'next' => (int)(level_to_experience($player['level']+1) - $player['experience']),
        'percent' => (int)(($player['experience'] - level_to_experience($player['level'])) / (level_to_experience($player['level']+1) - $player['experience']) * 100)
    );
    $playerData['health'] = array(
        'now' => $player['health'],
        'max' => $player['healthmax'],
        'percent' => (int)($player['health'] / $player['healthmax'] * 100),
    );
    $playerData['mana'] = array(
        'now' => $player['mana'],
        'max' => $player['manamax'],
        'percent' => (int)($player['mana'] / $player['manamax'] * 100),
    );
} else {
    $player = mysql_select_single("SELECT `health`, `healthmax`, `mana`, `manamax`, `experience`, `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing`, `maglevel`, `level` FROM `players` WHERE `id`='$user_id' LIMIT 1;");
    $playerData = array(
        'fist' => $player['skill_fist'],
        'club' => $player['skill_club'],
        'sword' => $player['skill_sword'],
        'axe' => $player['skill_axe'],
        'dist' => $player['skill_dist'],
        'shield' => $player['skill_shielding'],
        'fish' => $player['skill_fishing'],
        'magic' => $player['maglevel'],
        'exp' => array(
            'now' => $player['experience'],
            'next' => (int)(level_to_experience($player['level']+1) - $player['experience']),
            'percent' => (int)(($player['experience'] - level_to_experience($player['level'])) / (level_to_experience($player['level']+1) - $player['experience']) * 100)
        ),
        'health' => array(
            'now' => $player['health'],
            'max' => $player['healthmax'],
            'percent' => (int)($player['health'] / $player['healthmax'] * 100),
        ),
        'mana' => array(
            'now' => $player['mana'],
            'max' => $player['manamax'],
            'percent' => (int)($player['mana'] / $player['manamax'] * 100),
        )
    );
}
// Incase they have more health/mana than they should due to equipment bonus etc
if ($playerData['exp']['percent'] > 100) $playerData['exp']['percent'] = 100;
if ($playerData['health']['percent'] > 100) $playerData['health']['percent'] = 100;
if ($playerData['mana']['percent'] > 100) $playerData['mana']['percent'] = 100;
//data_dump($playerData, false, "Player Data");
?>
<!-- PLAYER SKILLS TABLE -->
</table></center>
        <!-- Player Comment -->
        <?php if (!empty($profile_znote_data['comment'])): ?>
            <div class="Panel bordered" style="background-image:url('imgs/background1.jpg');background-repeat: repeat;">  
                <center>
            <table class="comment">
                <thead>
                    <tr class="yellow">
                        <td><font class="profile_font" name="profile_font_comment">Comment:</font></td>
                    </tr>
                    <tr>
                        <td><?php echo preg_replace('/\v+|\\\r\\\n/','<br/>',$profile_znote_data['comment']); ?></td>
                    </tr>
                </tbody>
            </table></center></div>
        <?php endif; ?>
<!-- DEATH LIST -->
<h1>Death List:</h1><br>
<table id="characterprofileTable" class="table table-striped table-hover">
    <tr class="yellow">
        <th>Date:</th>
        <th>Level:</th>
        <th>Killed by:</th>
    </tr>
    <?php
    if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
        $array = user_fetch_deathlist($user_id);
        if ($array) {
           
                // Design and present the list
                foreach ($array as $value) {
                    echo '<tr>';
                    // $value[0]
                    $value['time'] = getClock($value['time'], true);                                  
                    if ($value['is_player'] == 1) {
                        $value['killed_by'] = 'player: <a href="characterprofile.php?name='. $value['killed_by'] .'">'. $value['killed_by'] .'</a>';
                    } else {
                        $value['killed_by'] = 'monster: '. $value['killed_by'] .'.';
                    }
               
                    echo '<td>'. $value['time'] .'</td>
                    <td> Killed at level '. $value['level'] .'</td>
                    <td>'. $value['killed_by'];'</td>
                    </tr>';
                }
           
            } else {
                echo '<b><font color="green">This player has never died.</font></b>';
            }
            //Done.
        } else if ($config['TFSVersion'] == 'TFS_03') {
            $array = user_fetch_deathlist03($user_id);
            if ($array) {
       
                // Design and present the list
                foreach ($array as $value) {
                    echo '<tr>';
                    $value[3] = user_get_killer_id(user_get_kid($value['id']));
                    if ($value[3] !== false && $value[3] >= 1) {
                        $namedata = user_character_data((int)$value[3], 'name');
                        if ($namedata !== false) {
                            $value[3] = $namedata['name'];
                            $value[3] = '<a href="characterprofile.php?name='. $value[3] .'">'. $value[3] .'</a>';
                        } else {
                            $value[3] = 'deleted player.';
                        }
                    } else {
                        $value[3] = user_get_killer_m_name(user_get_kid($value['id']));
                        if ($value[3] === false) $value[3] = 'deleted player.';
                    }
                    echo '<td>'. getClock($value['date'], true) .'</td> <td>Killed at level '. $value['level'] .'.</td> <td>'. $value[3];
                    '</td></tr>';
                }
       
            } else {
                echo '<b><font color="green">This player has never died.</font></b>';
            }
        }
        ?>
</table>
<!-- END DEATH LIST -->        
<!-- CHARACTER LIST -->
<?php
if (user_character_hide($profile_data['name']) != 1 && user_character_list_count(user_character_account_id($name)) > 1) {
?>
    <h1>Other visible characters on this account:</h1><br>
    <?php
    $characters = user_character_list(user_character_account_id($profile_data['name']));
    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online
    if ($characters && count($characters) > 1) {
        ?>
        <table id="characterprofileTable" class="table table-striped table-hover">
            <tr class="yellow">
                <th>Name:</th>
                <th>Level:</th>
                <th>Vocation:</th>
                <th>Last login:</th>
                <th>Status:</th>
            </tr>
            <?php
            // Design and present the list
            foreach ($characters as $char) {
                if ($char['name'] != $profile_data['name']) {
                    if (hide_char_to_name(user_character_hide($char['name'])) != 'hidden') {
                        echo '<tr>';
                        echo '<td><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
                        echo '<td>'. $char['level'] .'</td>';
                        echo '<td>'. $char['vocation'] .'</td>';
                        echo '<td>'. $char['lastlogin'] .'</td>';
                        echo '<td>'. $char['online'] .'</td>';
                        echo '</tr>';
                    }
                }
            }
            ?>
        </table>
        <?php
    } else {
        echo '<b><font color="green">This player has never died.</font></b>';
    }
    //Done.
}
?>
<h1>Search Character:</h1>
    <div class="postHolder">
    <div class="well">
        <div class="header">
        </div>
        <div class="body">
            <form type="submit" action="characterprofile.php" method="get">
                <input type="text" name="name" class="search">
                <input type="submit" name="submitName" value="Search">
            </form>
        </div>
    </div>
</div>
<!-- END CHARACTER LIST -->
<font class="profile_font" name="profile_font_share_url">Address: <a href="<?php
        if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
        else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
?>"><?php
        if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
        else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
?></a></font>
<!-- END PROFILE MARKUP HERE-->
<?php
} else {
    echo htmlentities(strip_tags($name, ENT_QUOTES)).' does not exist.';
}
} else {
    header('Location: index.php');
}
include 'layout/overall/footer.php'; ?>

I really liked that it showed date of rent on characterprofile and that the house was linked to house.php directly through clicking on house name in profile.
what server engine do you use?
 
first, search for:
PHP:
$houses = mysql_select_multi("
below is:
SQL:
SELECT `id`, `owner`, `name`, `{$column_town_id}` AS `town_id`
Insert
SQL:
`paid`
after owner to look like:
SQL:
SELECT `id`, `owner`, `paid`, `name`, `{$column_town_id}` AS `town_id`

then, right below, where is:
PHP:
                    if ($houses !== false) {
                        foreach ($houses as $h): ?>
                            <tr>
                                <td>House:</td>
                                <td><?php echo $h['name'] . ', ' . $config['towns'][$h['town_id']]; ?></td>
                            </tr>
                        <?php endforeach;
                    }
}
?>

care to replace correctly, change for:
PHP:
                    if ($houses !== false) {
                        foreach ($houses as $h): ?>
                            <tr>
                                <td>House:</td>
                                <td><strong><?php echo "<a href='house.php?id=". $h['id'] ."'>". $h['name'] ."</a>";?></strong>
                <?php
                    $value = $config['towns'][$h['town_id']];
                    $paid = date('d M Y', $h['paid']);
                    echo " ({$value}) is paid until {$paid}";
                ?></td></tr>
                        <?php endforeach;
                    }
                }
                ?>
 
first, search for:
PHP:
$houses = mysql_select_multi("
below is:
SQL:
SELECT `id`, `owner`, `name`, `{$column_town_id}` AS `town_id`
Insert
SQL:
`paid`
after owner to look like:
SQL:
SELECT `id`, `owner`, `paid`, `name`, `{$column_town_id}` AS `town_id`

then, right below, where is:
PHP:
                    if ($houses !== false) {
                        foreach ($houses as $h): ?>
                            <tr>
                                <td>House:</td>
                                <td><?php echo $h['name'] . ', ' . $config['towns'][$h['town_id']]; ?></td>
                            </tr>
                        <?php endforeach;
                    }
}
?>

care to replace correctly, change for:
PHP:
                    if ($houses !== false) {
                        foreach ($houses as $h): ?>
                            <tr>
                                <td>House:</td>
                                <td><strong><?php echo "<a href='house.php?id=". $h['id'] ."'>". $h['name'] ."</a>";?></strong>
                <?php
                    $value = $config['towns'][$h['town_id']];
                    $paid = date('d M Y', $h['paid']);
                    echo " ({$value}) is paid until {$paid}";
                ?></td></tr>
                        <?php endforeach;
                    }
                }
                ?>
Thank you so much dude!
I appreciate your help alot :D
 
Back
Top