I have check, double checked, and triple checked for errors but could not find any. So, I was wondering if you guys could look at it. Also I removed my credentials just for securities sake. Anyways ThanksHTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
register.php
<?php
include('core/init.inc.php');
$errors = array();
if (isset($_POST['username'], $_POST['password'], $_POST['repeat_password'])){
	if (empty($_POST['username'])){
		$errors[] = 'The username cannot be empty.';
	}
	if (empty($_POST['password']) || empty($_POST['repeat_password'])){
		$errors[] = 'The password cannot be empty.';
	}
	if ($_POST['password'] !== $_POST['repeat_password']){
		$errors[] = 'Password verification failed.';
	}
	if (user_exists($_POST['username'])){
		$errors[] = 'The username you entered is already taken.';
	}
	if (empty($errors)){
		add_user($_POST['username'], $_POST['password']);
		$_SESSION['username'] = htmlentities($_POST['username']);
		header('Location: protected.php');
		die();
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equi"Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="ext/css/style.css" />
		<title></title>
	</head>
	<body>
		<p>
			<?php
			if (empty($errors) === false){
				?>
				<ul>
					<?php
					foreach ($errors as $error){
						echo "<li>{error}</li>";
					}
					?>
				</ul>
				<?php
			}
			?>
		</p>
		<form action="" method="post">
			<p>
				<label for="username">Username:</label>
				<input type="text" name="username" id="username" />
			</p>
			<p>
                                <label for="password">Password:</label>
                                <input type="password" name="password" id="password" />
			</p>
			<p>
                                <label for="repeat_password">Repeat Password:</label>
                                <input type="password" name="repeat_password" id="repeat_password" />
			</p>
			<p>
				<input type="submit" value="Register" />
			</p>
		</form>
	</body>
</html>
logout.php
<?php ?>login.php
<?php ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://w3.org/TR/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="ext/css/style.css" /> <title></title> </head> <body> <p> Need an account ? <a href="register.php">Register here</a> </p> <form action="" method="post"> <p> <label for="username">Username:</label> <input type="text" name "username" id-"username" /> </p> <p> <label for="password">Password:</label> <input type="password" name="password" "password" </p> <p> <input type="submit" value="Login" /> </p> </form> </body> <html>protected.php
<?php include('core/init.inc.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTMl 1.0 Strict//EN" "http://w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
	</head>
	<body>
		<p>
			You are logged in as <?php   ?>
		</p>
	</body>
</html>
init.inc.php
<?php
session_start();
$exceptions = array('register', 'login');
$page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4);
if (in_array($page, $exceptions) === false){
	if (isset($_SESSION['username']) === false){
		header('Location: login.php');
		die();
	}
}
mysql_connect('hatgeek.com', '<username>', '<password>');
mysql_select_db('user_system');
$path = dirname(_FILE_);
include("{path}/inc/user.inc.php");
?>
user.inc.php
<?php
// Checks if given username exits in db table
function user_exists($user){
	$user = mysql_real_escape_string($user);
	$total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_name` = '{$user}'");
	return (mysql_result($total, 0) == '1') ? true : false;
}
// Checks if given username and password combo is valid
function valid_credentials($user, $pass){
	$user = mysql_real_escape_string($user));
	$pass = shal($pass);
	$total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_name` = '{$user}' AND `user_password` = '{$pass}'");
	return (mysql_result($total, 0) == '1') ? true : false; 
}
// Adds user to db
function add_user($user, $pass){
	$user = mysql_real_escape_string(htmlentities$user));
	$pass = shal($pass);
	mysql_query("INSERT INTO `users` (`user_name`, `user_password`) VALUES ('{$user}', '{$pass}')");
}
?>
style.css
body {
}
