include("header.php");
include_once("query.php");
include_once("entry.php");
?>
Please enter company info to get started.
After entering company info, you will then be prompted for user info.
# force inserts to sit in $_SESSION for the time being.
hold_inserts(true);
$e = new company_entry;
if (is_array($_SESSION["HELD_INSERTS"])){
if (count($_SESSION["HELD_INSERTS"])){
$id = 0;
if (strlen($_POST["new_username"])){
$u = $_POST["new_username"];
if (! strlen($_POST["new_password"]) || ! strlen($_POST["new_confirm"])){
$err = "You must enter both a password and a pw confirmation.";
} else if ($_POST["new_password"] != $_POST["new_confirm"]){
$err = "Password and confirmation must match.";
} else {
$p = $_POST["new_password"];
$existing_users =
run_query("SELECT * FROM `users` WHERE `username`='$u'");
if (count($existing_users)){
$err = "'$u' is not a permissable username. Please choose another.";
} else {
hold_inserts(false);
$id = insert_query("INSERT INTO `users` VALUES ('', '$u', OLD_PASSWORD('$p'), 'customer', MD5('$p'))");
$_SESSION["HELD_INSERTS"][0] = str_replace("'')", "'$id')", $_SESSION["HELD_INSERTS"][0]);
release_inserts();
// aww yeah. i rock.
$_SESSION = array();
print "User '$u' has been created. You may now log in.";
$success = 1;
}
}}
if (!$success){
?>