Link to home
Start Free TrialLog in
Avatar of Andy_Fang
Andy_Fang

asked on

Footer not showing, although I included already?

Hello Expert,

Although I had already included the footer, it seems that if you view the source, my site here does not show the footer. Here is the source (including PHP):
<?php
// DO NOT EDIT BELOW HERE.

$title       = 'Join the Network';
$description = 'Join DiceHub to gamble online in seconds. The highest odds, with no rigs and large community are waiting for you!';
$activeMenu  = 'Join';
require 'header.php';
?>
<?php
// FORM VALIDATION

if (isset($_POST['submit'])) {
    $firstName = $_POST['firstName'];
    $lastName  = $_POST['lastName'];
    $email     = $_POST['email'];
    $username  = $_POST['username'];
    $password  = $_POST['password'];
}
// Username Check
$userCheck = $db->query("SELECT * FROM users WHERE username='" . $username . "'");
if (empty($firstName) || empty($lastName) || empty($username) || empty($password) || empty($email)) {
    if (empty($firstName)) {
        $errors[] = 'What should we call you?';
    }
    if (empty($lastName)) {
        $errors[] = 'On the case we address you formally.';
    }
    if (empty($username)) {
        $errors[] = 'This is the name that\'ll appear on your profile.';
    }
    if (empty($password)) {
        $errors[] = 'How are you going to login?';
    }
    if (empty($email)) {
        $errors[] = 'You missed the most important part!';
    }
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $errors[] = 'This isn\'t a valid email address.';
} elseif ($username == $password) {
    $errors[] = 'For security, Your can\'t use the same username as your password.';
} elseif ($userCheck->num_rows > 0) {
    $errors[] = 'That username is already in use.';
}
?>


<!-- Registration Form -->
<div class="margin30p">
	<div id="main-wrapper">
		<div id="regForm">
			<form action="<?php
echo $_SERVER['PHP_SELF'];
?>" method="POST">

				<div>
				<div>
				<label for="firstName">First Name</label>
				<input type="text" id="firstName" maxlength="25" required name="firstName" class='form-control' name="firstName"/>
				</div>
				<div>
				<label for="lastName">Last Name</label>
				<input type="text" id="lastName" maxlength="25" required name="lastName" class='form-control' name="lastName"/>
				</div>
				<label for="email">Email</label>
				<input type="text" id="email" maxlength="100" required name="email" class='form-control' name="email"/>
				</div>
				<div>
				<label for="username">Username</label>
				<input type="text" id="username" autofocus maxlength="25" required name="username" class='form-control' name="username"/>
				</div>
				<div>
				<label for="password">Password</label>
				<input type="text" id="password" maxlength="100" required name="password" class='form-control' name="password"/>
				</div>
				
				<input type="submit" name="submit" id="submit" value="submit" required data-loading-text="Creating account..." class="btn btn-primary"/>
			</form>
		</div>
</div>
<?php
require 'footer.php';
?>

Open in new window

Avatar of Gary
Gary
Flag of Ireland image

What you have posted above and the link you have provided are not the same - the HTML structure of the link is completely different.
Avatar of Andy_Fang
Andy_Fang

ASKER

What you have posted above and the link you have provided are not the same - the HTML structure of the link is completely different.

What do you mean? Both are for the join.php located at dicehub.com/join.
Go to the link and search the source for margin30p (from the code above) - it doesn't exist.
There is no similarities in the code
Oh, my bad, here's header.php:
<?php

require $_DOCUMENT['root'] . 'db.php';
?>
<!DOCTYPE HTML>
<!--
 _______   __                      __    __            __       
/       \ /  |                    /  |  /  |          /  |      
$$$$$$$  |$$/   _______   ______  $$ |  $$ | __    __ $$ |____  
$$ |  $$ |/  | /       | /      \ $$ |__$$ |/  |  /  |$$      \ 
$$ |  $$ |$$ |/$$$$$$$/ /$$$$$$  |$$    $$ |$$ |  $$ |$$$$$$$  |
$$ |  $$ |$$ |$$ |      $$    $$ |$$$$$$$$ |$$ |  $$ |$$ |  $$ |
$$ |__$$ |$$ |$$ \_____ $$$$$$$$/ $$ |  $$ |$$ \__$$ |$$ |__$$ |
$$    $$/ $$ |$$       |$$       |$$ |  $$ |$$    $$/ $$    $$/ 
$$$$$$$/  $$/  $$$$$$$/  $$$$$$$/ $$/   $$/  $$$$$$/  $$$$$$$/  

PRIVATE PROPERTY, YOU ARE NOW TRESPASSING. BEWARE OF DOG.

-->
<html>
	<head>
		<title>
		<?php
echo $title;
?> • DiceHub
		</title>
		<meta http-equiv="content-type" content="text/html;charset=UTF-8">
		<meta content="<?php
