Example #1
0
function is_login()
{
    $error = false;
    $errormsg = array();
    global $tpassword;
    if ($errormsg = checkpassword($tpassword)) {
        show_msg($errormsg);
    }
    if (isset($_COOKIE['toolsauth'])) {
        if ($_COOKIE['toolsauth'] === md5($tpassword . thash())) {
            return TRUE;
        }
    }
    if ($_GET['action'] === 'login') {
        $formhash = $_GET['formhash'];
        if ($formhash !== thash()) {
            show_msg('您的请求来路不正或者输入密码超时,请刷新页面后重新输入正确密码!');
        }
        $toolsmd5 = md5($tpassword . thash());
        if (md5($_GET['toolpassword'] . thash()) == $toolsmd5) {
            tsetcookie('toolsauth', $toolsmd5, time() + '3600', '', false, '', '');
            show_msg('登陆成功!', 'tools.php?action=index', 2000);
        } else {
            show_msg('您输入的密码不正确,请重新输入正确密码!', 'tools.php', 2000);
        }
    } else {
        return FALSE;
    }
}
Example #2
0
function is_login() {
	$error = false;
	$errormsg = array();
	global $tpassword;

	if($errormsg = checkpassword($tpassword)) {
		show_msg($errormsg);
	}

	if(isset($_COOKIE['toolsauth'])) {
		if($_COOKIE['toolsauth'] === md5($tpassword.thash())) {
			return TRUE;
		}
	}
	
	$lockfile = TOOLS_ROOT.'data/tools.lock';
	if(@file_exists($lockfile)) {
		$errormsg = "急救箱已经锁定,请您先登录服务器ftp,手工删除 ./data/tools.lock 文件,再次重新使用急救箱。";
		show_msg($errormsg);
	}

	if ( $_GET['action'] === 'login') {
		$formhash = $_GET['formhash'];
		if($formhash !== thash()) {
			show_msg('您的请求来路不正或者输入密码超时,请刷新页面后重新输入正确密码!');
		}
		$toolsmd5 = md5($tpassword.thash());
		if(md5($_GET['toolpassword'].thash()) == $toolsmd5) {
			tsetcookie('toolsauth', $toolsmd5, time()+'3600', '', false, '','');
			$lockfile = TOOLS_ROOT.'data/tools.lock';
			if(@$fp = fopen($lockfile, 'w')) {
				fwrite($fp, ' ');
				fclose($fp);
			}
			show_msg('登陆成功!', 'tools.php?action=index', 2000);
		} else {
			show_msg( '您输入的密码不正确,请重新输入正确密码!', 'tools.php', 2000);
		}
	} else {
		return FALSE;
	}
}