View Source: /source/badnav.php
Click here for the source, OR
Other files that you may wish to view the source of:
<?
require_once "common.php";
if ($REQUEST_URI=="badnav.php?clear" && $session[user][superuser]){
clearnav();
addnav("","village.php");
redirect("village.php");
}
if ($HTTP_GET_VARS[op]=="adddbg" && $session[user][superuser]>1){
array_push($session[debugvars],str_replace("\$","",$HTTP_POST_VARS["var"]));
}
if ($HTTP_GET_VARS[op]=="removedbg" && $session[user][superuser]>1){
unset($session[debugvars][$HTTP_GET_VARS[id]]);
}
if ($session[user][loggedin] && $session[loggedin]){
if (preg_match("/([^\\\\]')+([^\\\\]\")+/",$session[output])==0){
//make sure we don't end up in green slash-escaped mode which I haven't figured out yet.
$session[output]=stripslashes($session[output]);
$session[output]=str_replace("&","&",$session[output]);
$session[allowednavs]=array();
}
if (strpos($session[output],"<!--CheckNewDay()-->")){
checkday();
}
$matches = array();
preg_match_all(
"/<a[^>]+href[[:space:]]*=[[:space:]]*[\"]([^'\"]*)[\"]|".
"<a[^>]+href[[:space:]]*=[[:space:]]*[']([^'\"]*)[']|".
"<form[^>]+action[[:space:]]*=[[:space:]]*[\"]([^'\"]*)[\"]|".
"<form[^>]+action[[:space:]]*=[[:space:]]*[']([^'\"]*)[']".
"/Ui",
$session[output],
$matches);
while (list($key,$val)=each($matches[1])){
//make sure that all links that are presented to the user are allowed in the navs.
$i=2;
while(trim($val)=="" && isset($matches[$i][$key])) {
//echo "\$matches[$i][$key]: ".isset($matches[$i][$key])."<br>\n";
$matches[1][$key]=$matches[$i][$key];
$val = $matches[1][$key];
$i++;
}
//echo $val."<br>\n";
addnav("",$val);
}
while (list($key,$val)=each($session[allowednavs])){
if (trim($key)=="" || $key===0 || substr($key,0,8)=="motd.php") unset($session[allowednavs][$key]);
}
if (!is_array($session[allowednavs]) || count($session[allowednavs])==0) {
$session[allowednavs]=array();
addnav("","village.php");
echo "<a href='village.php'>Your navs got corrupted, return to the village.</a>";
//saveuser();
}else{
//echo count($session[allowednavs]);
}
//$inspoint = "<td rowspan=2 valign='top' width='100%'>";
//echo str_replace($inspoint,$inspoint."<table border=0 bgcolor='#990000' align='right'><tr><td align='center'><b>Cached</b>$su</td></tr></table>",$session[output]);
echo $session['output'];
echo nl2br(htmlentities($session['debug']));
$session['debug']="";
//if ($session[user][superuser]) echo "<pre>".HTMLEntities(output_array($session[allowednavs]))."</pre>";
$session[user][allowednavs]=$session[allowednavs];
saveuser();
}else{
$session=array();
redirect("index.php");
}
?>