} else {
            require "header.php";
            echo "This account is not verified yet. You were emailed a link to verify the account. Please click on the link in the email to continue.";
        }
    } else {
        header("Location: " . $config_basedir . "/login.php?error=1");
    }
} else {
    require "header.php";
    if ($_GET['error']) {
        echo "Incorrect login, please try again!";
    }
    ?>

<form action="<?php 
    echo pf_script_with_get($_SERVER['SCRIPT_NAME']);
    ?>
" method="post">

<table>
<tr>
	<td>Username</td>
	<td><input type="text" name="username"></td>
</tr>
<tr>
	<td>Password</td>
	<td><input type="password" name="password"></td>
</tr>
<tr>
	<td></td>
	<td><input type="submit" name="submit" value="Login!"></td>
        header("Location: " . $config_basedir);
    } else {
        $datarow = mysql_fetch_assoc($dataresult);
        ?>
		<h2>Edit an item</h2>
		<p>
		<?php 
        switch ($_GET['error']) {
            case "date":
                echo "<strong>Invalid date - please choose another!</strong>";
                break;
        }
        ?>
		</p>	
		<form action="<?php 
        echo pf_script_with_get($SCRIPT_NAME);
        ?>
" method="post">
		<table>
		<?php 
        $catsql = "SELECT * FROM categories ORDER BY category;";
        $catresult = mysql_query($catsql);
        ?>
			<tr>
				<td>Category</td>
				<td>
				<select name="cat">
				<?php 
        while ($catrow = mysql_fetch_assoc($catresult)) {
            echo "<option value='" . $catrow['id'] . "'";
            if ($catrow['id'] == $datarow['cat_id']) {