Need help with registration form

I’m trying to implement the UserCake user system into my website. The problem I’m having is when I submit the register form whether it’s blank or filled in incorrectly I get a success message and do not know why was hoping someone can help me out. I’m using the original code that came with the script just inserted into my design nothing structurally has changed with the code. Here’s the code of the register.php file I’m having trouble with:
[php]<?php
/*
UserCake Version: 1.4
http://usercake.com

	Developed by: Adam Davis
*/
require_once("models/config.php");

//Prevent the user visiting the logged in page if he/she is already logged in
if(isUserLoggedIn()) { header("Location: account.php"); die(); }

?>

<?php /* Below is a very simple example of how to process a new user. Some simple validation (ideally more is needed). The first goal is to check for empty / null data, to reduce workload here we let the user class perform it's own internal checks, just in case they are missed. */ //Forms posted if(!empty($_POST)) { $errors = array(); $email = trim($_POST["email"]); $username = trim($_POST["username"]); $password = trim($_POST["password"]); $confirm_pass = trim($_POST["passwordc"]); //Perform some validation //Feel free to edit / change as required if(minMaxRange(5,25,$username)) { $errors[] = lang("ACCOUNT_USER_CHAR_LIMIT",array(5,25)); } if(minMaxRange(8,50,$password) && minMaxRange(8,50,$confirm_pass)) { $errors[] = lang("ACCOUNT_PASS_CHAR_LIMIT",array(8,50)); } else if($password != $confirm_pass) { $errors[] = lang("ACCOUNT_PASS_MISMATCH"); } if(!isValidEmail($email)) { $errors[] = lang("ACCOUNT_INVALID_EMAIL"); } //End data validation if(count($errors) == 0) { //Construct a user object $user = new User($username,$password,$email); //Checking this flag tells us whether there were any errors such as possible data duplication occured if(!$user->status) { if($user->username_taken) $errors[] = lang("ACCOUNT_USERNAME_IN_USE",array($username)); if($user->email_taken) $errors[] = lang("ACCOUNT_EMAIL_IN_USE",array($email)); } else { //Attempt to add the user to the database, carry out finishing tasks like emailing the user (if required) if(!$user->userCakeAddUser()) { if($user->mail_failure) $errors[] = lang("MAIL_ERROR"); if($user->sql_failure) $errors[] = lang("SQL_ERROR"); } } } } ?> BeatBarn
<a id="log" href="#">Login</a>/<a id="log" href="/register.php">Register</a>
</div>
<hr />
<div id="navbar">
    <ul id="css3menu1" class="topmenu">
    <li class="topmenu"><a class="pressed" href="/" title="Home" style="height:24px;line-height:24px;"><img src="/images/home.png" alt="Home"/>Home</a></li>
    <li class="topmenu"><a href="/buybeats.php" title="Buy Beats" style="height:24px;line-height:24px;"><span><img src="/images/shopping_cart.png" alt="Buy Beats"/>Buy Beats</span></a>
    <ul>
    <li><a href="/buybeats.php" title="All">All</a></li>
    <li><a href="/buybeats.php?type=ne" title="Non-Exclusive">Non-Exclusive</a></li>
    <li><a href="/buybeats.php?type=e" title="Exclusive">Exclusive</a></li>
    </ul>

    </li>
    <li class="topmenu"><a href="/sellbeats.php" title="Sell Beats" style="height:24px;line-height:24px;"><img src="/images/sale.png" alt="Sell Beats"/>Sell Beats</a></li>
    <li class="topmenu"><a href="/uploadbeat.php" title="Upload a Beat" style="height:24px;line-height:24px;"><img src="/images/add.png" alt="Upload a Beat"/>Upload a Beat</a></li>
    <li class="topmenu"><a href="/forum/" title="Forum" style="height:24px;line-height:24px;"><img src="/images/comments.png" alt="Forum"/>Forum</a></li>
    </ul>
</div>
<div id="logo">
  
</div>

Register

<?php if(!empty($_POST)) { if(count($errors) > 0) { ?>
<?php errorBlock($errors); ?>
<?php } else {
        	$message = lang("ACCOUNT_REGISTRATION_COMPLETE_TYPE1");
    
        	if($emailActivation)
			{
           		 $message = lang("ACCOUNT_REGISTRATION_COMPLETE_TYPE2");
			}
    ?> 
    <div id="success">
    
       <p><?php echo $message ?></p>
       
    </div>
    <?php } }?>
        <div id="regbox">
            <form name="newUser" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
            
            <p>
                <label>Username:</label>
                <input type="text" name="username" />
            </p>
            
            <p>
                <label>Password:</label>
                <input type="password" name="password" />
            </p>
            
            <p>
                <label>Confirm:</label>
                <input type="password" name="passwordc" />
            </p>
            
            <p>
                <label>Email:</label>
                <input type="text" name="email" />
            </p>
            
            <p>
                <label>&nbsp;</label>
                <input type="submit" value="Register"/>
            </p>
            
            </form>
        </div>
		<div class="clear"></div>
 	</div>
</div>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/footer.php'); ?> [/php]

Disregard was the file transfer method in FTP program uploading it with ASCII and it was making the file all one line and with comments it commented out some of the code >:(

Sponsor our Newsletter | Privacy Policy | Terms of Service