很多用户会在主页上放一个论坛入口,这样访问者就可以从首页直接登录论坛,而不必再先进入论坛再登录。下面提供的 html 代码可以
示范如何从首页登录 Discuz! 论坛。这段代码只是示范一下登录表单的工作原理,具体的界面、显示等需要您根据页面情况自行修改。
如果当这段代码不是放在论坛目录里,则需要把与程序相关的文件名(logging.php,register.php,index.php)加上论坛的路径。如
logging.php?action=login 改为 http://your.com/discuz/logging.php?action=login。
<html>
<head>
<title>login</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form method="post" action="logging.php?action=login" target="_blank">
<input type="hidden" name="referer" value="index.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>用户名</td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>密码</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="loginsubmit" value="登录">
<input type="reset" name="reset" value="重置">
<input type="button" value="注册" onclick="javascript: this.form.action='register.php';this.form.submit();">
<input type="button" value="游客" onclick="javascript: this.form.action='index.php';this.form.submit();">
</td>
</tr>
</table>
</form>
</body>
</html>
|
|