echo $description;
?> " name='description'>
		<link href='/images/favicon.png' rel='shortcut icon'>
		
		<!-- Latest compiled and minified CSS -->
		<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" type="text/css">
		
		<!-- DiceHub Core JavaScript -->
		<link rel="stylesheet" href="/assets/style.css" type="text/css">
		
		<!-- Load latest jQuery -->
		<script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
		
		<!-- Latest compiled and minified JavaScript -->
		<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js" type="text/javascript"></script>
		

<script type='text/javascript'>
/*	This function sets the cookie	*/
function themeBeta(){
   days=30; // number of days to keep the cookie
   myDate = new Date();
   myDate.setTime(myDate.getTime()+(days*24 * 60 * 60 * 1000));
   document.cookie = 'theme=beta; expires=' + myDate.toGMTString();
}
/*	end of cookie function	*/
</script>
		<!-- DiceHub Core JavaScript -->
		<script src="/js.js" type="text/JavaScript"></script>

	</head>
	<body>
			<noscript>
		<div id="nojs">Is DiceHub not working properly? Try<a href="//www.enable-javascript.com/" rel="nofollow"> enabling JavaScript in your browser</a> and use <a href="//www.google.com/chrome/" rel="nofollow">Google Chrome</a> for the best experience!
		</div>
		</noscript>
		<nav class="navbar navbar-inverse favbar-fixed-top" role="navigation">
			<!-- Dicehub and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
					<span class="sr-only">
						Toggle navigation
					</span>
					<span class="icon-bar">
					</span>
					<span class="icon-bar">
					</span>
					<span class="icon-bar">
					</span>
				</button>
				<a class="navbar-brand" href="/">
					<img src="/images/brand-logo.png" width="25" alt='DiceHub Logo'>
					DiceHub
				</a>
			</div>
			<form class="navbar-form navbar-left" role="search" action="/gamble.php" method="post">
				<div class="form-group">
					<input type="text" class="form-control" placeholder="$1.00">
				</div>
				<button type="submit" class="btn btn-success">
					Gamble
				</button>
			</form>
			<ul class="nav navbar-nav navbar-right">
				<li <?php
if (!isset($activeMenu)) {
    // Highlight nothing.
} elseif ($activeMenu = 'Join') {
    echo 'class="active"';
} else {
    // Highlight no link.
}
?>
					>
					<a href="/join">
						Join
					</a>
				</li>
				<li class="dropdown">
					<?php
//Check do we have username and password
if (!$username && !$password) {
    echo '<a data-toggle="modal" href="#LoginHeader"><b>Sign In</b></a>';
} else {
    echo "<a data-toggle=\"modal\" href=\"#LoginHeader\"><b>Welcome $username" . '.' . '</b></a>';
}
?>
				</li>
			</ul>
			<!-- navbar-collapse -->
		</nav>

			<!-- Modal -->
			<div class="modal fade" id="LoginHeader" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								&times;
							</button>
							<h4 class="modal-title center">
								Login to DiceHub
							</h4>
						</div>
						<div class="modal-body">
							<form class="form-horizontal" role="form">
								<div class="form-group">
									<label for="inputEmail1" class="col-lg-2 control-label">
										Username
									</label>
									<div class="col-lg-10">
										<input type="email" class="form-control" id="Email" placeholder="Email or Username" name="username" maxlength="25">
									</div>
								</div>
								<div class="form-group">
									<label for="inputPassword1" class="col-lg-2 control-label">
										Password
									</label>
									<div class="col-lg-10">
										<input type="password" class="form-control" id="inputPassword1" placeholder="Password" name="password" maxlength="25">
									</div>
								</div>
								<div class="form-group">
									<div class="col-lg-offset-2 col-lg-10">
										<div class="checkbox">
											<label>
												<input type="checkbox" name="rememberMe">
												Remember me next time
											</label>
										</div>
									</div>
								</div>
								<input type="button" class="btn btn-primary center" value="Login">
							</form>
						</div>
					</div>
				</div>
			</div>

Open in new window

Now it makes more sense
Your code never gets past what is in the header.php.
Add to your page as the first line
error_reporting(E_ALL);

This will then tell you where in the join page the error is occurring
It could be at any point in the php code.
Thanks for the response Gary, it is greatly appreciated.

I turned error reporting = on, and it turns out the site malfunctioned because I had this code:
//Check do we have username and password
if (!$username && !$password) {
    echo '<a data-toggle="modal" href="#LoginHeader"><b>Sign In</b></a>';
} else {
    echo "<a data-toggle=\"modal\" href=\"#LoginHeader\"><b>Welcome $username" . '.' . '</b></a>';
}

Open in new window

in header.php.

Somehow, I am able to load the index.php fine if I add this in:

$username = '';
$password = '';

Open in new window


But the instant I remove it...

Notice: Undefined variable: username in /home/a7715142/public_html/header.php on line 112

Open in new window


How do I fix this?
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, I should've passed it as a session var from the beginning!