LoGD Standardrelease steht hier zum Download zur Verfügung!
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// 16062004
/*
2021-06-05 aragon bugfix php8
2021-07-04 aragon bugfix php8
2021-08-06 aragon split common: pm/mail, settings, addcommentary, account-related, titles, template-system
2021-08-07 aragon php8 fix, reduced warnings
2021-08-12 aragon split appoencode
2023-05-18 aragon php8 fix
2023-05-27 aragon redirect folter.php -> commented, needs to be fixed
2023-08-13 aragon forest, also minor fixes
2024-04-22 aragon forest sort
2024-05-04 aragon includeIfExists
2024-05-05 aragon bugfixes, addnews
2024-05-06 aragon fixes on functions, split messageboard
*/
function includeIfExists($file)
{
if (file_exists($file)) {
include_once $file;
}
}
require_once "dbwrapper.php";
require_once "anticheat.php";
require_once "lib/common/account.php";
require_once "lib/common/addcommentary.php";
require_once "lib/common/laston.php";
require_once "lib/common/mail.php";
require_once "lib/common/messageboard.php";
require_once "lib/common/saveuser.php";
require_once "lib/common/showform.php";
require_once "lib/common/settings.php";
require_once "lib/common/titles.php";
require_once "lib/common/viewcommentary.php";
require_once "lib/template/addnav.php";
require_once "lib/template/appoencode.php";
require_once "lib/template/bars.php";
require_once "lib/template/charstats.php";
require_once "lib/template/loadtemplate.php";
require_once "lib/template/output.php";
require_once "lib/template/page_footer.php";
require_once "lib/template/page_header.php";
require_once "lib/template/popup.php";
require_once "lib/template/templatereplace.php";
require_once "lib/template/embeddedaudio.php";
$pagestarttime = getmicrotime();
$nestedtags = array();
$output = "";
function pvpwarning($dokill = false)
{
global $session;
$days = getsetting("pvpimmunity", 5);
$exp = getsetting("pvpminexp", 1500);
if (
$session['user']['age'] <= $days &&
$session['user']['dragonkills'] == 0 &&
$session['user']['user']['pk'] == 0 &&
$session['user']['experience'] <= $exp
) {
if ($dokill) {
output("`\$Warnung!`^ Da du selbst noch vor PvP geschützt warst, aber jetzt einen anderen Spieler angreifst, hast du deine Immunität verloren!!`n`n");
$session['user']['pk'] = 1;
} else {
output("`\$Warnung!`^ Innerhalb der ersten $days Tage in dieser Welt, oder bis sie $exp Erfahrungspunkte gesammelt haben, sind alle Spieler vor PvP-Angriffen geschützt. Wenn du einen anderen Spieler angreifst, verfällt diese Immunität für dich!`n`n");
}
}
}
function safeescape($input)
{
return preg_replace('/([^\\\\])(["\'])/s', "\\1\\\\\\2", $input);
}
function isnewday($level)
{
global $session;
if ($session['user']['superuser'] < $level) {
$n = $session['user']['name'];
clearnav();
$session['output'] = "";
page_header("FREVEL!");
$session['bufflist']['angrygods'] = array(
"name" => "`^Die Götter sind wütend!",
"rounds" => 10,
"wearoff" => "`^Es ist den Göttern langweilig geworden, dich zu quälen.",
"minioncount" => $session['user']['level'],
"maxgoodguydamage" => 2,
"effectmsg" => "`7Die Götter verfluchen dich und machen dir `^{damage}`7 Schaden!",
"effectnodmgmsg" => "`7Die Götter haben beschlossen, dich erstmal nicht zu quälen.",
"activate" => "roundstart",
"survivenewday" => 1,
"newdaymessage" => "`6Die Götter sind dir immer noch böse!"
);
output("für den Versuch, die Götter zu betrügen, wurdest du niedergeschmettert!`n`n");
output("`\$Ramius, der Gott der Toten`) erscheint dir in einer Vision. Dafür, dass du versucht hast, deinen Geist" .
" mit seinem zu messen, sagt er dir wortlos, dass du keinen Gefallen mehr bei ihm hast.`n`n");
addnews("`&für den Versuch, die Götter zu besudeln, wurde {$n} zu Tode gequält! (Hackversuch gescheitert).");
$session['user']['hitpoints'] = 0;
$session['user']['alive'] = 0;
$session['user']['soulpoints'] = 0;
$session['user']['gravefights'] = 0;
$session['user']['deathpower'] = 0;
$session['user']['experience'] *= 0.75;
addnav("Tägliche News", "news.php");
page_footer();
$sql = "SELECT acctid FROM accounts WHERE superuser>=3";
$result = db_query($sql);
while ($row = db_fetch_assoc($result)) {
systemmail(
$row['acctid'],
"`#{$n}`# hat versucht, Superuser-Seiten zu hacken!",
"böse(r), böse(r), böse(r) {$n}, du bist ein Hacker!"
);
}
exit();
}
}
function forest($noshowmessage = false)
{
global $session, $playermount;
$conf = unserialize(gettexts('donationconfig'));
if (($conf['healer'] ?? false) || $session['user']['acctid'] == getsetting("hasegg", 0)) {
addnav("H?Golindas Hütte", "healer.php");
} else {
addnav("H?Hütte des Heilers", "healer.php");
}
addnav("B?Etwas zum Bekämpfen suchen", "forest.php?op=search");
if ($session['user']['level'] > 1) {
addnav("H?Herumziehen", "forest.php?op=search&type=slum");
}
addnav("N?Nervenkitzel suchen", "forest.php?op=search&type=thrill");
//if ($session['user']['hashorse']>=2) addnav("D?Dark Horse Tavern","forest.php?op=darkhorse");
if (($playermount['tavern'] ?? 0) > 0) {
addnav("D?Nimm {$playermount['mountname']} zur Dark Horse Taverne", "forest.php?op=darkhorse");
if ($conf['castle']) {
addnav("B?Nimm {$playermount['mountname']} zur Burg", "forest.php?op=castle");
}
}
addnav("Z?Zurück zum Dorf", "village.php");
addnav("", "forest.php");
if (($session['user']['level'] >= 15 || ($conf['dragonvalley'] ?? 0)) && $session['user']['seendragon'] == 0) {
//addnav("G?`@Den Grünen Drachen suchen","forest.php?op=dragon");
addnav("`@Reite ins Drachental", "forest.php?op=drachental");
}
addnav("Spatzenfelsen", "schnellbank.php");
addnav("Sonstiges");
addnav("G?Geheimnisvolle Lichtung", "ritual.php");
addnav("P?Plumpsklo", "outhouse.php");
if ($session['user']['turns'] <= 1) {
addnav("Hexenhaus", "hexe.php");
}
if ($noshowmessage != true) {
output("`c`7`bDer Wald`b`0`c");
output("Der Wald, Heimat von bösartigen Kreaturen und üblen Übeltätern aller Art.`n`n");
output("Die dichten Blätter des Waldes erlauben an den meisten Stellen nur wenige Meter Sicht. ");
output("Die Wege würden dir verborgen bleiben, hättest du nicht ein so gut geschultes Auge." .
" Du bewegst dich so leise wie eine milde Brise über den dicken Humus, der den Boden bedeckt." .
" Dabei versuchst du es zu vermeiden auf dünne Zweige oder irgendwelche der ausgebleichten Knochenstücke" .
" zu treten, welche den Waldboden spicken. Du verbirgst deine Gegenwart vor den abscheulichen Monstern," .
" die den Wald durchwandern.");
if ($session['user']['turns'] <= 1) {
output(" In der Nähe siehst du wieder den Rauch aus dem Kamin eines windschiefen Hexenhäuschens aufsteigen," .
" von dem du schwören könntest, es war eben noch nicht da. ");
}
output("`n`n ");
viewcommentary("forest", "Rede mit den anderen:", 25, "sagt");
}
iterateForestSpecials();
}
function iterateForestSpecials()
{
global $session;
if ($session['user']['superuser'] > 1) {
output("`n`nSUPERUSER Specials:`n");
$d = dir("special");
$files = array();
while (false !== ($entry = $d->read())) {
// Skip non php files (including directories)
// Skip any hidden files
if (strpos($entry, ".php") === false || substr($entry, 0, 1) == ".") {
continue;
}
$files[] = $entry;
}
sort($files);
foreach ($files as $entry) {
output("<a href='forest.php?specialinc=$entry'>$entry</a>`n", true);
addnav("", "forest.php?specialinc=$entry");
}
}
}
function borkalize($in)
{
$out = $in;
$out = str_replace(". ", ". Bork bork. ", $out);
$out = str_replace(", ", ", bork, ", $out);
$out = str_replace(" h", " hoor", $out);
$out = str_replace(" v", " veer", $out);
$out = str_replace("g ", "gen ", $out);
$out = str_replace(" p", " pere", $out);
$out = str_replace(" qu", " quee", $out);
$out = str_replace("n ", "nen ", $out);
$out = str_replace("e ", "eer ", $out);
$out = str_replace("s ", "ses ", $out);
return $out;
}
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return (float)$usec + (float)$sec;
}
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
mt_srand(intval(make_seed()));
function e_rand($min = false, $max = false)
{
if ($min === false) {
return mt_rand();
}
$min *= 1000;
if ($max === false) {
return round(mt_rand($min) / 1000, 0);
}
$max *= 1000;
if ($min == $max) {
return round($min / 1000, 0);
}
// if ($min==0 && $max==0) return 0; //do NOT ask me why this line can be executed, it makes no sense, but it *does* get executed.
if ($min < $max) {
return round(@mt_rand($min, $max) / 1000, 0);
} elseif ($min > $max) {
return round(@mt_rand($max, $min) / 1000, 0);
}
}
function is_email($email)
{
return preg_match("/[[:alnum:]_.-]+[@][[:alnum:]_.-]{2,}.[[:alnum:]_.-]{2,}/", $email);
}
function checkban($login = false)
{
global $session, $link;
if ($session['banoverride'] ?? false) {
return false;
}
if ($login === false) {
$ip = $_SERVER['REMOTE_ADDR'];
$id = $_COOKIE['lgi'];
//echo "<br>Orig output: $ip, $id<br>";
} else {
$sql = "SELECT lastip,uniqueid,banoverride FROM accounts WHERE login='$login'";
$result = db_query($sql) or die(db_error($link));
$row = db_fetch_assoc($result);
if ($row['banoverride']) {
$session['banoverride'] = true;
//echo "`nYou are absolved of your bans, son.";
return false;
} else {
//echo "`nNo absolution here, son.";
}
db_free_result($result);
$ip = $row['lastip'];
$id = $row['uniqueid'];
//echo "<br>Secondary output: $ip, $id<br>";
}
$sql = "select * from bans where ((substring('$ip',1,length(ipfilter))=ipfilter AND ipfilter<>'') OR (uniqueid='$id' AND uniqueid<>'')) AND (banexpire='0000-00-00' OR banexpire>'" . date("Y-m-d") . "')";
//echo $sql;
$result = db_query($sql) or die(db_error($link));
if (db_num_rows($result) > 0) {
$session = array();
$session['message'] .= "`n`4Du bist einer Verbannung zum Opfer gefallen:`n";
for ($i = 0; $i < db_num_rows($result); $i++) {
$row = db_fetch_assoc($result);
$session['message'] .= $row['banreason'];
if ($row['banexpire'] == "0000-00-00") {
$session['message'] .= " `\$Die Verbannung ist permanent!`0";
}
if ($row['banexpire'] != "0000-00-00") {
$session['message'] .= " `^Der Bann wird am " . date("M d, Y", strtotime($row['banexpire'])) . " aufgehoben `0";
}
$session['message'] .= "`n";
}
$session['message'] .= "`4Wenn du willst, kannst du mit einer Anfrage nach dem Grund fragen.";
header("Location: index.php");
exit();
}
db_free_result($result);
}
function increment_specialty()
{
global $session, $link;
/* if ($session['user']['specialty']>0){
$skillnames = array(1=>"Dunkle Künste","Mystische Kräfte","Diebeskunst");
$skills = array(1=>"darkarts","magic","thievery");
$skillpoints = array(1=>"darkartuses","magicuses","thieveryuses");
$session['user'][$skills[$session['user']['specialty']]]++;
output("`nDu steigst in `&".$skillnames[$session['user']['specialty']]."`# ein Level auf ".$session['user'][$skills[$session['user']['specialty']]]." auf. ");
$x = ($session['user'][$skills[$session['user']['specialty']]]) % 3;
if ($x == 0){
output("Du bekommst eine zusätzliche Anwendung!`n");
$session['user'][$skillpoints[$session['user']['specialty']]]++;
}else{
output("Nur noch ".(3-$x)." weitere Stufen, bis du eine zusätzliche Anwendung erhältst!`n");
}
} */
//}else{
// output("`7Du wanderst ziel- und planlos durchs Leben. Du solltest eine Rast machen und einige wichtige Entscheidungen für dein weiteres Leben treffen.`n");
//}
//SKILLS MOD BY ANGEL START
if ($session['user']['skill'] > 0) {
$session['user']['skilllevel']++;
$sql = "SELECT name FROM skills WHERE id=" . $session['user']['skill'] . "";
$result = db_query($sql) or die(db_error($link));
$row = db_fetch_assoc($result);
output("`nDu steigst in `&" . $row['name'] . "`# ein Level auf " . $session['user']['skilllevel'] . " auf. ");
$y = ($session['user']['skilllevel']) % 3;
if ($y == 0) {
output("Du bekommst eine zusätzliche Anwendung!`n");
$session['user']['skillpoints']++;
} else {
output("Nur noch " . (3 - $y) . " weitere Stufen, bis du eine zusätzliche Anwendung erhältst!`n");
}
}
//else{
// output("`7Du wanderst ziel- und planlos durchs Leben. Du solltest eine Rast machen und einige wichtige Entscheidungen für dein weiteres Leben treffen.`n");
//}
//SKILLS MOD BY ANGEL ENDE
}
function fightnav($allowspecial = true, $allowflee = true)
{
global $PHP_SELF, $session;
//$script = str_replace("/","",$PHP_SELF);
$script = substr($PHP_SELF, strrpos($PHP_SELF, "/") + 1);
addnav("Kämpfen", "$script?op=fight");
if ($allowflee) {
addnav("Wegrennen", "$script?op=run");
}
if (getsetting("autofight", 0)) {
addnav("AutoFight");
addnav("5 Runden kämpfen", "$script?op=fight&auto=five");
addnav("Bis zum bitteren Ende", "$script?op=fight&auto=full");
}
if ($allowspecial) {
//SKILLSMOD BY ANGEL START
if ($session['user']['skill'] != 0 && $session['user']['specialty'] != 0) {
addnav("`bBesondere Fähigkeiten`b");
$sql = "SELECT * FROM skills WHERE id='" . $session['user']['skill'] . "'";
$result = db_query($sql); //Befehl senden
$row = db_fetch_assoc($result);
$c = $row['color'];
if ($session['user']['skillpoints'] > 0) {
addnav("$c {$row['name']}`0", "");
addnav("$c • {$row['force1']}`7 (1/" . $session['user']['skillpoints'] . ")`0", "$script?op=fight&skill=SK&1=1", true);
}
if ($session['user']['skillpoints'] > 1) {
addnav("$c • {$row['force2']}`7 (2/" . $session['user']['skillpoints'] . ")`0", "$script?op=fight&skill=SK&1=2", true);
}
if ($session['user']['skillpoints'] > 2) {
addnav("$c • {$row['force3']}`7 (3/" . $session['user']['skillpoints'] . ")`0", "$script?op=fight&skill=SK&1=3", true);
}
if ($session['user']['skillpoints'] > 4) {
addnav("$c • {$row['force4']}`7 (5/" . $session['user']['skillpoints'] . ")`0", "$script?op=fight&skill=SK&1=5", true);
}
}
// if($session['user']['specialty']!=0){
//SKILLSMOD BY ANGEL ENDE
addnav("`bzusätzliche Fähigkeiten`b");
if ($session['user']['darkartuses'] > 0) {
addnav("`\$Dunkle Künste`0", "");
addnav("`\$• Skelette herbeirufen`7 (1/" . $session['user']['darkartuses'] . ")`0", "$script?op=fight&skill=DA&l=1", true);
}
if ($session['user']['darkartuses'] > 1) {
addnav("`\$• Voodoo`7 (2/" . $session['user']['darkartuses'] . ")`0", "$script?op=fight&skill=DA&l=2", true);
}
if ($session['user']['darkartuses'] > 2) {
addnav("`\$• Geist verfluchen`7 (3/" . $session['user']['darkartuses'] . ")`0", "$script?op=fight&skill=DA&l=3", true);
}
if ($session['user']['darkartuses'] > 4) {
addnav("`\$• Seele verdorren`7 (5/" . $session['user']['darkartuses'] . ")`0", "$script?op=fight&skill=DA&l=5", true);
}
if ($session['user']['thieveryuses'] > 0) {
addnav("`^DiebesKünste`0", "");
addnav("`^• Beleidigen`7 (1/" . $session['user']['thieveryuses'] . ")`0", "$script?op=fight&skill=TS&l=1", true);
}
if ($session['user']['thieveryuses'] > 1) {
addnav("`^• Waffe vergiften`7 (2/" . $session['user']['thieveryuses'] . ")`0", "$script?op=fight&skill=TS&l=2", true);
}
if ($session['user']['thieveryuses'] > 2) {
addnav("`^• Versteckter Angriff`7 (3/" . $session['user']['thieveryuses'] . ")`0", "$script?op=fight&skill=TS&l=3", true);
}
if ($session['user']['thieveryuses'] > 4) {
addnav("`^• Angriff von hinten`7 (5/" . $session['user']['thieveryuses'] . ")`0", "$script?op=fight&skill=TS&l=5", true);
}
if ($session['user']['magicuses'] > 0) {
addnav("`%Mystische Kräfte`0", "");
addnav("g?`%• Regeneration`7 (1/" . $session['user']['magicuses'] . ")`0", "$script?op=fight&skill=MP&l=1", true);
}
if ($session['user']['magicuses'] > 1) {
addnav("`%• Erdenfaust`7 (2/" . $session['user']['magicuses'] . ")`0", "$script?op=fight&skill=MP&l=2", true);
}
if ($session['user']['magicuses'] > 2) {
addnav("L?`%• Leben absaugen`7 (3/" . $session['user']['magicuses'] . ")`0", "$script?op=fight&skill=MP&l=3", true);
}
if ($session['user']['magicuses'] > 4) {
addnav("A?`%• Blitz Aura`7 (5/" . $session['user']['magicuses'] . ")`0", "$script?op=fight&skill=MP&l=5", true);
}
if ($session['user']['superuser'] >= 3) {
addnav("`&Superuser`0", "");
addnav("!?`&• __GOD MODE", "$script?op=fight&skill=godmode", true);
}
//abschließende Klammer vom Skillsmod
//}
//
}
}
// Angegebene Tags am Ende des Strings schließen
// (macht keinen Sinn bei Farben, da die nicht geschlossen werden)
function closetags($string, $tags)
{
$tags = explode('`', $tags);
foreach ($tags as $tihs) {
$that = trim($tihs);
if ($that == '') {
continue;
}
if (substr_count($string, '`' . $that) % 2) {
$string .= '`' . $that;
}
}
return $string;
}
function clearnav()
{
$session['allowednavs'] = array();
}
function redirect($location, $reason = false)
{
global $session, $REQUEST_URI;
if ($location != "badnav.php") {
$session['allowednavs'] = array();
addnav("", $location);
}
if (strpos($location, "badnav.php") === false) {
$session['output'] = "<a href=\"" . HTMLEntities($location) . "\">Hier klicken</a>";
}
if (!array_key_exists('debug', $session)) {
$session['debug'] = '';
}
$session['debug'] .= "Redirected to $location from $REQUEST_URI. $reason\n";
saveuser();
header("Location: $location");
echo $location;
echo $session['debug'];
exit();
}
function soap($input)
{
if (getsetting("soap", 1)) {
/*
$search = "*damn* *dyke *fuck* *phuck* *shit* asshole amcik andskota arschloch arse* atouche ayir bastard bitch* boiolas bollock* buceta butt-pirate cabron cawk cazzo chink chraa chuj cipa clit cock* "
. "cum cunt* dago daygo dego dick* dildo dike dirsa dupa dziwka ejackulate ekrem* ekto enculer faen fag* fanculo fanny fatass fcuk feces feg felcher ficken fitta fitte flikker foreskin phuck fuk* fut futkretzn fuxor gay gook guiena hor "
. "hell helvete hoer* honkey hore huevon hui injun jism jizz kanker* kawk kike klootzak knulle kraut kuk kuksuger kurac kurwa kusi* kyrp�* leitch lesbian lesbo mamhoon masturbat* merd merde mibun monkleigh mouliewop muie "
. "mulkku muschi nazis nepesaurio nigga* *nigger* nutsack orospu paska* pendejo penis perse phuck picka pierdol* pillu* pimmel pimpis piss* pizda poontsee poop porn pron preteen preud prick pula pule pusse pussy puta puto qahbeh queef* queer* "
. "qweef rautenberg schaffer scheiss* scheisse schlampe schmuck screw scrotum sharmuta sharmute shemale shipal shiz skribz skurwysyn slut smut sphencter spic spierdalaj splooge suka teets teez testicle tits titties titty twat twaty vittu "
. "votze woose wank* wetback* whoar whore wichser wop yed zabourah ass";
*/
$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 = split(" ", $search);
//$input = " $input ";
return preg_replace($search, "\\1`i$@#%`i\\2", $input);
} else {
return $input;
}
}
function createstring($array)
{
$output = "";
if (is_array($array)) {
reset($array);
// while (list($key,$val)=each($array))
foreach ($array as $key => $val) {
$output .= rawurlencode(rawurlencode($key) . "\"" . rawurlencode($val ?? "")) . "\"";
}
$output = substr($output, 0, strlen($output) - 1);
}
return $output;
}
function createarray($string)
{
$arr1 = split("\"", $string);
$output = array();
// while (list($key,$val)=each($arr1))
foreach ($arr1 as $key => $val) {
$arr2 = split("\"", rawurldecode($val));
$output[rawurldecode($arr2[0])] = rawurldecode($arr2[1]);
}
return $output;
}
function output_array($array, $prefix = "")
{
global $output;
// while (list($key,$val)=@each($array))
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) . ") {<blockquote>";
foreach ($temp as $key => $val) {
$output .= "'" . $key . "' = '" . dump_item($val) . "'`n";
}
$output .= "</blockquote>}";
} else {
$output .= $item;
}
return $output;
}
function addnews($news, $acctid = -1)
{
global $link, $session;
$query = ""; // 2021-08-07 aragon php8 fix
$lastid = 0; // 2021-08-07 aragon php8 fix
if ($acctid == -1) {
global $session;
$acctid = $session['user']['acctid'];
}
$invisible = $session['user']['invisible'];
if ($invisible == '0') {
$sql = "INSERT INTO news(newstext,newsdate,accountid) VALUES ('" . addslashes($news) . "',NOW()," . $acctid . ")";
if (!($query = db_query($sql))) {
die(db_error($link));
}
$lastid = db_insert_id($link);
}
db_query('DELETE FROM news WHERE newsid <= ' . ($lastid - 80));
return $query;
}
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'] ?? false) {
output("<!--CheckNewDay()-->", 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 a'), gametime());
}
// Gamedate-Mod by Chaosmaker
function getgamedate()
{
$date = explode('-', getsetting('gamedate', '1600-01-01'));
$find = array('%Y', '%y', '%m', '%n', '%d', '%j');
$replace = array($date[0], sprintf('%02d', $date[0] % 100), sprintf('%02d', $date[1]), (int)$date[1], sprintf('%02d', $date[2]), (int)$date[2]);
return str_replace($find, $replace, getsetting('gamedateformat', '%Y-%m-%d'));
}
function gametime()
{
return convertgametime(strtotime("now"));
}
function convertgametime($intime)
{
//$time = (strtotime(date("1971-m-d H:i:s",strtotime("-".getsetting("gameoffsetseconds",0)." seconds",$intime))))*getsetting("daysperday",4) % strtotime("1971-01-01 00:00:00");
/*
// bibirs Rechnung
$intime -= getsetting("gameoffsetseconds",0); // real-offset einberechnen
$time = strtotime(date('1971-05-01 H:i:s',$intime)) - strtotime(date('1971-05-01 00:00:00',$intime)); // reale uhrzeit seit 0-uhr(referenzzeit)
$time *= getsetting("daysperday",4); // in vergangene spielzeit gerechnet
$time += strtotime(date('1971-05-01 00:00:00',$intime)); // wieder mit realer uhrzeit vereinbaren
*/
// Noch ne neue Berechnung...
$multi = getsetting("daysperday", 4);
$offsetTime = intval(getsetting("gameoffsetseconds", 0) ?? 0);
$time = mktime(
date('H', $intime) * $multi,
date('i', $intime) * $multi,
(date('s', $intime) - $offsetTime) * $multi,
4,
date('d', $intime) * $multi,
2004
);
// Ganz neu, ganz toll, ganz ungetestet
/*
$monat = date('n',$intime);
if (date('Y',$intime)>2004) $monat += 12*(date('Y',$intime)-2004);
$days = 0;
if ($monat < 4) {
for ($i=$monat; $i<4; $i++) $days -= date('t',mktime(0,0,0,$i,1,2004));
}
elseif ($monat > 4) {
for ($i=4; $i<$monat; $i++) $days += date('t',mktime(0,0,0,$i,1,2004));
}
$multi = getsetting("daysperday",4);
$time = mktime(date('H',$intime)*$multi,
date('i',$intime)*$multi,
(date('s',$intime)-getsetting("gameoffsetseconds",0))*$multi,
4,
(date('d',$intime)+$days)*$multi,
2004,
1);
*/
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, $link;
return output_array($session) . "SQL = <pre>$sql</pre>" . db_error($link);
}
function ordinal($val)
{
$exceptions = array(1 => "ten", 2 => "ten", 3 => "ten", 11 => "ten", 12 => "ten", 13 => "ten");
$x = ($val % 100);
if (isset($exceptions[$x])) {
return $val . $exceptions[$x];
} else {
$x = ($val % 10);
if (isset($exceptions[$x])) {
return $val . $exceptions[$x];
} else {
return $val . "ten";
}
}
}
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 ? substr($secs - (int)$secs, 1) : "") . "s";
}
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 = "INSERT INTO debuglog VALUES(0,now(),{$session['user']['acctid']},$target,'" . addslashes($message) . "')";
db_query($sql);
}
function setrace($unset = false)
{
global $session;
$sql2 = "SELECT * FROM race WHERE name='{$session['user']['race']}' LIMIT 1";
$result2 = db_query($sql2);
$row = db_fetch_assoc($result2);
$bonus = unserialize($row['bonus']);
$bonuslp = (int)$bonus['lp'];
$bonusdef = (int)$bonus['def'];
$bonusatk = (int)$bonus['atk'];
if ($unset) {
$bonuslp = (-1) * $bonuslp;
$bonusdef = (-1) * $bonusdef;
$bonusatk = (-1) * $bonusatk;
}
$session['user']['maxhitpoints'] += $bonuslp;
$session['user']['defence'] += $bonusdef;
$session['user']['attack'] += $bonusatk;
/*foreach ($session['user']['race']['bonus'] AS $tihsbonus=>$bonusval) {
if ($bonusval==0) continue;
// Wenn Rasse gelöscht werden soll, dementsprechend setzen
if ($unset) $bonusval = -(int)$bonusval;
switch ($tihsbonus) {
case 'atk': $session['user']['attack'] += $bonusval; break;
case 'def': $session['user']['defence'] += $bonusval; break;
case 'lp': $session['user']['maxhitpoints'] += $bonusval; break;
}
}*/
}
function changerace($newrace)
{
global $session, $races;
setrace(true);
// Neue Rasse setzen
$session['user']['race'] = 'Unbekannt';
// Neue Boni anrechnen
setrace();
}
if (file_exists("dbconnect.php")) {
require_once "dbconnect.php";
} else {
echo "You must edit the file named \"dbconnect.php.dist,\" and provide the requested information, then save it as \"dbconnect.php\"" .
exit();
}
$link = db_pconnect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME) or die(db_error($link));
//db_select_db ($DB_NAME) or die (db_error($link));
require_once "lib/common/session.php";
// 2024-05-04 aragon moved to own lib
if (($_COOKIE['template'] ?? "") != "") {
$templatename = $_COOKIE['template'];
}
if (($templatename ?? "") == "" || !file_exists("templates/$templatename")) {
$templatename = "yarbrough.htm";
}
$template = loadtemplate($templatename);
//tags that must appear in the header
$templatetags = array("title", "headscript", "script");
foreach ($templatetags as $val) {
if (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 (strpos($template['footer'], "{" . $val . "}") === false) {
$templatemessage .= "You do not have {" . $val . "} defined in your footer\n";
}
}
//tags that may appear anywhere but must appear
$templatetags = array("nav", "stats", "petition", "motd", "mail", "paypal", "copyright", "source");
foreach ($templatetags as $val) {
if (strpos($template['header'], "{" . $val . "}") === false && strpos($template['footer'], "{" . $val . "}") === false) {
$templatemessage .= "You do not have {" . $val . "} defined in either your header or footer\n";
}
}
if (($templatemessage ?? "") != "") {
echo "<br>Du hast einen oder mehrere Fehler in deinem Template!</br><br>" . nl2br($templatemessage);
$template = loadtemplate("yarbrough.htm");
}
//$races=array(1=>"Troll",2=>"Elf",3=>"Mensch",4=>"Zwerg",5=>"Echse",0=>"Unbekannt",50=>"Hoverschaf");
/*old version
$races = array();
$sql = 'SELECT * FROM races';
$result = db_query($sql);
while ($row = db_fetch_assoc($result)) {
$row['buffs'] = unserialize($row['buffs']);
$races[$row['raceid']] = $row;
}
$startrace = $races['1'];
if (isset($session['user']['race'])) $session['user']['race'] = $races[$session['user']['race']];
*/
$logd_version = "0.9.7+jt ext (GER) Pandea Island Edition";
$session['user']['laston'] = date("Y-m-d H:i:s");
if (isset($session['user']) && ($session['user']['hashorse'] ?? false)) {
$playermount = getmount($session['user']['hashorse']);
}
function split($delimeter, $string)
{
return explode($delimeter, $string);
}