Jump to content
Larry Ullman's Book Forums

Session_Start(): Causes The Page To Hang


Recommended Posts

For some reason, session_start is causing my pages to hang. Everything works fine if I comment out session_start().

I've tried putting it as the first thing in the page rather than having it as part of the header file but the same thing happens. I've also tried converting the file encoding to UTF-8-BOM to no avail.

 

Somebody please tell me I've missed something simple...

 

The code is thus:

Main page (template):

<?php
	//include site config file
	require ('includes/config.inc.php');
	//set page title and additional css variables
	$page_title = 'Welcome to Sundered Empire LARP!';
	$add_css = array('something.css', 'something_else.css');
	//include site header
	include ('includes/header.inc.php');
?>
<!--page code-->
<?php
	include ('includes/footer.inc.php');
?>

Header:

<?php
	//initialise buffer & session
	ob_start();
	//session_start();
	//set default page title
	if (!isset($page_title)) {
		$page_title = 'Sundered Empire LARP';
	}
?>
<!--start of html-->
<!DOCTYPE html>
	<html>
	<!--start of html head-->
		<head>
			<title>
				<?php
					echo $page_title;
				?>
			</title>
			<link href="css/style.css" type="text/css" rel="stylesheet">
			<!--insert further stylesheets if required-->
			<?php
				if (isset($add_css)) {
					foreach ($add_css as $sheet) {
					echo '<link href="css/' . $sheet . '" type="text/css" rel="stylesheet">\n';
					}
				}
			?>
		</head>
		<!--end of html head-->
		<!--start of html body-->
		<body>
			<div id="page">
			<!--start of page header-->
				<header>
					<div id="pagetopbar">
						<h1 id="headerlogo">
							<a href="home.php">
								<img src="images/selogo.png" alt="Sundered Empire">
							</a>
						</h1>
						<div id="logon">
							<table id="logon1">
								<tr>
									<?php
										//set register/logon/logoff buttons
										if (isset($_SESSION['member_id'])) {
											echo '<td>WElcome ' . $_SESSION['member_name'] . '</td>
												<td> | </td>
												<td><a href="logoff.php"><input type="submit" name="logoff" value="Log Off" class="button" /></a></td>';
										} else {
											echo '<td><a href="register.php"><input type="submit" name="register" value="Register" class="button" /></a></td>
												<td> | </td>
												<td><a href="logon.php"><input type="submit" name="logon" value="Log On" class="button" /></a></td></tr>
												<tr><td colspan="3" class="pass_rst"><a href="forgot_password.php">Forgotten Password?</a></td>';
										}
									?>
								</tr>
							</table>
						</div>
						<!--start of site navigation-->
						<nav>
							<ul>
								<li><a href="home.php">Home</a></li>
								<li><a href="about.php">About Us</a></li>
								<?php
									//show member only pages if logged on
									if (isset($_SESSION['member_id'])) {
										echo '<li><a href="rules.php">The Rules</a></li>
											<li><a href="setting.php">The Setting</a></li>
											<li><a href="account.php">User Account</a></li>
											<li><a href="messages.php">Message Box</a></li>
											<li><a href="character.php">Character Details</a></li>
											<li><a href="notices.php">Notices & Rumours</a></li>
											<li><a href="forum.php">Forum & Chat</a></li>';
									}
									//show ref/officer pages if required
									if (isset($_SESSION['ref']) && $_SESSION['ref'] == 'Y') {
										echo '<li><a href="referee.php">Referee Tools</a></li>';
									}
									if (isset($_SESSION['off']) && $_SESSION['off'] == 'Y') {
										echo '<li><a href="officer.php">Officer Tools</a></li>';
									}
								?>
								<li><a href="gallery.php">Gallery</a></li>
							</ul>
						</nav>
					<!--end of site navigation-->
					</div>
				</header>
				<!--end of page header-->
				<!--start of main page content-->
				<div id="content">
				<!--end of header inclusion-->

Footer:

		</div>
		<!--end of main page content-->
		<!--start of page footer-->
		<footer>
			<!--start of footer navigation-->
			<div id="botnav">
				<ul>
					<li><a href="web/contact.php">Contact Sundered Empire</a></li>
					<!--sitemap placeholder-->
				<li><a href="web/support.php">Support Us</a></li>
					<?php
						//show admin page if needed
						if (isset($_SESSION['admin']) && $_SESSION['admin'] == 'Y') {
							echo '<li><a href="web/admin.php">Admin Control Panel</a></li>';
						}
					?>
				</ul>
			</div>
			<!--end of footer navigation-->
			<!--start of policy navigation-->
			<div id="policy">
				<ul>
					<li><a href="web/terms.php">Terms of Use</a></li>
					<li><a href="web/cookies.php">Cookie Policy</a></li>
					<li><a href="web/privacy.php">Privacy Policy</a></li>
					<li><span id="copy">© 2016 Sundered Empire, all rights reserved.</span></li>
				</ul>
			</div>
		<!--end of policy navigation-->
		</footer>
	<!--end of site footer-->
	</body>
<!--end of html body-->
</html>
<!--end of html-->
<?php
	//flush buffer and load page
	ob_end_flush();
?>
Link to comment
Share on other sites

 Share

×
×
  • Create New...