我有这个不是我写的 Perl 脚本(我也不会写 Perl),如果你登录了,它会插入一个注销链接:
sub print_loginform {
$web_content .= qq{
</form>
};
}
if ($logged_in_as) {
$addlink = '<a href="/logout">Logout</a><a href="/account/">My Account</a>';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
<a href="/">Home</a>
<a href="/online/">Who's online?</a>
<a href="/highscores/">Highscores</a>
<a href="/rules/">Rules</a>
<a href="/about/">About</a>
<a href="/guilds/">Guilds</a>
<a href="/houses/">Houses</a>
<a href="/shop/">Donations</a>
<a href="/forum/">Forum</a>
<a href="/lost-password/">Lost Password</a>
<a href="/create-account/">Create Account</a>$addlink
<div id="menufooter"></div>
};
if (!$logged_in_as) {
&print_loginform();
}
$web_content .= "</div>";
当用户登录做一些非常hacky的事情并且只是登录面板时,是否有一种方法可以添加一些内联css display:none
?
我试过这个:
if ($logged_in_as) {
$addlink = '<a href="/logout">Logout</a><a href="/account/">My Account</a>';
$removelogin = '<style type="text/css" media="screen">.loginpanel:display:none;</style>';
}
可以肯定地说它没有用,但由于我不是 Perl 程序员,我无法真正弄清楚这一点,这对我来说完全是在黑暗中拍摄,我什至觉得有点像菜鸟一样来问求助。我试图在 Perl 上找到的文档充其量也很少。
这是马修的代码,这不起作用(可能是我的错)
sub print_loginform {
$web_content .= qq{
</form>
};
}
if ($logged_in_as) {
$addlink = '<a href="/logout">Logout</a><a href="/account/">My Account</a>';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
<a href="/">Home</a>
<a href="/online/">Who's online?</a>
<a href="/highscores/">Highscores</a>
<a href="/rules/">Rules</a>
<a href="/about/">About RealOTS</a>
<a href="/guilds/">Guilds</a>
<a href="/houses/">Houses</a>
<a href="/shop/">Donations</a>
<a href="/forum/">Forum</a>
<a href="/lost-password/">Lost Password</a>
<a href="/create-account/">Create Account</a>$addlink
<div id="menufooter"></div>
<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
<form method="POST" action="/character/">
<input type="hidden" name="page" value="character">
Character Search<input type="text" name="searchchar" value="" size=15><br><br>
<input type="submit" value="Look up">
</form>
};
if (!$logged_in_as) {
&print_loginform();
$web_content .= qq{<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
};
}
$web_content .= "</div>";