if (!$error && $month && $day && $year && $ampm && $org && $email) { if ($ampm == "PM") { $hour += 12; } $event_time = mktime($hour, $min, 0, $month, $day, $year); toilet_init($toilet_init_path); $db = toilet_open($toilet_db_path); $events = toilet_gtable($db, "events"); $guests = toilet_gtable($db, "guests"); $event = gtable_new_row($events); if ($event) { rowid_set_values($events, $event, array("name" => $name, "description" => $desc, "location" => $where)); $hash = hash_id("event", "{$event}"); rowid_set_values($events, $event, array("hash" => $hash)); $redirect = "manage.php?event={$hash}"; $guest = gtable_new_row($guests); if ($guest) { 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; } }
$comments = $row["comments"]; $rows = gtable_query($guests, "id", $org_id); if (count($rows)) { $row = rowid_get_row($guests, $rows[0], array("name", "email")); $org = $row["name"]; $org_email = $row["email"]; } if (!$comments) { $comments = "Please check out the details on the Invite-o-toilet invitation online."; } $action = $_REQUEST["action"]; if ($action == "Invite" || $action == "Invite & Email message below") { $guest = $_REQUEST["guest"]; $email = $_REQUEST["email"]; if ($guest && $email) { $guest_id = gtable_new_row($guests); rowid_set_values($guests, $guest_id, array("event" => $id, "name" => $guest, "email" => $email, "emails" => 0)); $hash = hash_id("guest", "{$guest_id}"); rowid_set_values($guests, $guest_id, array("hash" => $hash)); if ($action != "Invite") { $email = stripslashes($email); $server = $HTTP_SERVER_VARS["SERVER_NAME"]; $n_comments = stripslashes($_REQUEST["comments"]); email_invite_url(stripslashes($title), $email, "http://{$server}/?invite={$hash}", $guest, $org, $org_email, $n_comments); rowid_set_values($guests, $guest_id, array("emails" => 1)); if (isset($_REQUEST["save"])) { rowid_set_values($events, $id, array("comments" => $n_comments)); $comments = stripslashes($n_comments); } } }