rowid_set_values($guests, $guest, array("event" => $event, "name" => $org, "email" => $email));
             rowid_set_values($events, $event, array("organizer" => $guest, "time" => $event_time));
             $hash = hash_id("guest", "{$guest}");
             rowid_set_values($guests, $guest, array("hash" => $hash));
             if ($reply == "N") {
                 $heads = 0;
             } else {
                 if ($heads < 1) {
                     $heads = 1;
                 } else {
                     if ($heads > 50) {
                         $heads = 50;
                     }
                 }
             }
             rowid_set_values($guests, $guest, array("reply" => $reply, "heads" => $heads, "comments" => $comments));
             $server = $HTTP_SERVER_VARS["SERVER_NAME"];
             email_manage_url(stripslashes($name), stripslashes($email), $server, "http://{$server}{$redirect}");
             $message = "Event created.<BR><SPAN STYLE=\"font-size: smaller;\">A message has been sent to your email address with a URL to manage your event.</SPAN>";
         } else {
             $error = "Database error.";
         }
     } else {
         $error = "Database error.";
     }
     unset($guest);
     unset($event);
     unset($guests);
     unset($events);
     toilet_close($db);
 } else {
function process_reply($guests, $guest)
{
    $reply = $_REQUEST["reply"];
    $heads = $_REQUEST["heads"];
    $comments = $_REQUEST["comments"];
    if ($reply == "N") {
        $heads = 0;
    } else {
        if ($heads < 1) {
            $heads = 1;
        } else {
            if ($heads > 50) {
                $heads = 50;
            }
        }
    }
    rowid_set_values($guests, $guest, array("reply" => $reply, "heads" => $heads, "comments" => $comments));
    get_reply($guests, $guest);
    return 0;
}
                         $error = "Database error.";
                     }
                 }
                 if (!$error) {
                     $rows = gtable_query($guests, "event", $id);
                     foreach ($rows as $guest) {
                         $name = $_REQUEST["name_{$guest}"];
                         $email = $_REQUEST["email_{$guest}"];
                         $row = rowid_get_row($guest, array("name", "email"));
                         if ($row["name"] != $name) {
                             rowid_set_values($guests, $guest, array("name" => $name));
                         }
                         /* can't change the organizer email address */
                         if ($guest != $org_id) {
                             if ($row["email"] != $email) {
                                 rowid_set_values($guests, $guest, array("email" => $email, "emails" => 0));
                             }
                         }
                     }
                     $row = rowid_get_row($guests, $org_id, array("name", "email"));
                     if ($row) {
                         $org = $row["name"];
                         $org_email = $row["email"];
                     } else {
                         $error = "Database error.";
                     }
                 }
             }
         }
     }
 }