• [MOD] Birthday Mod v1.0 5 0 5 1
Currently:  

Author Topic: [MOD] Birthday Mod v1.0  (Read 194803 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Birthday Mod v1.0
« Reply #45 on: February 18, 2006, 06:01:23 PM »
Sauberer Zusatz-Mod  :mrgreen:

großes Dankeschön  :D

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Birthday Mod v1.0
« Reply #46 on: February 18, 2006, 07:59:44 PM »
If you want to display zodiac signs:
In global.php place anywhere (or if you are not planning using it anywere else, but on profile page, then place it in member.php, lets say below <?php ):
Code: [Select]
$zodiac_array = array(
  1 => array(19, "capricorn", "aquarius"),
  2 => array(18, "aquarius", "pisces"),
  3 => array(19, "pisces", "aries"),
  4 => array(20, "aries", "taurus"),
  5 => array(21, "taurus", "gemini"),
  6 => array(21, "gemini", "cancer"),
  7 => array(22, "cancer", "leo"),
  8 => array(23, "leo", "virgo"),
  9 => array(23, "virgo", "libra"),
  10 => array(23, "libra", "scorpio"),
  11 => array(22, "scorpio", "sagittarius"),
  12 => array(21, "sagittarius", "capricorn"),
);
in Step 5 (in member.php) find:
Code: [Select]
      $birthday = explode("-",$user_row[$user_table_fields['birthday']]);Insert below:
Code: [Select]
      $zodiac = "";
      $month = intval($birthday[1]);
      if ($month)
      {
        $day = intval($birthday[2]);
        $day = ($day) ? $day : 1;
        $zodiac = $zodiac_array[$month][(($day <= $zodiac_array[$month][0] ) ? 1 : 2)];
      }
      $site_template->register_vars(array(
        "lang_zodiac" => $lang['zodiac'],
        "zodiac" => $zodiac,
        "zodiac_img" => get_gallery_image("zodiac/".$zodiac.".gif"),
        "zodiac_name" => $lang['zodiac_names'][$zodiac],
      ));

Then in lang/<your language>/main.php insert:
Code: [Select]
$lang['zodiac'] = "Zodiac sign";
$lang['zodiac_names'] = array(
  "" => "N/A",
  "aquarius" => "Aquarius",
  "pisces" => "Pisces",
  "aries" => "Aries",
  "taurus" => "Taurus",
  "gemini" => "Gemini",
  "cancer" => "Cancer",
  "leo" => "Leo",
  "virgo" => "Virgo",
  "libra" => "Libra",
  "scorpio" => "Scorpio",
  "sagittarius" => "Sagittarius",
  "capricorn" => "Capricorn",
);

And finaly in member_profile.html template you can use the following tags:
{if zodiac}{endif zodiac} - use these to ensure that it wont show "broken" image if no month was specifyed
{lang_zodiac} - will display "Zodiac sign" from language file
{zodiac_img} - will show address to the image. Use it as <img src="{zodiac_img}">
{zodiac_name} - will show name of the zodiac sign (from language file) you can place it as title="{zodiac_name}" inside <img> tag.

Oh, almost forgot, the images must be placed in templates/<your template>/images/zodiac/ folder, they must be in GIF format (its easy to change though in the first step), filenames must be the following:
aquarius.gif
pisces.gif
aries.gif
taurus.gif
gemini.gif
cancer.gif
leo.gif
virgo.gif
libra.gif
scorpio.gif
sagittarius.gif
capricorn.gif
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Birthday Mod v1.0
« Reply #47 on: February 19, 2006, 02:46:15 PM »
*heul*
bei mir funzt das nicht:(

ich hab zwar eine alte version drauf gehabt hab das auf user_age_birthday geändert, aber es kommt zwar keine Fehlermeldung aber es wird nix gezeigt.
Bitte um HILFEEEEEE


 ich denke es liegt entweder an meiner Db_definiations oder an meiner sessions.php:
Meine db_field_definitions sieht so aus:
Code: [Select]
// Example for additional image fields:
//$additional_image_fields['image_photographer'] = array($lang['image_photographer'], "text", 1);

// Example for additional user fields
//$additional_user_fields['user_adress'] = array($lang['user_adress'], "text", 1);
$additional_user_fields['user_avatar'] = array($lang['avatar'], "avatar", 0);
$additional_user_fields['user_birth_day'] = array($lang['user_birth_day'], "text", 1);
$additional_user_fields['user_birth_month'] = array($lang['user_birth_month'], "text", 1);
$additional_user_fields['user_birth_year'] = array($lang['user_birth_year'], "value", 1);
$additional_user_fields['user_posts'] = array($lang['user_posts'], "text", 0);
$additional_user_fields['profile_hits'] = array($lang['profile_hits'], "text", 0);
$additional_user_fields['user_hobby'] = array($lang['hobby'], "text", 0);
$var = array("------------",
"---Europe---",
bla bla
die länder..eh klar brauchen wir nicht aufzählen weil soviele sind..hab ich rausgenommen..
""Other"
);
$additional_user_fields['user_country'] = array($lang['user_country'], "dropdown", 0, $var, 0, 0, 0, 1);
$additional_user_fields['user_gender'] = array($lang['user_gender'], "dropdown", 0, array("b" => "keine Angabe", "m" => "männlich", "w" => "weiblich"), 1, 0, 0, 0);
$additional_user_fields['user_leitsatz'] = array($lang['leitsatz'], "text", 0);
$additional_user_fields['user_age_birthday'] = array($lang['birthday'], "text", 0);

und meine sessions.php
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
}
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
    if (!class_exists("GeoIP"))
    {
      include(ROOT_PATH."includes/geoip.inc");
    }
   
    $gi = geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
    $countries = array();
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------

define('SESSION_NAME', 'sessionid');

$user_table_fields = array(
  "user_id" => "user_id",
  "user_level" => "user_level",
  "user_name" => "user_name",
  "user_password" => "user_password",
  "user_email" => "user_email",
  "user_showemail" => "user_showemail",
  "user_allowemails" => "user_allowemails",
  "user_invisible" => "user_invisible",
  "user_joindate" => "user_joindate",
  "user_activationkey" => "user_activationkey",
  "user_lastaction" => "user_lastaction",
  "user_location" => "user_location",
  "user_lastvisit" => "user_lastvisit",
  "user_comments" => "user_comments",
  "user_homepage" => "user_homepage",
"birthday" => "user_age_birthday",
  "user_icq" => "user_icq"
);

//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------

function get_user_table_field($add, $user_field) {
  global $user_table_fields;
  return (!empty($user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}

class Session {

  var $session_id;
  var $user_ip;
  var $user_location;
  var $current_time;
  var $session_timeout;
  var $mode = "get";
  var $session_info = array();
  var $user_info = array();

  function Session() {
    global $config;
    $this->session_timeout = $config['session_timeout'] * 60;
    $this->user_ip = $this->get_user_ip();
    $this->user_location = $this->get_user_location();
    $this->current_time = time();

    // Stop adding SID to URLs
    @ini_set('session.use_trans_sid', 0);

    session_name(urlencode(SESSION_NAME));
    session_start();

    $this->demand_session();
  }

  function set_cookie_data($name, $value, $permanent = 1) {
    $cookie_expire = ($permanent) ? $this->current_time + 60 * 60 * 24 * 365 : 0;
    $cookie_name = COOKIE_NAME.$name;
    setcookie($cookie_name, $value, $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
  }

  function read_cookie_data($name) {
    global $HTTP_COOKIE_VARS;
    $cookie_name = COOKIE_NAME.$name;
    return (isset($HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
  }

  function get_session_id() {
    if (SID == '') {
      $this->mode = "cookie";
    }

    $this->session_id = session_id();
  }

  function demand_session() {
    $this->get_session_id();
    if (!$this->load_session_info()) {
      $this->delete_old_sessions();
      $user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
      $this->start_session($user_id);
    }
    else {
      $this->user_info = $this->load_user_info($this->session_info['session_user_id']);
      $update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time - $this->user_info['user_lastaction'] : $this->current_time - $this->session_info['session_lastaction'];
      if ($update_cutoff > 60) {
        $this->update_session();
        $this->delete_old_sessions();
      }
    }
  }

  function start_session($user_id = GUEST, $login_process = 0) {
    global $site_db;

    $this->user_info = $this->load_user_info($user_id);
    if ($this->user_info['user_id'] != GUEST && !$login_process) {
      if ($this->read_cookie_data("userpass") == $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
        $this->set_cookie_data("userpass", $this->user_info['user_password']);
      }
      else {
        $this->set_cookie_data("userpass", "", 0);
        $this->user_info = $this->load_user_info(GUEST);
      }
    }

    //if (!$login_process) {
      $sql = "REPLACE INTO ".SESSIONS_TABLE."
              (session_id, session_user_id, session_lastaction, session_location, session_ip)
              VALUES
              ('$this->session_id', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
      $site_db->query($sql);
    //}

    $this->session_info['session_user_id'] = $this->user_info['user_id'];
    $this->session_info['session_lastaction'] = $this->current_time;
    $this->session_info['session_location'] = $this->user_location;
    $this->session_info['session_ip'] = $this->user_ip;

    if ($this->user_info['user_id'] != GUEST) {
      $this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location', ".get_user_table_field("", "user_lastvisit")." = ".$this->user_info['user_lastvisit']."
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);
    }
    $this->set_cookie_data("lastvisit", $this->user_info['user_lastvisit']);
    $this->set_cookie_data("userid", $this->user_info['user_id']);
    return true;
  }

  function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
    global $site_db, $user_table_fields;

    if (empty($user_name) || empty($user_password)) {
      return false;
    }
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
            FROM ".USERS_TABLE."
            WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
    $row = $site_db->query_firstrow($sql);

    $user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    $user_password = md5($user_password);
    if ($user_id != GUEST) {
      if ($row[$user_table_fields['user_password']] == $user_password) {
        $sql = "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = $user_id
                WHERE session_id = '$this->session_id'";
        $site_db->query($sql);
        if ($set_auto_login) {
          $this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
        }
        $this->start_session($user_id, 1);
        return true;
      }
    }
    return false;
  }

  function logout($user_id) {
    global $site_db;
    $sql = "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '$this->session_id' OR session_user_id = $user_id";
    $site_db->query($sql);
    $this->set_cookie_data("userpass", "", 0);
    $this->set_cookie_data("userid", GUEST);

    $this->session_info = array();

    return true;
  }

  function delete_old_sessions() {
    global $site_db;
    $expiry_time = $this->current_time - $this->session_timeout;
    $sql = "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_lastaction < $expiry_time";
    $site_db->query($sql);

    return true;
  }

  function update_session() {
    global $site_db;

    $sql = "UPDATE ".SESSIONS_TABLE."
            SET session_lastaction = $this->current_time, session_location = '$this->user_location'
            WHERE session_id = '$this->session_id'";
    $site_db->query($sql);

    $this->session_info['session_lastaction'] = $this->current_time;
    $this->session_info['session_location'] = $this->user_location;
    $this->session_info['session_ip'] = $this->user_ip;

    if ($this->user_info['user_id'] != GUEST) {
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);
    }
    return;
  }

  function generate_session_id() {
    return session_id();
  }

  function return_session_info() {
    return $this->session_info;
  }

  function return_user_info() {
    return $this->user_info;
  }

  function freeze() {
    return;
  }

  function load_session_info() {
    if (@ini_get('register_globals')) {
      session_register('__session');

      if (!isset($GLOBALS['__session'])) {
        $GLOBALS['__session'] = array();
      }

      $this->session_info = &$GLOBALS['__session'];

    } else {
      if (isset($_SESSION)) {
        if (!isset($_SESSION['__session'])) {
          $_SESSION['__session'] = array();
        }

        $this->session_info = &$_SESSION['__session'];

      } else {
        if (!isset($GLOBALS['HTTP_SESSION_VARS']['__session'])) {
          $GLOBALS['HTTP_SESSION_VARS']['__session'] = array();
        }

        $this->session_info = &$GLOBALS['HTTP_SESSION_VARS']['__session'];
      }
    }

    if (!isset($this->session_info['session_user_id'])) {
        return false;
    }

    return $this->session_info;
  }

  function load_user_info($user_id = GUEST) {
    global $site_db, $user_table_fields;

    if ($user_id != GUEST) {
      $sql = "SELECT u.*, l.*
              FROM ".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
              WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.", "user_id");
      $user_info = $site_db->query_firstrow($sql);
      if (!$user_info) {
        $sql = "SELECT *
                FROM ".USERS_TABLE."
                WHERE ".get_user_table_field("", "user_id")." = $user_id";
        $user_info = $site_db->query_firstrow($sql);
        if ($user_info) {
          $lightbox_id = get_random_key(LIGHTBOXES_TABLE, "lightbox_id");
          $sql = "INSERT INTO ".LIGHTBOXES_TABLE."
                  (lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
                  VALUES
                  ('$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
          $site_db->query($sql);
          $user_info['lightbox_lastaction'] = $this->current_time;
          $user_info['lightbox_image_ids'] = "";
        }
      }
    }
    if (empty($user_info[$user_table_fields['user_id']])) {
      $user_info = array();
      $user_info['user_id'] = GUEST;
      $user_info['user_level'] = GUEST;
      $user_info['user_lastaction'] = $this->current_time;
      $user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
    }
    foreach ($user_table_fields as $key => $val) {
      if (isset($user_info[$val])) {
        $user_info[$key] = $user_info[$val];
      }
      elseif (!isset($user_info[$key])) {
        $user_info[$key] = "";
      }
    }
    return $user_info;
  }

  function set_session_var($var_name, $value) {
    $this->session_info[$var_name] = $value;
    return true;
  }

  function get_session_var($var_name) {
    if (isset($this->session_info[$var_name])) {
      return $this->session_info[$var_name];
    }

    return '';
  }

  function drop_session_var($var_name) {
    unset($this->session_info[$var_name]);
  }

  function get_user_ip() {
    global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
    $ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
    $ip = preg_replace("/[^\.0-9]+/", "", $ip);
    return substr($ip, 0, 50);
  }

  function get_user_location() {
    global $self_url;
    return (defined("IN_CP")) ? "Control Panel" : preg_replace(array("/([?|&])action=[^?|&]*/", "/([?|&])mode=[^?|&]*/", "/([?|&])phpinfo=[^?|&]*/", "/([?|&])printstats=[^?|&]*/", "/[?|&]".URL_ID."=[^?|&]*/", "/[?|&]l=[^?|&]*/", "/[&?]+$/"), array("", "", "", "", "", "", ""), addslashes($self_url));
  }

  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
} //end of class

//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME', '4images_');
define('COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIE_SECURE', '0');

$site_sess = new Session();

// Get Userinfo
$session_info = $site_sess->return_session_info();
$user_info = $site_sess->return_user_info();

//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online = 0;
$num_visible_online = 0;
$num_invisible_online = 0;
$num_registered_online = 0;
$num_guests_online = 0;
$user_online_list = "";
$prev_user_ids = array();
$prev_session_ips = array();

if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
  $time_out = time() - 300;
  $sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
  FROM ".SESSIONS_TABLE." s
  LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
  WHERE s.session_lastaction >= $time_out
  ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
  $result = $site_db->query($sql);
  while ($row = $site_db->fetch_array($result)) {
    if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
      if (!isset($prev_user_ids[$row['session_user_id']])) {
        $is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
        $invisibleuser = ($is_invisible) ? "*" : "";
        $username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
        if (!$is_invisible || $user_info['user_level'] == ADMIN) {
          $user_online_list .= ($user_online_list != "") ? ", " : "";
          $user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id'];
  /*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
        $cid = geoip_country_code_by_addr($gi, $row['session_ip']);
        if (empty($cid)) $cid = "lan";
        $countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
        $username = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/   
          $user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
        }
        (!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
        $num_registered_online++;
      }
      $prev_user_ids[$row['session_user_id']] = 1;
    }
    else {
      if (!isset($prev_session_ips[$row['session_ip']])) {
        $num_guests_online++;
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
        $cid = geoip_country_code_by_addr($gi, $row['session_ip']);
        if (empty($cid)) $cid = "lan";
        $countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
       
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/

      }
    }
    $prev_session_ips[$row['session_ip']] = 1;
  }
  /*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
  $invitado_online_list = array();
  if (!empty($countries))
  {
    asort($countries);
    foreach ($countries as $key => $val)
    {
      $invitado_online_list[] = "<font color=\"#000000\">".$val."</font><img src=\"".ROOT_PATH."/flags/".strtolower($key).".gif\" align=\"middle\" alt=\"".(($key != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$key]] : "Unknown or LAN")."\" border=0>";
    }
  }
  $invitado_online_list = implode(" , ", $invitado_online_list);
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/
  $num_total_online = $num_registered_online + $num_guests_online;
  //$num_invisible_online = $num_registered_online - $num_visible_online;

  $site_template->register_vars(array(
    "num_total_online" => $num_total_online,
    "num_invisible_online" => $num_invisible_online,
    "num_registered_online" => $num_registered_online,
    "num_guests_online" => $num_guests_online,
"invitado_online_list" => $invitado_online_list,
    "user_online_list" => $user_online_list,
    "lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
    "lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
  ));
  //-----------------------------
//---Most ever users online----
//-----------------------------
  $most = explode("|", $config['most_users']);
  $most_total = explode(",", $most[0]);
  $most_registered = explode(",", $most[1]);
  $most_guests = explode(",", $most[2]);
  $update = 0;
  if ($num_total_online > $most_total[0])
  {
    $most_total[0] = $num_total_online;
    $most_total[1] = time();
    $most[0] = $most_total[0].",".$most_total[1];
    $update = 1;
  }
  if ($num_registered_online > $most_registered[0])
  {
    $most_registered[0] = $num_registered_online;
    $most_registered[1] = time();
    $most[1] = $most_registered[0].",".$most_registered[1];
    $update = 1;
  }
  if ($num_guests_online > $most_guests[0])
  {
    $most_guests[0] = $num_guests_online;
    $most_guests[1] = time();
    $most[2] = $most_guests[0].",".$most_guests[1];
    $update = 1;
  }
  if ($update) {
    $config['most_users'] = implode("|", $most);
    $sql = "UPDATE ".SETTINGS_TABLE."
            SET setting_value = '".$config['most_users']."'
            WHERE setting_name = 'most_users'";
    $site_db->query($sql);
  }
  $site_template->register_vars(array(
    "mueo" => $most_total[0],
    "mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]),
    "mueo_registered" => $most_registered[0],
    "mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]),
    "mueo_guests" => $most_guests[0],
    "mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]),
    "lang_mueo" => $lang['mueo'],
    "lang_mueo_total" => $lang['mueo_total'],
    "lang_mueo_date" => $lang['mueo_date'],
    "lang_mueo_registered" => $lang['mueo_registered'],
    "lang_mueo_guests" => $lang['mueo_guests'],
  ));
//End Most Ever Online
  $whos_online = $site_template->parse_template("whos_online");
  $site_template->register_vars("whos_online", $whos_online);
  unset($whos_online);
  unset($prev_user_ids);
  unset($prev_session_ips);
}
?>

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Birthday Mod v1.0
« Reply #48 on: February 19, 2006, 09:18:09 PM »
Ich bin mir jetzt nicht mehr 100% sicher,
aber bei dir lagen doch die Geburtstage in nem anderen Format als in diesem Mod hier vor?
Oder hast du den alten Mod ausgebaut,
und diesen komplett neu eingebaut.
Am Besten wäre es,
wenn man mal nen Überblick bekommen könnte,
in welchem Format die DB Einträge bei dir vorliegen.

Werden auch im Profil keine Geb Einträge angezeigt,
oder fehlt nur die Geburtstagsmeldung in der Index Seite.

Es scheint so, dass beim home.html template sich paar if anweisungen überschneiden.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Birthday Mod v1.0
« Reply #49 on: February 19, 2006, 09:21:33 PM »
ich kenne mich auch nicht mehr aus.
Ich habe in meiner datenbank auch die user_age_birthday drinnen wo auch die ganzen daten der user gespeichert sind sowie die tabellen einträge 'user_birth_year','user_birth_month','user_birth_day'

ich würde so gerne diesen mod nützen..weiß aber total nicht was ich machen kann damit die bisherigen einträge genützt werden können.
;.-(

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Birthday Mod v1.0
« Reply #50 on: February 19, 2006, 10:14:31 PM »
Werden denn im Profil die richtigen Geb Eintrge aus dem Feld user_age_birthday angezeigt?
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Birthday Mod v1.0
« Reply #51 on: February 26, 2006, 03:55:00 PM »
Hi,

hab den Mod auch gerade eingebaut und er funzt super. Ich habe aber eine Frage dazu.

Kann ich in der birthday_message.html auch den Usernamen mit anzeigen lassen??

Wenn ich {user_name} benutze dann wird mir irgendein Name angezeigt aber nicht der vom Geburtstagskind....
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Birthday Mod v1.0
« Reply #52 on: February 26, 2006, 05:48:51 PM »
ersetze das hier:
Code: [Select]
         $site_template->register_vars(array(
                      "birthday_message" => $birthday_message
              ));

durch das:

Code: [Select]
         $site_template->register_vars(array(
                      "birthday_message" => $birthday_message,
                      "birthday_message_name" => $user_info['user_name']
              ));

in der index.php

Dann kannst du {birthday_message_name} für den Namen nutzen.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Birthday Mod v1.0
« Reply #53 on: February 26, 2006, 06:57:35 PM »
Danke!!!
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Birthday Mod v1.0
« Reply #54 on: February 27, 2006, 02:10:52 AM »
How make show a image (gif) on user profile , on B.Day ?

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Birthday Mod v1.0
« Reply #55 on: March 01, 2006, 05:01:13 PM »
Hi IcEcReaM,

gibt es die Möglichkeit eine Fehlermeldung auszugeben wenn jemand ein Alter angibt was über 100 ist???

Ich beziehe mich da auf den Statistic Mod.....wenn jemand dort ein Alter über 100 angegeben hat dann spinnt die Top Age Anzeige...
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Birthday Mod v1.0
« Reply #56 on: March 01, 2006, 07:20:32 PM »
To check if an proper birthday is entered,
and the entered age is not higher than 100:

in includes/functions.php find:
Code: [Select]
   if ($valid == 1 && ($error || (!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $birthday)))) return false;
and insert above:
Code: [Select]
   //check if age is bigger than 100
      $today = getdate (time());
      if (($today['year'] > (intval($birthday_year)+100)) && $birthday_year != "0000") return false;

Not tested, but should work i think.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Birthday Mod v1.0
« Reply #57 on: March 01, 2006, 08:41:43 PM »
Yes, it works....Thanks-...
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline klechoo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Birthday Mod v1.0
« Reply #58 on: March 03, 2006, 10:38:56 PM »
where do I download birthday_install.php  :oops:

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Birthday Mod v1.0
« Reply #59 on: March 07, 2006, 04:58:09 PM »
where do I download birthday_install.php :oops:


i attached it in the first post again.
Don't know why it were removed,
maybe an error when i updated my post with additional steps.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

 

Post your comments here