| Ich versuchs mal zusammen zu schnibbeln
 
 $this->bbcode_second_pass_code('', 'function navinfos($locate){                // Navinfos by Raven
 $vstats = " ";
 if ($locate=="" || $locate==" "){
 $locate = 0;
 }
 $sql="SELECT info FROM navigation WHERE locate = ".$locate."";
 $result=db_query($sql);
 $anzahl=db_num_rows($result);
 if ($anzahl==0){
 }else{
 $row=db_fetch_assoc($result);
 }
 if ($row[info]==1){            // Info oben Anzeigen
 $vstats=infovstats();
 }else if($row[info]==2){        // Mitspieler oben Anzeigen
 $vstats=infobuddy($locate);
 }
 if ($locate==0){            // z.B. Startseite dann anzeigen
 $vstats=infovstats();
 }
 db_free_result($result);
 return $vstats;
 }
 
 
 function navbuddy($locate){                // navbuddy by Raven
 $buddy = " ";
 if ($locate=="" || $locate==" "){
 $locate = 0;
 }
 $sql="SELECT buddy FROM navigation WHERE locate = ".$locate."";
 $result=db_query($sql);
 $anzahl=db_num_rows($result);
 if ($anzahl==0){
 }else{
 $row=db_fetch_assoc($result);
 }
 if ($row[buddy]==1){            // Mitspieler unten Anzeigen
 $buddy=infobuddy($locate);
 }else if($row[buddy]==2){        // Infos unten Anzeigen
 $buddy=infovstats();
 }
 if ($locate>=500){            // Wohnhäuser immer buddy Anzeige
 $buddy=infobuddy($locate);    // Wohnhäuser haben locate 500 plus Hausnummer
 }
 db_free_result($result);
 return $buddy;
 }
 
 function cstat($locate){                // by Raven
 $cstat = " ";
 if ($locate=="" || $locate==" "){
 $locate = 0;
 }
 $sql="SELECT stat FROM navigation WHERE locate = ".$locate."";
 $result=db_query($sql);
 $anzahl=db_num_rows($result);
 if ($anzahl==0){
 }else{
 $row=db_fetch_assoc($result);
 }
 if ($row[stat]==1){            // Spielerstats unten anzeigen
 $cstat=framestat(charstats());    // Rahmen setzen für Spielerstatistiken
 }else if ($row[stat]==2){
 $cstat=framestat(charstats_small());    // Kleine Anzeige bei 2
 }else if ($locate==0){            // z.B. Startseite dann anzeigen
 $cstat=framestat(charstats());    // Rahmen setzen für Spielerstatistiken
 }else{
 $cstat="<table height='250px' border='0'><tr><td></td></tr></table>"; // Das Bild wird sonst zusammengedrückt
 }
 db_free_result($result);
 return $cstat;
 } ')
 
 $this->bbcode_second_pass_code('', 'function charstats(){
 global $session, $races;
 $u =& $session[user];
 if ($session[loggedin]){
 # location setting start
 set_current_position();
 # location setting end')
 
 $this->bbcode_second_pass_code('', '}
 $footer=str_replace("{stats}",charstats(),$footer);
 $header=str_replace("{stats}",charstats(),$header);
 $footer=str_replace("{useronline}",locationstats(),$footer);
 $header=str_replace("{useronline}",locationstats(),$header);')
 
 $this->bbcode_second_pass_code('', 'function set_location($pos,$url) {
 if ($session[user][game_position] != $pos) {
 set_current_position($pos);
 addnav("",$url);
 redirect($url);
 }
 }')
 
 $this->bbcode_second_pass_code('', 'function set_current_position($pos=0) {
 global $session;
 
 # pos:    1 -  500 = normale php scripts einheit
 # pos:  500 - 1000 = spezielle php locations (php datei mit verschiedenen gegenden, wie z.b gardens.php)
 # pos: 1000 < XXX  = Häuser der Bewohner
 
 if ($pos == 0) {
 if($PHP_SELF == ""){ $PHP_SELF = $_SERVER["PHP_SELF"]; }
 $PHP_SELF = str_replace("//", "/", $PHP_SELF);
 
 $sql="SELECT id,filename,description FROM game_location WHERE filename = '$PHP_SELF'";
 $result = db_query($sql) or die(db_error(LINK));
 if (db_num_rows($result)==0){
 $sql="INSERT INTO game_location (id,filename,description) VALUES ('','$PHP_SELF','-')";
 $result = db_query($sql) or die(db_error(LINK));
 }
 $sql="SELECT id,filename,description FROM game_location WHERE filename = '$PHP_SELF'";
 $result = db_query($sql) or die(db_error(LINK));
 $row = db_fetch_assoc($result);
 $session[user][game_position] = $row[id];
 $sql="UPDATE accounts SET game_position = " . $row[id] . " WHERE acctid = " . $session[user][acctid];
 $result = db_query($sql) or die(db_error(LINK));
 } else {
 $sql="SELECT id,filename,description FROM game_location WHERE id = $pos";
 $result = db_query($sql) or die(db_error(LINK));
 if (db_num_rows($result)==0){
 $sql="INSERT INTO game_location (id,filename,description) VALUES ($pos,'-speciallocation-','-')";
 $result = db_query($sql) or die(db_error(LINK));
 }
 $session[user][game_position] = $pos;
 $sql="UPDATE accounts SET game_position = " . $pos . " WHERE acctid = " . $session[user][acctid];
 $result = db_query($sql) or die(db_error(LINK));
 }
 }')
 
 $this->bbcode_second_pass_code('', 'function locationstats() {
 global $session;
 $u =& $session[user];
 if ($session[loggedin]){
 return infobuddy($session[user][game_position]);
 } else {
 return infovstats();
 }
 }')
 
 $this->bbcode_second_pass_code('', 'function infovstats(){
 global $session;                // infostats by Raven
 $session[event][karneval]=false;
 $session[event][wahlen]=false;
 $session[event][wahlwert]=-1;
 $sql = "SELECT count(*) as anz from accounts
 WHERE locked = 0
 AND loggedin = 1
 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."'
 ";
 $result=db_query($sql);
 $go=db_fetch_assoc($result);
 $anz=$go[anz];
 db_free_result($result);
 $days = getsetting("daysalive",0);
 $sql = "SELECT text, from_date, to_date FROM events WHERE to_date >= $days";
 $result=db_query($sql);
 $anzahl=db_num_rows($result);
 $event=array();
 $aktuell=0;
 for ($i=1;$i<=$anzahl;$i++){
 $row=db_fetch_assoc($result);
 if ($row[from_date] <= $days){       // aktuelle Events
 $restzeit=(int)$row[to_date]-$days;
 if ($restzeit==0){
 $text = "(bis heute)";
 }else if ($restzeit==1){
 $text = "(noch 1 Tag)";
 }else{
 $text = "(noch ".$restzeit." Tage)";
 }
 $event[$i]="".$row[text]." ".$text."";
 if ($row[text]=="Karneval") $session[event][karneval]=true;
 if ($row[text]=="Wahlen"){
 $session[event][wahlen]=true;
 $session[event][wahlwert]=$restzeit;
 }
 $aktuell++;
 }else{                               // zukünftige Events
 $dauer = $row[from_date]-$days;
 if ($row[text]=="Wahlen") $session[event][wahlwert]=$dauer;
 }
 }
 db_free_result($result);
 $time = gametime();
 $tomorrow = strtotime(date("Y-m-d H:i:s",$time)." + 1 day");
 $tomorrow = strtotime(date("Y-m-d 00:00:00",$tomorrow));
 $secstotomorrow = $tomorrow-$time;
 $realsecstotomorrow = round($secstotomorrow / getsetting("daysperday",4));
 $morgen = date("G\\h, i\\m, s\\s",strtotime("1990-01-01 00:00:00 + $realsecstotomorrow seconds"));
 $wetter=getsetting("weather","unbekannt");
 $vstats="<table border=0 width=152px><tr><td>";
 $vstats.="`6`bDatum:`b<br>`^" . getgameday() . " des " . getgamemonth() . " `nim Jahre " . getgameyear() . " " . getgameyearname() . " `0";
 $vstats.="<br>`6`bUhrzeit in Minas Tirith:`b<br>`^ ".getgametime()." `^Uhr`0";
 $vstats.="<br>`6`bWochentag:`b<br>`^".getdayofweek()."`0";
 $vstats.="<br>`6`bNächster Spieltag:`b`0";
 $vstats.="<br>`^".$morgen."`0";
 $vstats.="<br>`6`bAnzahl Online:`b`0";
 $vstats.="<br>`^".$anz." Spieler";
 $vstats.="<br>`6`bDas Wetter:`b`0";
 $vstats.="<br>`^".$wetter."";
 if ($aktuell>0){
 $vstats.="<br><br>`$`bEvents aktuell`b`0";
 for ($i=1;$i<=$aktuell;$i++){
 $vstats.="<br>`4".$event[$i]."`0";
 }
 }
 $vstats.="</td></tr></table>";
 #$vstats=framestat($vstats);        // Rahmen setzen
 $vstats=appoencode($vstats,true);
 return $vstats;
 } ')
 
 $this->bbcode_second_pass_code('', 'function infobuddy($locate){                // infobuddy by Raven
 global $session;
 
 $useronline=appoencode(templatereplace("statstart")
 .templatereplace("stathead",array("title"=>"Hier online:")),true);
 
 // Routine um Anwesende festzustellen
 $buddy="<table border=0 width='152'><tr><td></td><td></td><td><b>`6Hier online:`0</b>";
 if ($locate == 2) {
 $cityid = $session[user][game_city];
 $sql = "SELECT name,login,sex FROM accounts
 WHERE game_position = ".$locate."
 AND locked = 0
 AND loggedin = 1
 AND game_city = $cityid
 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."'
 ";
 } else {
 $sql = "SELECT name,login,sex FROM accounts
 WHERE game_position = ".$locate."
 AND locked = 0
 AND loggedin = 1
 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."'
 ";
 }
 $result=db_query($sql);
 $anzrows = db_num_rows($result);
 if ($anzrows==0){
 $buddy.="<br><i>`&Niemand</i></td></tr></table>";
 }else{
 $buddy.="</td></tr>";
 for($i=1;$i<=$anzrows;$i++){
 $row=db_fetch_assoc($result);
 if ($row[sex] == "1") {
 $headpic = "images/uo_female.gif";
 } else {
 $headpic = "images/uo_male.gif";
 }
 $buddy.="<tr><td><a href=\"mail.php?op=write&to=".rawurlencode($row['login'])."\"
 target=\"_blank\"
 onClick=\"".popup("mail.php?op=write&to=".rawurlencode($row['login'])."").";
 return false;\">
 <img src='images/newscroll.GIF' width='16' height='16' alt='Mail schreiben' border='0'>
 </a></td>";
 $buddy.="<td><a href=\"bio.php?char=".rawurlencode($row['login'])."&ret=".URLEncode($_SERVER['REQUEST_URI'])."\">
 <img src='" . $headpic . "' alt='" . $row[sex] . "' width='16' height='16' alt='Bio lesen' border='0'>
 </a>`0</td><td>".$row[name]."</td></tr>";
 addnav("","bio.php?char=".rawurlencode($row['login'])."&ret=".URLEncode($_SERVER['REQUEST_URI'])."");
 }
 $buddy.="</table>";
 }
 #$buddy=framestat($buddy);            // Rahmen setzen
 $buddy=appoencode($buddy,true);
 return $buddy;
 }')
 
 $this->bbcode_second_pass_code('', 'function grafbar($full,$left,$width=70,$height=5) {
 $col2="#000000";
 if ($left<=0){
 $col="#000000";
 }else if ($left<$full/4){
 $col="#FF0000";
 }else if ($left<$full/2){
 $col="yellow";
 }else if ($left>=$full){
 $col="#00AA00";
 $col2="#00AA00";
 }else{
 $col="#00FF00";
 }
 if($full==0) $full = 1;
 $u = "<table cellspacing=\"0\" style=\"border: solid 1px #000000\" width=\"$width\" height=\"$height\"><tr><td width=\"" . ($left / $full * 100) . "%\" bgcolor=\"$col\"></td><td width=\"".(100-($left / $full * 100)) ."%\" bgcolor=\"$col2\"></td></tr></table>";
 return($u);
 }')
 
 $this->bbcode_second_pass_code('', 'INSERT INTO `accounts` ADD `locate` int(11) NOT NULL default '0';')
 
 $this->bbcode_second_pass_code('', 'INSERT INTO `accounts` ADD `game_position` varchar(250) NOT NULL default '';')
 
 $this->bbcode_second_pass_code('', 'CREATE TABLE `navigation` (
 `locate` int(11) NOT NULL default '0',
 `buddy` tinyint(4) NOT NULL default '0',
 `info` tinyint(4) NOT NULL default '0',
 `stat` tinyint(4) NOT NULL default '0',
 `stat1` tinyint(4) NOT NULL default '0',
 `description` varchar(30) default NULL,
 `maxonline` smallint(4) NOT NULL default '0',
 `filename` varchar(250) NOT NULL default '0',
 `id` int(11) NOT NULL default '0',
 PRIMARY KEY  (`locate`,`id`)
 ) TYPE=MyISAM;')
 
 $this->bbcode_second_pass_code('', 'CREATE TABLE `game_location` (
 `id` int(11) NOT NULL auto_increment,
 `filename` varchar(250) NOT NULL default '',
 `description` varchar(250) NOT NULL default '',
 PRIMARY KEY  (`id`)
 ) TYPE=MyISAM AUTO_INCREMENT=461 ;')
 
 Ich hoff ich hab jetzt nichts vergessen
 _________________
 // If today was a perfect Day, there will be no need for tommorow... //
 
 
 |