PHP tmpl.inc-的header.php

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP tmpl.inc-的header.php相关的知识,希望对你有一定的参考价值。

<?php

	global $DB, $SESS;
	
	$show_access_debug = false;
	
	// Check to see if a) group has privileges to access QDB, and b) user has privileges to access QDB
	$query = "SELECT exp_qdb_group_privileges.group_can_access_qdb FROM exp_qdb_group_privileges WHERE " .
		"exp_qdb_group_privileges.group_id = '" . $SESS->userdata['group_id'] . "'";
	$result = $DB->query($query);
	$group_can_access_qdb = 1;
	if ($result->num_rows > 0)
		$group_can_access_qdb = intval($result->row['group_can_access_qdb']);
	
	$query = "SELECT exp_qdb_member_privileges.member_can_access_qdb FROM exp_qdb_member_privileges WHERE " .
		"exp_qdb_member_privileges.member_id = '" . $SESS->userdata['member_id'] . "'";
	$result = $DB->query($query);
	$member_can_access_qdb = 1;
	if ($result->num_rows > 0)
		$member_can_access_qdb = intval($result->row['member_can_access_qdb']);
	
	$can_access_qdb = 1;
	if ($group_can_access_qdb >0 && $member_can_access_qdb <= 0)
		$can_access_qdb = 0;
	else if ($group_can_access_qdb <= 0 && $member_can_access_qdb > 0)
		$can_access_qdb = 1;
	else if ($group_can_access_qdb <= 0 && $member_can_access_qdb <= 0)
		$can_access_qdb = 0;
	
	if (!$can_access_qdb)
		$FNS->redirect('');
	
	// Check to see if member has privileges to submit quotes
	if ($can_access_qdb) {
		$query = "SELECT exp_qdb_group_privileges.group_can_add_quotes from exp_qdb_group_privileges WHERE " .
			"exp_qdb_group_privileges.group_id = '" . $SESS->userdata['group_id'] . "'";
		$result = $DB->query($query);
		$group_can_add_quotes = 1;
		if ($result->num_rows > 0)
			$group_can_add_quotes = intval($result->row['group_can_add_quotes']);
		
		$query = "SELECT exp_qdb_member_privileges.member_can_add_quotes from exp_qdb_member_privileges WHERE " .
			"exp_qdb_member_privileges.member_id = '" . $SESS->userdata['member_id'] . "'";
		$result = $DB->query($query);
		$member_can_add_quotes = 1;
		if ($result->num_rows > 0)
			$member_can_add_quotes = intval($result->row['member_can_add_quotes']);
		
		$can_add_quotes = 1;
		if ($group_can_add_quotes > 0 && $member_can_access_qdb <= 0)
			$can_add_quotes = 0;
		else if ($group_can_add_quotes <= 0 && $member_can_add_quotes > 0)
			$can_add_quotes = 1;
		else if ($group_can_add_quotes <= 0 && $member_can_add_quotes <= 0)
			$can_add_quotes = 0;
	}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Disciples of Bork - Quote Database</title>
	<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=qdb/css_screen}" />
</head>
<body>
	<div id="wrapper">
		
		<div id="header"><h1>
				Quote Database <span class="version">Some things people have said</span>
				<span id="nav"> <?php if ($can_access_qdb && $can_add_quotes): ?><a href="{path=qdb/submit}">Submit a Quote</a><?php endif; ?></span>
		</h1></div>
		
		<!-- Access debug information -->
		<?php if ($show_access_debug): ?>
			<div style="display: block; width: 49%; float: left;">
				<h2>QDB Access</h2>
				<ul>
					<li><b>$group_can_access_qdb</b> = <?=$group_can_access_qdb;?></li>
					<li><b>$member_can_access_qdb</b> = <?=$member_can_access_qdb;?></li>
					<li><b>$can_access_qdb</b> = <?=$can_access_qdb;?></li>
				</ul>
			</div>
		
			<div style="display: block; width: 49%; float: right;">
				<h2>Submit Quote Access</h2>
				<ul>
					<li><b>$group_can_add_quotes</b> = <?=$group_can_add_quotes;?></li>
					<li><b>$member_can_add_quotes</b> = <?=$member_can_add_quotes;?></li>
					<li><b>$can_add_quotes</b> = <?=$can_add_quotes;?></li>
				</ul>
			</div>
		<?php endif; ?>

以上是关于PHP tmpl.inc-的header.php的主要内容,如果未能解决你的问题,请参考以下文章

在'header.php'或'function.php'文件中插入Bootstrap目录更好吗?

php WP插件Header.php

PHP Wordpress:header.php

“header()” php 函数是不是取消设置全局变量?

“Header.php”文件在 XAMPP 上不可见

php 将自定义字段中的架构数据插入header.php