<?PHP

$users = "$prefix" . "USERS";

if (!empty($_POST)) {
        $SQL = "SELECT * from $users WHERE USERNAME = '$_POST[USERNAME]'";
        $result = mysql_query( $SQL );
        $row = mysql_fetch_array( $result );

        if (empty($row[USERNAME])) {

                $sql            = "INSERT INTO $users SET
                USERNAME        = '$_POST[USERNAME]',
                PASSWORD        = '$_POST[PASSWORD]',
                EMAIL           = '$_POST[EMAIL]',
                FIRSTNAME       = '$_POST[FIRSTNAME]',
                LASTNAME        = '$_POST[LASTNAME]'";
                $query          = mysql_query($sql);

                $createaccount = 1;
                $_GET[qun] = $_POST[USERNAME];
                $_GET[qpw] = $_POST[PASSWORD];
                $_SESSION[username] = $_POST[USERNAME];
                $_SESSION[password] = $_POST[PASSWORD];
                $_SESSION[firstname] = $_POST[FIRSTNAME];
                $_SESSION[lastname] = $_POST[LASTNAME];
                $_SESSION[email] = $_POST[EMAIL];

        }

        if (!empty($row[USERNAME])) {

        $error = " (<font color=red>That username is already in use.</font>)";
        include "register.php";

        }

}
?>
<?PHP if ($createaccount == 1) { ?>
<div class="formbox" style="width: 100%; margin-bottom:15px;">
<h1><?PHP /* (LANGUAGE) */ $t = "Account Created Successfully"; $f = "accountcreatedheader"; $altpage = homefront; include "langinc.php"; /* (LANGUAGE) */ ?></h1>
<?PHP /* (LANGUAGE) */ $t = "Your account has been created and you have been logged in."; $f = "accountcreatedmessage"; $altpage = homefront; include "langinc.php"; /* (LANGUAGE) */ ?>
<h3 style="margin-top: 15px;"><a href="index.php?page=<?php echo $_GET[back]; ?>&id=<?php echo $_GET[id]; ?>"><?PHP /* (LANGUAGE) */ $t = "Continue"; $f = "accountcreatedcontinue"; $altpage = homefront; include "langinc.php"; /* (LANGUAGE) */ ?></a></h3>
</div>
<?PHP } ?>
