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

[Znote AAC 1.4] Show marriage/flags on characterprofile.php

lubunttu

New Member
Joined
May 17, 2016
Messages
107
Reaction score
2
How to echo Flag (img/or writed) AND marriage partner in my characterprofile.php

My fail code:
Code:
<li><font class="profile_font" name="profile_font_level"><b>Country: </b><?php
  echo $profile_data['flag'];
?></font></li>
<li><font class="profile_font" name="profile_font_level"><b>Marriage: </b><?php
  echo $profile_data['marriage'];
?></font></li>

characterprofile.php
http://pastebin.com/ETDW9cBa


To add flags i used:
Code:
ALTER TABLE `accounts`
ADD `flag` VARCHAR( 20 ) NOT NULL;

Code:
ALTER TABLE `znote_accounts`
ADD `flag` VARCHAR( 20 ) NOT NULL;

Following this tutorial:
https://otland.net/threads/znote-aac-flags-for-characterview-and-highscores.167053/

To add marriage system i used:
Code:
CREATE TABLE marriage_system (
  id  INTEGER NOT NULL,
  player_id  INTEGER NOT NULL,
  partner  VARCHAR( 255 )  NOT NULL,
  marriage_date INTEGER NOT NULL,
  PRIMARY KEY ( id )
);

Following this tutorial:
https://otland.net/threads/marriage-system-8-6-fixed.161590/
 
Add this to the www/characterprofile.php page, where ever you want.
It'll create a new table with the players flag if they have one. If they don't have one it wont display anything. If you dont have the flag images, you'll need to get those: https://github.com/Znote/ZnoteAAC
Code:
<!-- Player country data -->
<?php
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'marriage');
$account_data = user_znote_account_data($profile_data['account_id'], 'flag');
?>
<?php if ($account_data['flag'] != ''){ ?><table><tr><td>Country: </td><td><?php echo '<img src="flags/' . $account_data['flag'] . '.png">';} ?></td></tr></table>



Add this to the www/characterprofile.php page, where ever you want.
It'll create a new table with who the players married to, if they're not married it wont display anything.
Code:
<!-- Marriage Data -->
<?php
$married_to = mysql_select_single("SELECT 'partner' FROM `marriage_system` WHERE $user_id = 'id'");
?>
<?php if ($married_to != ''){ ?><table><tr><td>Married to: </td><td><a href="characterprofile.php?name=<?php echo $married_to; ?>"><?php echo $married_to;} ?></a></td></tr></table>
 
Last edited:
After looking at your code, this should work for both.

Code:
        <!-- Player country data -->
         <?php
  if ($config['country_flags']) { ?>
  <li><font class="profile_font" name="profile_font_country"><b>Country:</b> <?php echo '<img src="flags/' . $account_data['flag'] . '.png">'; ?></font></li><?php
  } else { ?>
         <li><font class="profile_font" name="profile_font_country"><b>Country:</b> <No Flag></font></li><?php
  } ?>
         <!-- Marriage Data -->
         <?php $married_to = mysql_select_single("SELECT 'partner' FROM `marriage_system` WHERE $user_id = 'id'"); ?>
         <?php if ($married_to != '') { ?>
           <li><b>Married to:</b> <a href="characterprofile.php?name=<?php echo $married_to; ?>"><?php echo $married_to; ?></a></li>
         <?php } else { ?>
           <li><b>Married to:</b> No-one.</li>
         <?php }   ?>
 
Back
Top