<?

require("datafile/superadmin.php");
require("datafile/config.php");
require("datafile/style.php");
require("global.php");

if (!$job) $job="relogin";

$add_title=" &gt; 登录程式";

if ($job=="relogin") {

	if (!$step) {
		include("header.php");
		printbar();
		printLoginForm();
		include("footer.php");
		exit;
	}
	elseif ($step==2) {
		$check=0;
		if ($loginuser && $loginpwd) $check=checkpass($loginuser,$loginpwd);
		if ($check==1) {
			$vibid=$loginuser;
			if ($privacy!=1) $privacy=0;
			$login_status=1;
			session_register("vibid");
			session_register("privacy");
			jump_page('viboard.php','登录成功','<br>状态：您已经登录成功<br><ul><li><a href="viboard.php">进入讨论区</a></li></ul>');
		}else {
			include("header.php");
			printbar();
			msg_box('登录程式','<br>状态：对不起，资料错误，您无法登录<br>请检查您的数据 <br><ul><li><a href="javascript:history.back(1);">返回</a></li></ul>');
			include("footer.php");
		}
	}
} elseif ($job=="quit") {

	session_destroy();
	jump_page('viboard.php','成功退出','<br>状态：您已经成功退出<br><ul><li><a href="viboard.php">返回到论坛</a></li></ul>');

} elseif ($job=="qandr") {

	session_destroy();
	jump_page($site_url,'成功退出',"状态：您已经成功退出<br><ul><li><a href='$site_url'>返回</a>网站首页</li></ul>");

}

function printbar() {
navi_bar("登录程式将把信息记录在COOKIE中<br>为了安全考虑，退出时请选择<br><a href='viblogin.php?job=quit'>退出登录</a>","登录程式");
}

function printLoginForm() {
msg_box("登录程式",
"<form action=viblogin.php method=POST>
动作：用户登录<br>
<br>
用户名： 
<input type=text name='loginuser' size=10 style=\"background-color:#ffffff; color:#336699; border: 1 double #B4B4B4\" onMouseOver = \"this.style.backgroundColor = '#E5F0FF'\" onMouseOut = \"this.style.backgroundColor = ''\">
密码： 
<input type=password name='loginpwd' size=10 style=\"background-color:#ffffff; color:#336699; border: 1 double #B4B4B4\" onMouseOver = \"this.style.backgroundColor = '#E5F0FF'\" onMouseOut = \"this.style.backgroundColor = ''\">
( <a href='sendpwd.php'>忘记了密码？</a>) <br>
<br>
用户个人动作： 
<select name='privacy'>
<option value=0>显示在用户列表</option>
<option value=1>隐身，不显示</option>
</select>
<br><br><br>
<input type=submit value='送出资料' style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\">
&nbsp;<input type=hidden value='2' name='step'>
<input type=reset value='清除重写' style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\"></form>");
}
function printLoginSuccess() {
msg_box('登录程式','');
}
