function lover($wert="*",$player=false) { global $session; if($session['user']['marriedto']==0 || $session['user']['marriedto']==4294967295) { return false; } else { if($player==false) { $sql="SELECT `{$wert}` FROM `accounts` WHERE `acctid`={$session['user']['marriedto']}"; } else { $sql="SELECT `{$wert}` FROM `accounts` WHERE `acctid` = {$player} LIMIT 1"; } $lover=db_fetch_assoc(db_query($sql)); if($lover) { return $lover; } else { return false; } } } function page_footer(){ $forumlink=getsetting("forum","http://lotgd.net/forum"); //$forumlink="http://www.anpera.net/forum/index.php?c=12#"; global $output,$nestedtags,$header,$nav,$session,$REMOTE_ADDR,$REQUEST_URI,$pagestarttime,$dbtimethishit,$dbqueriesthishit,$quickkeys,$template,$logd_version; foreach ($nestedtags as $key => $val){ $output.=""; unset($nestedtags[$key]); } $script.=""; // chat preview mod by Chaosmaker Modified for Ellis Colortags by Devilzimti)- start $appoencode = Load_Tags(); $cases= " "; foreach ($appoencode as $key => $val) { if($val['allowed'] == true) { $cases .= " case \"".$val['code']."\":\n if (openspan) output= output+\"\"; else openspan = true;\n output= output+\"\";\n break;\n "; }else{ $cases .= "\n//".$val['code']." darf hier nicht benutzt werden!\n "; } } $script .= << JS; // chat preview mod by Chaosmaker (Modified for Ellis Colortags by Devilzimti) - end $footer = $template['footer']; //if (mb_strpos($footer,"{paypal}") || mb_strpos($header,"{paypal}")){ $palreplace="{paypal}"; }else{ $palreplace="{stats}"; } //NOTICE //NOTICE Although I will not deny you the ability to remove the below paypal link, I do request, as the author of this software //NOTICE that you leave it in. //NOTICE // $paypalstr = '
'; /* $paypalstr .= '
'; */ /* $paysite = getsetting("paypalemail", ""); if ($paysite != "") { $paypalstr .= '
'; $paypalstr .= '
'; } */ $paypalstr .= '
'; // $paypalstr .= 'Sponsor'; //$footer=str_replace($palreplace,(mb_strpos($palreplace,"paypal")?"":"{stats}").$paypalstr,$footer); //$header=str_replace($palreplace,(mb_strpos($palreplace,"paypal")?"":"{stats}").$paypalstr,$header); //NOTICE //NOTICE Although I will not deny you the ability to remove the above paypal link, I do request, as the author of this software //NOTICE that you leave it in. //NOTICE $header=str_replace("{nav}",$nav,$header); $footer=str_replace("{nav}",$nav,$footer); $header = str_replace("{motd}", motdlink(), $header); $footer = str_replace("{motd}", motdlink(), $footer); if ($session[user][acctid]>0) { $header=str_replace("{mail}",maillink(),$header); $footer=str_replace("{mail}",maillink(),$footer); $header=str_replace("{useronline}",useronline(),$header); $footer=str_replace("{useronline}",useronline(),$footer); $header=str_replace("{chat}","Chat",$header); $footer=str_replace("{chat}","Chat",$footer); }else{ $header=str_replace("{mail}","",$header); $footer=str_replace("{mail}","",$footer); $header=str_replace("{useronline}","",$header); $footer=str_replace("{useronline}","",$footer); $header=str_replace("{chat}","",$header); $footer=str_replace("{chat}","",$footer); } //$header=str_replace("{petition}","Hilfe anfordern",$header); //$footer=str_replace("{petition}","Hilfe anfordern",$footer); if ($session['user']['superuser']>1){ // $sql = "SELECT count(petitionid) AS c,status FROM petitions GROUP BY status"; $sql = "SELECT max(lastact) AS lastact, count(petitionid) AS c,status FROM petitions GROUP BY status"; $result = db_query($sql); $petitions=array(0=>0,1=>0,2=>0); $petitions['unread'] = false; for ($i=0;$i$session['lastlogoff']) $petitions['unread'] = true; } db_free_result($result); // Neue Petitionen; schauen, ob Sternchen nötig ist $petitions['star'] = ''; if ($petitions['unread']) { $sql = 'SELECT petitionid, lastact FROM petitions WHERE lastact > "'.$session['lastlogoff'].'"'; $result = db_query($sql); while ($row = db_fetch_assoc($result)) { if (!$session['petitions'][$row['petitionid']]) { $petitions['star'] = '*'; } } db_free_result($result); } $footer = "
Anfragen$petitions[star]: $petitions[0] Ungelesen, $petitions[1] Gelesen, $petitions[2] Geschlossen.
".$footer; // $footer = "
Anfragen: $petitions[0] Ungelesen, $petitions[1] Gelesen, $petitions[2] Geschlossen.
".$footer; addnav('','viewpetition.php'); } $footer=str_replace("{stats}",charstats(),$footer); $header=str_replace("{stats}",charstats(),$header); $header=str_replace("{script}",$script,$header); if ($session[user][loggedin]){ $footer=str_replace("{source}","Source",$footer); $header=str_replace("{source}","Source",$header); $header=str_replace("{spielregeln}","Spielregeln",$header); $footer=str_replace("{spielregeln}","Spielregeln",$footer); $header=str_replace("{nutzungsbestimmungen}","Nutzungsbestimmungen",$header); $footer=str_replace("{nutzungsbestimmungen}","Nutzungsbestimmungen",$footer); $header=str_replace("{haftungsausschluss}","Haftungsausschluss",$header); $footer=str_replace("{haftungsausschluss}","Haftungsausschluss",$footer); $header=str_replace("{datenschutzerklaerung}","Datenschutzerklärung",$header); $footer=str_replace("{datenschutzerklaerung}","Datenschutzerklärung",$footer); $header=str_replace("{impressum}"," Impressum",$header); $footer=str_replace("{impressum}"," Impressum",$footer); }else{ $footer=str_replace("{source}","Source",$footer); $header=str_replace("{source}","Source",$header); $header=str_replace("{spielregeln}","Spielregeln",$header); $footer=str_replace("{spielregeln}","Spielregeln",$footer); $header=str_replace("{nutzungsbestimmungen}","Nutzungsbestimmungen",$header); $footer=str_replace("{nutzungsbestimmungen}","Nutzungsbestimmungen",$footer); $header=str_replace("{haftungsausschluss}","Haftungsausschluss",$header); $footer=str_replace("{haftungsausschluss}","Haftungsausschluss",$footer); $header=str_replace("{datenschutzerklaerung}","Datenschutzerklärung",$header); $footer=str_replace("{datenschutzerklaerung}","Datenschutzerklärung",$footer); $header=str_replace("{impressum}"," Impressum",$header); $footer=str_replace("{impressum}"," Impressum",$footer); } $footer=str_replace("{copyright}","Copyright 2002 - 2003, Game: Eric Stevens",$footer); $footer=str_replace("{copyright2}","Alresia © 2018 - 2021, Polaris",$footer); $footer=str_replace("{version}", "Version: $logd_version", $footer); $gentime = getmicrotime()-$pagestarttime; $session[user][gentime]+=$gentime; $session[user][gentimecount]++; $dbtimethishit=round($dbtimethishit,2); // $footer=str_replace("{pagegen}","Seitengenerierung: ".round($gentime,2)."s, Schnitt: ".round($session[user][gentime]/$session[user][gentimecount],2)."s - ".round($session[user][gentime],2)."/".round($session[user][gentimecount],2)."".($session[user][superuser]>1?"; DB: $dbqueriesthishit in $dbtimethishit s":"")."",$footer); $footer=str_replace("{pagegen}","Seitengenerierung: ".round($gentime,2)."s, Schnitt: ".round($session[user][gentime]/$session[user][gentimecount],2)."s".($session[user][superuser]>1?"; DB: $dbqueriesthishit in ".$dbtimethishit."s":"")."",$footer); if (mb_strpos($_SERVER['HTTP_HOST'],"lotgd.net")!==false){ $footer=str_replace( "", '', $footer ); } $output=$header.$output.$footer; $session['user']['gensize']+=mb_strlen($output); $session[output]=$output; saveuser(); session_write_close(); //`mpg123 -g 100 -q hit.mp3 2>&1 > /dev/null`; echo $output; // echo $output; exit(); } function popup_header($title="Legend of the Green Dragon"){ global $header; $header.="$title"; $header.=""; $header.=""; $header.=""; $header.="
$title
"; } function popup_footer(){ global $output,$nestedtags,$header,$nav,$session; while (list($key,$val)=each($nestedtags)){ $output.=""; unset($nestedtags[$key]); } $output.="
Copyright 2002, Eric Stevens ♦ Alresia ©2018 Polaris
"; $output=$header.$output; //$session[output]=$output; saveuser(); echo $output; exit(); } function clearoutput(){ global $output,$nestedtags,$header,$nav,$session; $session['allowednavs']=""; $output=""; unset($nestedtags); $header=""; $nav=""; } function soap($input){ if (getsetting("soap",1)){ $sql = "SELECT * FROM nastywords"; $result = db_query($sql); $row = db_fetch_assoc($result); $search = $row['words']; $search = str_replace("a",'[a4@]',$search); $search = str_replace("l",'[l1!]',$search); $search = str_replace("i",'[li1!]',$search); $search = str_replace("e",'[e3]',$search); $search = str_replace("t",'[t7+]',$search); $search = str_replace("o",'[o0]',$search); $search = str_replace("s",'[sz$]',$search); $search = str_replace("k",'c',$search); $search = str_replace("c",'[c(k]',$search); $start = "'(\s|\A)"; $end = "(\s|\Z)'iU"; $search = str_replace("*","([[:alnum:]]*)",$search); $search = str_replace(" ","$end $start", $search); $search = "$start".$search."$end"; //echo $search; $search = explode(" ",$search); //$input = " $input "; return preg_replace($search,"\\1`i$@#%`i\\2",$input); }else{ return $input; } } function saveuser(){ global $session,$dbqueriesthishit; // $cmd = date("Y-m-d H:i:s")." $dbqueriesthishit ".$_SERVER['REQUEST_URI']; // @exec("echo $cmd >> /home/groups/l/lo/lotgd/sessiondata/data/queryusage-".$session['user']['login'].".txt"); if ($session['loggedin'] && $session['user']['acctid']!=""){ $session['user']['output']=$session['output']; $session['user']['allowednavs']=serialize($session['allowednavs']); $session['user']['bufflist']=serialize($session['bufflist']); if (is_array($session['user']['prefs'])) $session['user']['prefs']=serialize($session['user']['prefs']); if (is_array($session['user']['dragonpoints'])) $session['user']['dragonpoints']=serialize($session['user']['dragonpoints']); //$session[user][laston] = date("Y-m-d H:i:s"); $sql="UPDATE accounts SET "; reset($session['user']); $updating = 0; foreach ($session['user'] as $key => $val) { $old_val = $session['user_copy'][$key]; if ($old_val == $val) { continue; } if (is_array($val)){ $sql.="$key='".addslashes(serialize($val))."', "; } else { $sql.="$key='".addslashes($val)."', "; } $updating++; } if ($updating == 0) { return; } $sql = mb_substr($sql,0,mb_strlen($sql)-2); $sql.=" WHERE acctid = ".$session['user']['acctid']; db_query($sql); } } function createstring($array){ if (is_array($array)){ reset($array); while (list($key,$val)=each($array)){ $output.=rawurlencode( rawurlencode($key)."\"".rawurlencode($val) )."\""; } $output=mb_substr($output,0,mb_strlen($output)-1); } return $output; } function createarray($string){ $arr1 = explode("\"",$string); $output = array(); foreach ($arr1 as $val){ $arr2=explode("\"",rawurldecode($val)); $output[rawurldecode($arr2[0])] = rawurldecode($arr2[1]); } return $output; } function output_array($array,$prefix=""){ $output = ""; foreach ($array as $key => $val){ $output.=$prefix."[$key] = "; if (is_array($val)){ $output.="array{\n".output_array($val,$prefix."[$key]")."\n}\n"; }else{ $output.=$val."\n"; } } return $output; } function dump_item($item){ $output = ""; if (is_array($item)) $temp = $item; else $temp = unserialize($item); if (is_array($temp)) { $output .= "array(" . count($temp) . ") {
"; foreach ($temp as $key => $val) { $output .= "'$key' = '" . dump_item($val) . "'\n"; } $output .= "
}"; } else { $output .= $item; } return $output; } function checkday() { global $session,$revertsession,$REQUEST_URI; //output("`#`iChecking to see if you're due for a new day: ".$session[user][laston].", ".date("Y-m-d H:i:s")."`i`n`0"); if ($session['user']['loggedin']){ output("",true); if(is_new_day()){ $session=$revertsession; $session[user][restorepage]=$REQUEST_URI; $session[allowednavs]=array(); addnav("","newday.php"); redirect("newday.php"); } } } function is_new_day(){ global $session; $t1 = gametime(); $t2 = convertgametime(strtotime($session[user][lasthit])); $d1 = date("Y-m-d",$t1); $d2 = date("Y-m-d",$t2); if ($d1!=$d2){ return true; }else{ return false; } } function getgametime(){ // return date("g:i a",gametime()); return date(getsetting('gametimeformat','G:i')); } function getgamedate() { # Get today's date $date = explode('.', date("d.m.0002")); # Calculate new year $date[0] = $date[0]-getsetting('year_difference', 0); return implode('.', $date); } function gametime(){ $time = convertgametime(strtotime(date("r"))); return $time; } function convertgametime($intime){ // Hehe, einen hamwa noch, einen hamwa noch: by JT & anpera $multi = getsetting("daysperday",4); $offset = getsetting("gameoffsetseconds",0); $fixtime = mktime(0,0,0-$offset,date("m")-$multi,date("d"),date("Y")); $time=$multi*(strtotime(date("Y-m-d H:i:s",$intime))-$fixtime); $time=strtotime(date("Y-m-d H:i:s",$time)."+".($multi*date("I",$intime))." hour"); $time=strtotime(date("Y-m-d H:i:s",$time)."-".date("I",$time). " hour"); $time=strtotime(date("Y-m-d H:i:s",$time)."+".(23-$multi)." hour"); return $time; } function timetotomorrow($what="array"){ $time = gametime(); $tomorrow = mktime(0,0,0,date('m',$time),date('d',$time)+1,date('Y',$time)); $secstotomorrow = $tomorrow-$time; $realsecstotomorrow = round($secstotomorrow / (int)getsetting("daysperday",4)); $hours=(int)($realsecstotomorrow/60/60); $minutes=(int)($realsecstotomorrow/60)-$hours*60; $seconds=$realsecstotomorrow-($hours*3600+$minutes*60); if ($what=="hours"){ return($hours); }elseif ($what=="minutes"){ return($minutes); }elseif ($what=="seconds"){ return($seconds); }elseif ($what=="realsecs"){ return($realsecstotomorrow); }else{ return(array( "hours"=>$hours, "minutes"=>$minutes, "seconds"=>$seconds, "realsecs"=>$realsecstotomorrow )); } } function sql_error($sql){ global $session; return output_array($session)."SQL =
$sql
".db_error(LINK); } function ordinal($val){ $exceptions = array(1=>"ten",2=>"ten",3=>"ten",11=>"ten",12=>"ten",13=>"ten"); $x = ($val % 100); if (array_key_exists($x, $exceptions)){ return $val.$exceptions[$x]; }else{ $x = ($val % 10); if (array_key_exists($x, $exceptions)){ return $val.$exceptions[$x]; }else{ return $val."ten"; } } } function addcommentary() { global $_POST, $session, $REQUEST_URI, $_GET, $doublepost; $doublepost = 0; $section = $_POST['section']; $talkline = $_POST['talkline']; if (isset($_POST['insertcommentary'][$section]) && trim($_POST['insertcommentary'][$section]) !== "") { $commentary = str_replace("`n", "", soap($_POST['insertcommentary'][$section])); $y = mb_strlen($commentary); $colorcount = 0; for ($x = 0; $x < $y; $x++) { if (mb_substr($commentary, $x, 1) == "`") { $colorcount++; if ($colorcount >= getsetting("maxcolors", 1000)) { $commentary = mb_substr($commentary, 0, $x) . preg_replace("'[`].'","",mb_substr($commentary, $x)); $x = $y; } $x++; } } if (mb_substr($commentary, 0, 1) != ":" && mb_substr($commentary, 0, 2) != "::" && mb_substr($commentary, 0, 3) != "/me" && mb_substr($commentary, 0, 3) != "/ms" && mb_substr($commentary, 0, 3) != "/em" && $session['user']['drunkenness'] > 0) { //drunk people shouldn't talk very straight. $straight = $commentary; $replacements = 0; while ($replacements / mb_strlen($straight) < ($session['user']['drunkenness']) / 500) { $slurs = array("a" => "aa", "e" => "ee", "f" => "ff", "h" => "hh", "i" => "ij", "l" => "ll", "m" => "mm", "n" => "nn", "o" => "oo", "r" => "rr", "s" => "sh", "u" => "uu", "v" => "vv", "w" => "ww", "y" => "yy", "z" => "zz"); if (e_rand(0, 9)) { srand(e_rand()); $letter = array_rand($slurs); $x = mb_strpos(mb_strtolower($commentary), $letter); if ($x !== false && mb_substr($commentary, $x, 5) != "*hic*" && mb_substr($commentary, max($x - 1, 0), 5) != "*hic*" && mb_substr($commentary, max($x - 2, 0), 5) != "*hic*" && mb_substr($commentary, max($x - 3, 0), 5) != "*hic*" && mb_substr($commentary, max($x - 4, 0), 5) != "*hic*" ) { if (mb_substr($commentary, $x, 1) != mb_strtolower($letter)) { $slurs[$letter] = mb_strtoupper($slurs[$letter]); } else { $slurs[$letter] = mb_strtolower($slurs[$letter]); } $commentary = mb_substr($commentary, 0, $x) . $slurs[$letter] . mb_substr($commentary, $x + 1); $replacements++; } } else { $x = e_rand(0, mb_strlen($commentary)); if (mb_substr($commentary, $x, 5) == "*hic*") { $x += 5; } //output("moved 5 to $x "); if (mb_substr($commentary, max($x - 1, 0), 5) == "*hic*") { $x += 4; } //output("moved 4 to $x "); if (mb_substr($commentary, max($x - 2, 0), 5) == "*hic*") { $x += 3; } //output("moved 3 to $x "); if (mb_substr($commentary, max($x - 3, 0), 5) == "*hic*") { $x += 2; } //output("moved 2 to $x "); if (mb_substr($commentary, max($x - 4, 0), 5) == "*hic*") { $x += 1; } //output("moved 1 to $x "); $commentary = mb_substr($commentary, 0, $x) . "*hic*" . mb_substr($commentary, $x); //output($commentary."`n"); $replacements++; }//end if }//end while //output("$replacements replacements (".($replacements/mb_strlen($straight)).")`n"); while (mb_strpos($commentary, "*hic**hic*")) { $commentary = str_replace("*hic**hic*", "*hic*hic*", $commentary); } }//end if } } //////////////////////////////////////////// // - Schneeballmod // - Idee & Umsetzung: Cassandra (cassandra@leensworld.de) // - Grundlage: rpcmd-Mod von Hadriel // - Bedarf: Weihnachtsspecial von Cassandra/Leen (www.anpera.net) // - Chatbefehl: /schball 'Name' //////////////////////////////////////////// if((substr($commentary,0,8)=='/schball')) { $intro = explode(' ',$commentary,2); $datum = getsetting('weihnacht',''); if ($datum !== 0) $frage = 1; else $frage = 0; $name1 = strtolower($intro[1]); $name2 = strtolower($session['user']['login']); if ($frage == 1) { if($session['user']['schneeball'] < 20 && $session['user']['whereuser'] == 1) //<- Menge festlegen/ Ort festlegen { if(!empty($intro[1]) && $name1 !== $name2) { $res = db_query( 'SELECT name,whereuser,loggedin,laston FROM accounts WHERE login = "'.$intro[1].'" AND location=0 AND laston>"'.date("Y-m-d H:i:s",strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." seconds")).'"'); $row = db_fetch_assoc($res); if($row['loggedin'] > 0 && $row['whereuser'] == 1) { $name = $row['name']; $result1 = db_query( 'SELECT schneerang,schneeball FROM accounts WHERE acctid = '.$session['user']['acctid'].''); $row1 = db_fetch_assoc($result1); switch(random_int(1,5)) { case 1: case 2: case 3: $commentary = '/me `&trifft `#'.$name.'`& mit einem Schneeball und macht damit `#1 Punkt!'; $session['user']['schneerang'] ++; $session['user']['schneeball'] ++; $schneerang = $row1['schneerang'] + 1; $schneeball = $row1['schneeball'] + 1; output('`b`4Schneeball geworfen '.$intro[1].' - Treffer, + 1 Punkt, Punkte insgesamt: '.$schneerang.' , Schneebälle heute: '.$schneeball.'`b`n
',true); break; case 4: $commentary = '/me `&trifft `#'.$name.'`& mit einem Schneeball sehr gut und macht damit `#2 Punkte!'; $session['user']['schneerang'] += 2; $session['user']['schneeball'] ++; $schneerang = $row1['schneerang'] + 2; $schneeball = $row1['schneeball'] + 1; output('`b`4Schneeball geworfen '.$intro[1].' - Treffer, + 2 Punkt, Punkte insgesamt: '.$schneerang.', Schneebälle heute: '.$schneeball.'`b`n
',true); break; case 5: $commentary = '/me `&versucht `#'.$name.'`& mit einem Schneeball zu treffen, wirft aber daneben - das macht `#einen Minuspunkt!'; $session['user']['schneerang'] --; $session['user']['schneeball'] ++; $schneerang = $row1['schneerang'] - 1; $schneeball = $row1['schneeball'] + 1; output('`b`4Schneeball geworfen '.$intro[1].' - kein Treffer, - 1 Punkt, Punkte insgesamt: '.$schneerang.', Schneebälle heute: '.$schneeball.'`b`n
',true); break; } } else { output('`b`4Fehler: '.$intro[1].': Nicht anwesend!`b`n
',true); $commentary = '/me `#hat versucht einen Geist zu treffen!'; } } else { output('`b`4Fehler: Du kannst dich nicht selbst bewerfen!`b`n
',true); $commentary = '/me `#hat versucht sich selbst zu treffen!'; } } else { output('`b`4Fehler: Du kannst keinen einzigen Ball mehr für heute werden oder du befindest dich am falschen Ort!`b`n
',true); $commentary = '/me `#ist zu schwach um den Schneeball sooo weit zu werfen!'; } } else if($frage == 0) { output('`b`4Fehler: Du kannst nur zu Weihnachten dieses Tool nutzen!`b`n
',true); $commentary = '/me `#hat versucht ohne Schnee einen Schneeball zu werfen!'; } } //////////////////////////////////////////// // - Ende des Schneeballmods //////////////////////////////////////////// $commentary = preg_replace_callback("'([^[:space:]]{45,45})([^[:space:]])'", function($matches) { return $matches[1] . ' ' . $matches[2]; }, $commentary); if ($session['user']['drunkenness'] > 50) $talkline = "lallt"; $talkline = translate($talkline); if (mb_substr($commentary,0,1)==':' || mb_substr($commentary,0,3)=='/me' || mb_substr($commentary,0,2)=='/X' || mb_substr($commentary,0,3)=='/ms') { if (mb_substr($commentary,0,3)=='/me') $strpos = 3; elseif (mb_substr($commentary,0,2)=='/X') $strpos = 2; elseif (mb_substr($commentary,0,3)=='/ms') $strpos = 3; elseif (mb_substr($commentary,0,2)=='::') $strpos = 2; else $strpos = 1; if ($session['user']['prefs']['commentemotecolor']) $commentary = mb_substr($commentary,0,$strpos).$session['user']['prefs']['commentemotecolor'].mb_substr($commentary,$strpos); } else { if ($session['user']['prefs']['commenttalkcolor']) $commentary = $session['user']['prefs']['commenttalkcolor'].$commentary; } if ($talkline !== "sagt" && mb_substr($commentary,0,1) !== ":" && mb_substr($commentary,0,2) !== "::" && mb_substr($commentary,0,2) !== "/x" && mb_substr($commentary,0,3) !== "/ms" && mb_substr($commentary,0,3) !== "/me") { $commentary = ":`3 $talkline: \\\"`y$commentary`3\\\""; } $sql = "SELECT commentary.comment,commentary.author FROM commentary WHERE section='$section' ORDER BY commentid DESC LIMIT 1"; $result = db_query($sql) or die(db_error(LINK)); $row = db_fetch_assoc($result); db_free_result($result); if ($row['comment'] !== stripslashes($commentary) || $row['author'] !== $session['user']['acctid']) { $sql = "INSERT INTO commentary (postdate,section,author,comment) VALUES (now(),'$section',".$session['user']['acctid'].",\"$commentary\")"; $postpoints = round(count(explode(' ',$commentary))); if ($session['user']['prefs']['experience'] == 1) { if (count(explode(' ',$commentary)) >= 74) { $session['user']['experience'] += $postpoints * $session['user']['level']; $session['user']['rpgposts']++; } } elseif ($session['user']['prefs']['experience'] == 2) { if (count(explode(' ',$commentary)) >= 74) { $postpoints = round(count(explode(' ',$commentary))); $session['user']['gold'] += round($postpoints * $session['user']['level'] * 1.2); $session['user']['rpgposts']++; } } elseif ($session['user']['prefs']['experience'] == 3) { if (count(explode(' ',$commentary)) >= 74) { $session['user']['gems'] += 2; $session['user']['rpgposts']++; if (count(explode(' ',$commentary)) >= 149) { $session['user']['gems'] += 1; if (count(explode(' ',$commentary)) >= 259) { $session['user']['gems'] += 1; if (count(explode(' ',$commentary)) >= 334) { $session['user']['gems'] += 2; if (count(explode(' ',$commentary)) >= 399) { $session['user']['gems'] += 2; } } } } } } else { if (count(explode(' ',$commentary)) >= 74) { $session['user']['donation'] += 2; $session['user']['rpgposts']++; if (count(explode(' ',$commentary)) >= 149) { $session['user']['donation'] += 2; if (count(explode(' ',$commentary)) >= 199) { $session['user']['donation'] += 2; if (count(explode(' ',$commentary)) >= 274) { $session['user']['donation'] += 2; if (count(explode(' ',$commentary)) >= 399) { $session['user']['donation'] += 2; } } } } } } db_query($sql) or die(db_error(LINK)); return true; } else { $doublepost = 1; } return false; } function viewcommentary($section,$message="Kommentar hinzufügen?",$limit=10,$talkline="sagt") { global $_POST,$session,$REQUEST_URI,$_GET, $doublepost,$appoencode_str; $nobios = array("motd.php"=>true); if ($nobios[basename($_SERVER['SCRIPT_NAME'])]) $linkbios=false; else $linkbios=true; //output("`b".basename($_SERVER['SCRIPT_NAME'])."`b`n"); if ($doublepost) output("`\$`bDoppelpost?`b`0`n"); $message = translate($message); $com=(int)$_GET['comscroll']; $sql = "SELECT commentary.*, accounts.name, accounts.login, accounts.loggedin, accounts.location, accounts.laston FROM commentary INNER JOIN accounts ON accounts.acctid = commentary.author WHERE section = '$section' AND accounts.locked=0 ORDER BY commentid DESC LIMIT ".($com*$limit).",$limit"; $result = db_query($sql) or die(db_error(LINK)); $counttoday=0; for ($i=0;$i < db_num_rows($result);$i++){ $row = db_fetch_assoc($result); $row['comment']=preg_replace("'[`][^".$appoencode_str."`]'","",$row['comment']); $commentids[$i] = $row['commentid']; /* limit posts if (date("Y-m-d",strtotime($row[postdate]))==date("Y-m-d")){ // if ($row[name]==$session[user][name] && mb_substr($section,0,5)!="house") $counttoday++; } */ $x=0; $ft=""; if ($session['user']['prefs']['timestamps']) $timest="`0[".date("H:i",strtotime($row['postdate']))."] "; for ($x=0;mb_strlen($ft)<3 && $x\n`&$row[name]`0\n`& " .str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],$x+mb_strlen($ft))))) ."`0`n"; else $op[$i] = str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],0,$x)))) ."`0\n`&$row[name]`0\n`& " .str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],$x+mb_strlen($ft))))) ."`0`n"; } } /*rp-ms Emote-End*/ elseif ($ft=="::" || $ft=="/me" || $ft==":") { $x = mb_strpos($row['comment'],$ft); if ($x!==false){ if ($linkbios) $op[$i] = $timest.str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],0,$x)))) ."`0\n`&$row[name]`0\n`& " .str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],$x+mb_strlen($ft))))) ."`0`n"; else $op[$i] = $timest.str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],0,$x)))) ."`0\n`&$row[name]`0\n`& " .str_replace("&","&",htmlspecialchars(mb_substr($row['comment'],$x+mb_strlen($ft))))) ."`0`n"; } } if ($op[$i]=="") if ($linkbios) $op[$i] = $timest."`0`&{$row['name']}`0`3 sagt: \"`#" .str_replace("&","&",htmlspecialchars($row['comment']))."`3\"`0`n"; else $op[$i] = $timest."`0`&{$row['name']}`0`3 sagt: \"`#" .str_replace("&","&",htmlspecialchars($row['comment']))."`3\"`0`n"; if ($message=="X") $op[$i]="`0($row[section]) ".$op[$i]; $loggedin=(date("U") - strtotime($row['laston']) < getsetting("LOGINTIMEOUT",4900) && $row['loggedin'] && $row['location']==0); if ($row['postdate']>=$session['user']['recentcomments']) $op[$i]=($loggedin?"> ":"> ").$op[$i]; addnav("",$link); } $i--; $outputcomments=array(); $sect="x"; for (;$i>=0;$i--){ $out=""; if ($session['user']['superuser']>=3 && $message=="X"){ $out.="`0[ Löschen ] "; addnav("","superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI'])); $matches=array(); preg_match("/[(][^)]*[)]/",$op[$i],$matches); $sect=$matches[0]; } //output($op[$i],true); $out.=$op[$i]; if (!is_array($outputcomments[$sect])) $outputcomments[$sect]=array(); array_push($outputcomments[$sect],$out); } ksort($outputcomments); reset($outputcomments); while (list($sec,$v)=each($outputcomments)){ if ($sec!="x") output("`n`b$sec`b`n"); output(implode('',$v),true); } if ($session['user']['loggedin']) { if ($session['user']['prefs']['bigchat'] == 1) { if ($session['user']['prefs']['chatvorschau'] == 0) { output("

`@$message `zFarblegende`&`n




`n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n
",true); addnav("",$REQUEST_URI); } else { output("

`@$message `zFarblegende`&

`n`0
',true); addnav("",$REQUEST_URI); } } elseif ($session['user']['prefs']['bigchat'] == 0) { if ($session['user']['prefs']['chatvorschau']) { output("
`@$message `zFarblegende`&`n `n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n
",true); addnav("",$REQUEST_URI); } else { output("
`@$message `zFarblegende`& `n `n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n
",true); addnav("",$REQUEST_URI); } } } if (db_num_rows($result)>=$limit){ $req = preg_replace("'[&]?c(omscroll)?=([[:digit:]-])*'","",$REQUEST_URI)."&comscroll=".($com+1); //$req = mb_substr($REQUEST_URI,0,mb_strpos($REQUEST_URI,"c="))."&c=$_GET[c]"."&comscroll=".($com+1); $req = str_replace("?&","?",$req); if (!mb_strpos($req,"?")) $req = str_replace("&","?",$req); output("<< Vorherige",true); addnav("",$req); } $req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",$REQUEST_URI)."&comscroll=0"; //$req = mb_substr($REQUEST_URI,0,mb_strpos($REQUEST_URI,"c="))."&c=$_GET[c]"."&comscroll=".($com-1); $req = str_replace("?&","?",$req); if (!mb_strpos($req,"?")) $req = str_replace("&","?",$req); output(" Aktualisieren ",true); addnav("",$req); if ($com>0){ $req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",$REQUEST_URI)."&comscroll=".($com-1); //$req = mb_substr($REQUEST_URI,0,mb_strpos($REQUEST_URI,"c="))."&c=$_GET[c]"."&comscroll=".($com-1); $req = str_replace("?&","?",$req); if (!mb_strpos($req,"?")) $req = str_replace("&","?",$req); output(" Nächste >>",true); addnav("",$req); } //letzten Beitrag editieren $editlink="chat_edit.php?backto=".URLEncode($_SERVER['REQUEST_URI'])."§ion=".$section; output("`n`n Letzten Post editieren",true); addnav("",$editlink); //Beitrag editieren Ende $dellink="chat_delete.php?return=".$REQUEST_URI."§ion=".$section; output(" Letzten Beitrag löschen",true); addnav("",$dellink); db_free_result($result); } function dhms($secs, $dec = false) { if ($dec === false) { $secs = round($secs, 0); } return (int)($secs / 86400) . "d" . (int)($secs / 3600 % 24) . "h" . (int)($secs / 60 % 60) . "m" . ($secs % 60) . ($dec ? mb_substr($secs - (int)$secs, 1) : "") . "s"; } function FormatName($shortname = NULL) { if (empty($shortname)) { return false; } $shortname = mb_strtolower($shortname); $names_array = explode('-', $shortname); for ($i = 0; $i < count($names_array); $i++) { if (strncmp($names_array[$i], 'mc', 2) == 0 || mb_ereg('^[oO]\'[a-zA-Z]', $names_array[$i])) { $names_array[$i][2] = mb_strtoupper($names_array[$i][2]); } $names_array[$i] = ucfirst($names_array[$i]); } $shortname = implode('-', $names_array); return ucwords($shortname); } function getmount($horse = 0) { $sql = "SELECT * FROM mounts WHERE mountid='$horse'"; $result = db_query($sql); if (db_num_rows($result) > 0) { return db_fetch_assoc($result); } else { return array(); } } function debuglog($message, $target = 0) { global $session; $sql = "DELETE from debuglog WHERE date <'" . date("Y-m-d H:i:s", strtotime(date("r") . "-" . (getsetting("expirecontent", 180) / 10) . " days")) . "'"; db_query($sql); $sql = "INSERT INTO debuglog VALUES(0,now(),{$session['user']['acctid']},$target,'" . addslashes($message) . "')"; db_query($sql); } function expbar() { global $session; $exparray = array(1 => 100, 400, 1002, 1912, 3140, 4707, 6641, 8985, 11795, 15143, 19121, 23840, 29437, 36071, 43930, 55000); while (list($key, $val) = each($exparray)) { $exparray[$key] = round($val + ($session['user']['dragonkills'] / 4) * $key * 100, 0); } $exp = $session['user']['experience'] - $exparray[$session['user']['level'] - 1]; $req = $exparray[$session['user']['level']] - $exparray[$session['user']['level'] - 1]; $u = "" . $session['user']['experience'] . "
" . grafbar($req, $exp) . "
"; return ($u); } 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 = "
"; return ($u); } if (file_exists("dbconnect.php")) { require_once "dbconnect.php"; } else { echo "Du must die benötigten Informationen in die Datei \"dbconnect.php.dist\" eintragen und sie unter dem Namen \"dbconnect.php\" speichern."; exit(); } $link = db_pconnect($DB_HOST, $DB_USER, $DB_PASS) or die(db_error($link)); mysqli_set_charset($link, "utf8"); db_select_db($link, $DB_NAME) or die(db_error($link)); define("LINK", $link); $appoencode = Load_Tags(); $appoencode_str = Get_Allowed_Tags(); require_once "translator.php"; session_name("session"); session_start(); function register_global(&$var){ @reset($var); while (list($key,$val)=@each($var)){ global $$key; $$key = $val; } @reset($var); } $session =& $_SESSION['session']; //echo nl2br(HTMLSpecialChars(output_array($session))); //register_global($_SESSION); register_global($_SERVER); if (strtotime(date("r")."-".getsetting("LOGINTIMEOUT",4900)." seconds") > $session['lasthit'] && $session['lasthit']>0 && $session['loggedin']){ //force the abandoning of the session when the user should have been sent to the fields. //echo "Session abandon:".(strtotime("now")-$session[lasthit]); $session=array(); $session['message'].="`nDeine Session ist abgelaufen!`n"; } $session['lasthit']=strtotime(date("r")); $revertsession=$session; if ($PATH_INFO != "") { $SCRIPT_NAME=$PATH_INFO; $REQUEST_URI=""; } if ($REQUEST_URI==""){ //necessary for some IIS installations (CGI in particular) if (is_array($_GET) && count($_GET)>0){ $REQUEST_URI=$SCRIPT_NAME."?"; reset($_GET); $i=0; while (list($key,$val)=each($_GET)){ if ($i>0) $REQUEST_URI.="&"; $REQUEST_URI.="$key=".URLEncode($val); $i++; } }else{ $REQUEST_URI=$SCRIPT_NAME; } $_SERVER['REQUEST_URI'] = $REQUEST_URI; } $SCRIPT_NAME=mb_substr($SCRIPT_NAME,mb_strrpos($SCRIPT_NAME,"/")+1); if (mb_strpos($REQUEST_URI,"?")){ $REQUEST_URI=$SCRIPT_NAME.mb_substr($REQUEST_URI,mb_strpos($REQUEST_URI,"?")); }else{ $REQUEST_URI=$SCRIPT_NAME; } $allowanonymous=array("index.php"=>true,"login.php"=>true,"create.php"=>true,"about.php"=>true,"list.php"=>true,"newpetition.php"=>true,"connector.php"=>true,"farben.php"=>true,"logdnet.php"=>true,"referral.php"=>true,"zeitalger.php"=>true,"news.php"=>true,"motd.php"=>true,"topwebvote.php"=>true,"impressum.php"=>true,"datenschutzerklaerung.php"=>true,"haftungsausschluss.php"=>true,"source.php"=>true); $allownonnav = array("badnav.php"=>true,"stadtplan.php"=>true,"motd.php"=>true,"newpetition.php"=>true,"mail.php"=>true,"topwebvote.php"=>true,"chat.php"=>true,"farben.php"=>true,"source.php"=>true,"impressum.php"=>true,"zeitalter.php"=>true,"datenschutzerklaerung.php"=>true,"haftungsausschluss.php"=>true,"status.php"=>true); if ($session['loggedin']){ $sql = "SELECT * FROM accounts WHERE acctid = '".intval($session['user']['acctid'])."'"; $result = db_query($sql); if (db_num_rows($result)==1){ $session['user']=db_fetch_assoc($result); $session['user_copy'] = $session['user']; $session['output']=$session['user']['output']; $session['user']['dragonpoints']=unserialize($session['user']['dragonpoints']); $session['user']['prefs']=unserialize($session['user']['prefs']); if (!is_array($session['user']['dragonpoints'])) $session['user']['dragonpoints']=array(); if (is_array(unserialize($session['user']['allowednavs']))){ $session['allowednavs']=unserialize($session['user']['allowednavs']); }else{ //depreciated, left only for legacy support. $session['allowednavs']=createarray($session['user']['allowednavs']); } if (!$session['user']['loggedin'] || (0 && (date("U") - strtotime($session['user']['laston'])) > getsetting("LOGINTIMEOUT",4900)) ){ $session=array(); redirect("index.php?op=timeout","Account ist nicht eingeloggt, aber die Session denkt, er ist es."); } }else{ $session=array(); $session['message']="`4Fehler! Dein Login war falsch.`0"; redirect("index.php","Account verschwunden!"); } db_free_result($result); if ($session['allowednavs'][$REQUEST_URI] && !$allownonnav[$SCRIPT_NAME]){ $session['allowednavs']=array(); }else{ if (!$allownonnav[$SCRIPT_NAME]){ redirect("badnav.php","Navigation auf $REQUEST_URI nicht erlaubt"); } } }else{ //if ($SCRIPT_NAME!="index.php" && $SCRIPT_NAME!="login.php" && $SCRIPT_NAME!="create.php" && $SCRIPT_NAME!="about.php"){ if (!$allowanonymous[$SCRIPT_NAME]){ $session['message']="Du bist nicht eingeloggt. Wahrscheinlich ist deine Sessionzeit abgelaufen."; redirect("index.php?op=timeout","Not logged in: $REQUEST_URI"); } } //if ($session['user']['loggedin']!=true && $SCRIPT_NAME!="index.php" && $SCRIPT_NAME!="login.php" && $SCRIPT_NAME!="create.php" && $SCRIPT_NAME!="about.php"){ if ($session['user']['loggedin']!=true && !$allowanonymous[$SCRIPT_NAME]){ redirect("login.php?op=logout"); } $session['counter']++; $nokeeprestore=array("newday.php"=>1,"badnav.php"=>1,"motd.php"=>1,"mail.php"=>1,"newpetition.php"=>1,"impressum.php"=>1,"haftungsausschluss.php"=>1,"zeitalter.php"=>1,"datenschutzerklaerung.php"=>1,"stadtplan.php"=>1,"chat.php"=>1); if (!$nokeeprestore[$SCRIPT_NAME]) { //mb_strpos($REQUEST_URI,"newday.php")===false && mb_strpos($REQUEST_URI,"badnav.php")===false && mb_strpos($REQUEST_URI,"motd.php")===false && mb_strpos($REQUEST_URI,"mail.php")===false $session['user']['restorepage']=$REQUEST_URI; }else{ } if ($session['user']['hitpoints']>0){ $session['user']['alive']=true; }else{ $session['user']['alive']=false; } $session['bufflist']=unserialize($session['user']['bufflist']); if (!is_array($session['bufflist'])) $session['bufflist']=array(); $session['user']['lastip']=$REMOTE_ADDR; if (mb_strlen($_COOKIE['lgi'])<32){ if (mb_strlen($session['user']['uniqueid'])<32){ $u=md5(microtime()); setcookie("lgi",$u,strtotime(date("r")."+365 days")); $_COOKIE['lgi']=$u; $session['user']['uniqueid']=$u; }else{ setcookie("lgi",$session['user']['uniqueid'],strtotime(date("r")."+365 days")); } }else{ $session['user']['uniqueid']=$_COOKIE['lgi']; } $url = "http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['REQUEST_URI']); $url = mb_substr($url,0,mb_strlen($url)-1); if (mb_substr($_SERVER['HTTP_REFERER'],0,mb_strlen($url))==$url || $_SERVER['HTTP_REFERER']==""){ }else{ $sql = "SELECT * FROM referers WHERE uri='{$_SERVER['HTTP_REFERER']}'"; $result = db_query($sql); $row = db_fetch_assoc($result); db_free_result($result); $site = str_replace("http://","",$_SERVER['HTTP_REFERER']); if (mb_strpos($site,"/")) $site = mb_substr($site,0,mb_strpos($site,"/")); if ($row['refererid']>""){ $sql = "UPDATE referers SET count=count+1,last=now(),site='".addslashes($site)."' WHERE refererid='{$row['refererid']}'"; }else{ $sql = "INSERT INTO referers (uri,count,last,site) VALUES ('{$_SERVER['HTTP_REFERER']}',1,now(),'".addslashes($site)."')"; } db_query($sql); } if ($_COOKIE['template']!="") $templatename=$_COOKIE['template']; if ($templatename=="" || !file_exists("templates/$templatename")) $templatename="alresia.htm"; $template = loadtemplate($templatename); //tags that must appear in the header $templatetags=array("title","headscript","script"); foreach ($templatetags AS $val) { if (mb_strpos($template['header'],"{".$val."}")===false) $templatemessage.="You do not have {".$val."} defined in your header\n"; } //tags that must appear in the footer $templatetags=array(); foreach ($templatetags AS $val) { if (mb_strpos($template['footer'],"{".$val."}")===false) $templatemessage.="You do not have {".$val."} defined in your footer\n"; } //tags that may appear anywhere but must appear //touch the copyright and we will force your server to be shut down $templatetags=array("nav","stats","motd","copyright","source"); foreach ($templatetags AS $val) { if (mb_strpos($template['header'],"{".$val."}")===false && mb_strpos($template['footer'],"{".$val."}")===false) $templatemessage.="You do not have {".$val."} defined in either your header or footer\n"; } if ($templatemessage!=""){ echo "Du hast einen oder mehrere Fehler in deinem Template!
".nl2br($templatemessage); $template=loadtemplate("alresia.htm"); } $logd_version = "0.9.7+jt ext (GER)"; $session['user']['laston']=date("Y-m-d H:i:s"); $playermount = getmount($session['user']['hashorse']); $titles = array( 0=>array("Bauernjunge","Bauernmädchen"), 1=>array("Knecht", "Magd"), 2=>array("Bauer", "Bäuerin"), 3=>array("Grossbauer", "Grossbäuerin"), 4=>array("Spurenleser","Spurenleserin"), 5=>array("Jäger","Jägerin"), 6=>array("Gutshofverwalter","Gutshofverwalterin"), 7=>array("Gutsherr","Gutsherrin"), 8=>array("Bürger","Bürgerin"), 9=>array("Gladiator","Gladiatorin"), 10=>array("Legionär","Legionärin"), 11=>array("Centurio","Centurioness"), 12=>array("Meister","Meisterin"), 13=>array("Ratsherr", "Ratsfrau"), 14=>array("Verwalter","Verwalterin"), 15=>array("Bürgermeister", "Bürgermeisterin"), 16=>array("Major", "Major"), 17=>array("General", "General"), 18=>array("Edler", "Edle"), 19=>array("Ritter", "Ritterin"), 20=>array("Junker", "Junkerin"), 21=>array("Freiherr", "Freifrau"), 22=>array("Baron", "Baronin"), 23=>array("Fürst", "Fürstin"), 24=>array("Grossfürst", "Grossfürstin"), 25=>array("Herzog", "Herzogin"), 26=>array("Graf", "Gräfin"), 27=>array("Prinz", "Prinzessin"), 28=>array("Kronprinz", "Kronprinzessin"), 29=>array("König", "Königin"), 30=>array("Kaiser", "Kaiserin"), 31=>array("Drachentöter","Drachentöterin"), 32=>array("Bischof","Bischöfin"), 33=>array("Papst", "Päpstin"), 34=>array("Seele", "Seele"), 35=>array("Seliger", "Selige"), 36=>array("Heiliger", "Heilige"), 37=>array("Engel", "Engel"), 38=>array("Erzengel", "Erzengel"), 39=>array("Kraft", "Kraft"), 40=>array("Macht", "Macht"), 41=>array("Herrschaft", "Herrschaft"), 42=>array("Thron", "Thron"), 43=>array("Seraphim", "Seraphim"), 44=>array("Cherubim", "Cherubim"), 45=>array("Titan","Titanin"), 46=>array("Erztitan","Erztitanin"), 47=>array("Halbgott", "Halbgöttin"), 48=>array("Untergott","Untergöttin") ); if ($session['user']['donation']<=0) $session['user']['donation']=0; if ($session['user']['rpgposts']<=0) $session['user']['rpgposts']=0; $beta = (getsetting("beta",0) == 1 || $session['user']['beta']==1); ?>
SELECT motddate FROM motd ORDER BY motditem DESC LIMIT 1