$account_id = $fbId; } else { #create a randomly large id $account_id = rand(1, 999) . rand(1, 999) . rand(1, 999); } $sql = "INSERT INTO " . $db_prefix . "account (facebook_id, username, password, name, email, location, gender, ip, registration_date, handle, active_ship, user_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $data = array($fbId, $register['username'], md5($register['password']), $register['name'], $register['email'], $location, $register['gender'], $_SERVER['REMOTE_ADDR'], $time_date_full, $register['handle'], 0, $account_id); $sth = $db->prepare($sql); if ($sth->execute($data)) { $sql_manager = new manage_table(); /* Now Create Ship (need to code in a way to allow multiple ships - future feature....) */ ## ##get user id from the newly created account $user_account_id = $sql_manager->find_account_id($register['username']); ##create ship from new id $create_ship = $sql_manager->create_user_space_ship($user_account_id, $register['shipname'], $register['handle'], $register['email'], $time_date_full, $_SERVER['REMOTE_ADDR']); if ($create_ship) { ##update user account with active ship ################## ## not implementing multiple ships yet, however when we do, first value needs to be set differently with anothe call asking for the ship id ################## $set_active_ship = $sql_manager->set_active_ship($user_account_id, $user_account_id); if ($set_active_ship) { $status = $user->login($register['username'], $register['password']); } else { echo "Error setting your ship as active"; die; } } else {