#define BASE "/users/cardeci/export/"
mapping replaces= ([]);
string fortune()
{
return "\n"+popen("/usr/local/bin/fortune -l")+"
\n\n";
}
string engdikt()
{
string *dir;
dir=get_dir("/users/cardeci/export/enpoems/*");
return ("\n"+
read_bytes("/users/cardeci/export/enpoems/" +
dir[random(sizeof(dir))]) +
"
\n\n");
}
string svdikt()
{
string *dir;
dir=get_dir("/users/cardeci/Text/dikter/klara/*");
return ("\n"+
read_bytes("/users/cardeci/Text/dikter/klara/" +
dir[random(sizeof(dir))]) +
"
\n\n");
}
void create()
{
mixed b;
foreach( read_bytes( "/users/cardeci/export/default_replaces" ) / "\n" , b )
if( sizeof( b /= "=" ) > 1)
replaces[ b[0] ] = ""+b[0]+"";
replaces["\n\n"]="\n\n
\n\n";
replaces["
";
call_out( create, 24 * 3600 ); // 24 hrs.
}
string preparse( string s, mapping how, string base )
{
string a, b, t;
a = b = "";
if( how[ "lang" ] == "eng" )
while(sscanf(s, "%*s" + a + "
" + b[0..0] +"" + b[1..10000] +
"
" + s;
#if 0
while(sscanf(s, "%s" +
b[0..0] +"" + b[1..10000] + "
"
}));
#endif
if(how["verbosity"] == "onl")
{
t += " (compressed menu form)";
b = "" + t +
"
";
while(sscanf(s, "%*s%s", a, s))
b += "
Ok. I will update.
";
}
options =
([
"lang":default_language( socket_address( file_descriptor ) ),
"pict":"m",
"form":default_format( request_info["client"] ),
"verb":"all",
]);
if( !strlen(f) )
f="home";
else
{
if( sscanf( f, "%s/%s", opts, f ) )
{
if( f == "preferences" )
return set_preferences( options, (opts/"/")[-1] );
else
{
mixed o;
if( sizeof( opts/"&" ) < 2)
f=opts+"/"+f;
foreach( opts/"&", o )
{
o/=":";
if( sizeof(o) > 1)
options[ decode( o[0] ) ] = o[1];
}
}
}
}
if( m_sizeof( request_info[ "variables" ] ))
if(request_info[ "variables" ]["1"])
{
string res;
int score;
score = sizeof(request_info["variables"]["1"]/"\1");
res = "You got 0x"+sprintf("%x", score)+" points.\n";
res += "This makes you ";
switch(score)
{
case 0x000 .. 0x010:
res += "a Computer Illiterate";
break;
case 0x011 .. 0x040:
res += "a User";
break;
case 0x041 .. 0x080:
res += "an Operator";
break;
case 0x081 .. 0x0C0:
res += "a Nerd";
break;
case 0x0C1 .. 0x100:
res += "a Hacker";
break;
case 0x101 .. 0x180:
res += "a Guru";
break;
case 0x181 .. 0x200:
res += "a Wizard";
break;
default:
res += "a Cheater";
}
return "The hacker test
\n"+res+"\n";
} else {
f="http://www.lysator.liu.se/~cardeci/" +
parse_form( request_info[ "variables" ] );
return
(["extra_heads":(["Location": f, ]),
"error":"302",
"data":
"
"+
""+
("Adjust preferences "+
"Lysator "+
""+
"Informationsvävarna \n"+
"
" +
preparse( read_bytes( dir + "info/" + f ), options, f ) +
"
" +
"
");
if( file_size(dir + "html/" + f) > 0 )
return read_bytes( dir + "html/" + f );
}
}
"+
"Adjust preferences "+
"Lysator "+
""+
"Informationsvävarna \n"+
"