Basically I want to take the first half:<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
if(MAIL){
$q = "SELECT mail_id FROM ".TBL_MAIL." WHERE UserTo = '$session->username' and status = 'unread'";
$numUnreadMail = $database->query($q) or die(mysql_error());
$numUnreadMail = mysql_num_rows($numUnreadMail);
echo "[<a href=\"mail.php\">Inbox ($numUnreadMail)</a>]";
}
?>
[<a href="userinfo.php?user=<?php echo $session->username; ?>">Profile</a>] [<a href="useredit.php">Edit Account</a>]
<?php
if($session->isAdmin()){
echo "[<a href=\"admin/admin.php\">Admin Center</a>] ";
}
echo "[<a href=\"process.php\">Logout</a>]";?>
<?php
}else{
?>
<form action="process.php" method="POST">
<fieldset id="login">
Username:<input type="text" class="login" name="user" value="<?php echo $form->value("user"); ?>"><?php echo $form->error("user"); ?><br />
Password:<input type="password" class="login" name="pass" value="<?php echo $form->value("pass"); ?>"><?php echo $form->error("pass"); ?><br />
<input type="checkbox" name="remember" <?php if($form->value("remember") != ""){ echo "checked"; } ?>> Remember me.
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"><p />
<a href="forgotpass.php">I forgot my password</a> |
<a href="#">Resend activation e-mail<p /></a>
</fieldset>
<?php
if(EMAIL_WELCOME){
echo "<p>Do you need a Confirmation email? <a href='valid.php'>Send!</a></p>";
}
?>
</form>
<div class="clear"></div>
<h1>Register</h1>
<p>Use of this site does not require you to be a registered user. Before you register please ensure you are familiar with our terms of use and related policies.</p>
<a href="#">Terms of Use</a> | <a href="#">Register</a>
<?php
}
?>
And seperate it from the second half putting it in its own file and than linking it back to the other one usingthe include function. Everytime I try to do that though I get an error. It doesn't matter where I split the code. Is there some sort of function I can use to correct this?<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
if(MAIL){
$q = "SELECT mail_id FROM ".TBL_MAIL." WHERE UserTo = '$session->username' and status = 'unread'";
$numUnreadMail = $database->query($q) or die(mysql_error());
$numUnreadMail = mysql_num_rows($numUnreadMail);
echo "[<a href=\"mail.php\">Inbox ($numUnreadMail)</a>]";
}
?>
[<a href="userinfo.php?user=<?php echo $session->username; ?>">Profile</a>] [<a href="useredit.php">Edit Account</a>]
<?php
if($session->isAdmin()){
echo "[<a href=\"admin/admin.php\">Admin Center</a>] ";
}
echo "[<a href=\"process.php\">Logout</a>]";?>
<?php
}else{
?>