<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

function getuserid($nickname) {
	$ds=mysql_fetch_array(safe_query("SELECT userID FROM ".PREFIX."user WHERE nickname='$nickname'"));
	return $ds[userID];
}

function getnickname($userID) {
	$ds=mysql_fetch_array(safe_query("SELECT nickname FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[nickname]);
}

function getuserdescription($userID) {
	$ds=mysql_fetch_array(safe_query("SELECT userdescription FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[userdescription]);
}

function getfirstname($userID) {
	$ds=mysql_fetch_array(safe_query("SELECT firstname FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[firstname]);
}

function getlastname($userID) {
	$ds=mysql_fetch_array(safe_query("SELECT lastname FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[lastname]);
}

function getbirthday($userID) {
	$ds=mysql_fetch_array(safe_query("SELECT birthday FROM ".PREFIX."user WHERE userID='$userID'"));
	return date("d.m.Y", $ds[birthday]);
}

function gettown($userID) {
	$ds=mysql_fetch_array(safe_query("SELECT town FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[town]);
}

function getemail($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT email FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[email]);
}

function gethomepage($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT homepage FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[homepage]);
}

function geticq($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT icq FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[icq]);
}

function getcountry($userID) {
  $ds=mysql_fetch_array(safe_query("SELECT country FROM ".PREFIX."user WHERE userID='$userID'"));
	return htmlspecialchars($ds[country]);
}

function getuserpic($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT userpic FROM ".PREFIX."user WHERE userID='$userID'"));
    if(!$ds[userpic]) $userpic="nouserpic.gif";
    else $userpic=$ds[userpic];
	return $userpic;
}

function getavatar($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT avatar FROM ".PREFIX."user WHERE userID='$userID'"));
    if(!$ds[avatar]) $avatar="noavatar.gif";
    else $avatar=$ds[avatar];
	return $avatar;
}

function getsignatur($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT usertext FROM ".PREFIX."user WHERE userID='$userID'"));
	$clearsignatur=strip_tags($ds[usertext]);
	return $clearsignatur;
}

function getregistered($userID) {
    $ds=mysql_fetch_array(safe_query("SELECT registerdate FROM ".PREFIX."user WHERE userID='$userID'"));
	$date=date("d.m.Y", $ds[registerdate]);
	return $date;
}

function usergroupexists($userID) {
    $anz=mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."user_groups WHERE userID='$userID'"));
	return $anz;
}

function wantmail($userID) {
    $anz=mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."user WHERE userID='$userID' AND mailonpm='1'"));
	return $anz;
}

function isbuddy($userID, $buddy) {
    $anz=mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID'"));
	if($anz) {
	    $ergebnis=safe_query("SELECT * FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID'");
		$ds=mysql_fetch_array($ergebnis);
	    if($ds[banned]==0) return 1;
	}
	else return 0;
}
?>