prepare("SELECT COUNT(*) AS user_count FROM {$opt["table_prefix"]}users"); $stmt->execute(); if ($row = $stmt->fetch()) { $user_count = $row["user_count"]; if ($user_count != 0) { die("Database has already been set up."); } } else { die("Database has not been created."); } if (isset($_POST["action"])) { if ($_POST["action"] == "setup") { $username = $_POST["username"]; $fullname = $_POST["fullname"]; $pwd = $_POST["pwd"]; $email = $_POST["email"]; $familyname = $_POST["familyname"]; if (trim($familyname) == "") { $familyname = "Default family"; } // 1. create the family. $stmt = dbh($opt)->prepare("INSERT INTO {$opt["table_prefix"]}families(familyname) VALUES(?)"); $stmt->bindParam(1, $familyname, PDO::PARAM_STR); $stmt->execute(); // 2. get the familyid. $stmt = dbh($opt)->prepare("SELECT MAX(familyid) AS familyid FROM {$opt["table_prefix"]}families"); $stmt->execute(); if ($row = $stmt->fetch()) { $familyid = $row["familyid"]; } else die("No family was created."); // 3. insert the user. $stmt = dbh($opt)->prepare("INSERT INTO {$opt["table_prefix"]}users(username,fullname,password,email,approved,admin,initialfamilyid) VALUES(?, ?, {$opt["password_hasher"]}(?), ?, 1, 1, ?)"); $stmt->bindParam(1, $username, PDO::PARAM_STR); $stmt->bindParam(2, $fullname, PDO::PARAM_STR); $stmt->bindParam(3, $pwd, PDO::PARAM_STR); $stmt->bindParam(4, $email, PDO::PARAM_STR); $stmt->bindParam(5, $familyid, PDO::PARAM_INT); $stmt->execute(); // 4. get the userid. $stmt = dbh($opt)->prepare("SELECT MAX(userid) AS userid FROM {$opt["table_prefix"]}users"); $stmt->execute(); if ($row = $stmt->fetch()) { $userid = $row["userid"]; } else die("No user was created."); // 5. create the membership. $stmt = dbh($opt)->prepare("INSERT INTO {$opt["table_prefix"]}memberships(userid,familyid) VALUES(?, ?)"); $stmt->bindParam(1, $userid, PDO::PARAM_INT); $stmt->bindParam(2, $familyid, PDO::PARAM_INT); $stmt->execute(); } } ?> Gift Registry - Setup

Thank you for setting up the Gift Registry. You may now login and begin!

Below are your configuration values. If you would like to change anything, edit config.php. Each value's purpose is described in config.php.

$value) { ?>
"; $parts = pathinfo($_SERVER["SCRIPT_FILENAME"]); $image_dir = $parts['dirname'] . "/" . $opt["image_subdir"]; $writeable = is_writable($image_dir); if ($writeable) { echo "$image_dir is writeable, images can be uploaded."; } else { echo "$image_dir is NOT writeable, images cannot be uploaded. Either chmod this directory to allow the web server to write to it, or disable image uploading in config.php."; } echo "

"; // check if Smarty works. echo "

Testing Smarty installation... ensure the result is OK.

"; require_once(dirname(__FILE__) . "/includes/MySmarty.class.php"); $smarty = new MySmarty(); $smarty->testInstall(); ?>
Set Up the Gift Registry

This installation of the Gift Registry is not complete. Please create the initial administrator user, name the default family, then click Submit.

Admin username "/>
Admin password
Confirm admin password
Admin full name " />
Admin e-mail address " />
Default/initial family name " />