Kevin & Kristen's Wedding
spacer
RSVP
Thank you for your RSVP!
For directions and other other information please click here
"; } else if (isset($_POST['fname']) && isset($_POST['lname']) && isset($_POST['ad']) && isset($_POST['thect']) && isset($_POST['gid'])) { $myGuestID = $_POST['gid']; $willshow = $_POST['ad']; $guestct = $_POST['thect']; // INSERT RECORD IN DB $db = mysql_connect("mysql1201.hostexcellence.com", "kpechin_rsvp", "rsvp_90210") or die('Could not connect to db' . mysql_error()); mysql_select_db('php', $db); // SEE IF THEY ALREADY FILLED THIS IN $result5 = mysql_query("SELECT * FROM kpechin_rsvp.guests a, kpechin_rsvp.rsvp b where a.responseid = b.responseid and b.responseid = $myGuestID", $db) or die("Query 5 failed: " . mysql_error()); if (mysql_num_rows($result5) == 0) { $insertUser = mysql_query("INSERT INTO kpechin_rsvp.rsvp (responseid, willshow, guestct, regdatetime, filledOnline) VALUES ($myGuestID, $willshow, $guestct, Now(), 1)") or die("Query 3 failed: " . mysql_error()); $themsg = "Guest ID: " . $myGuestID . chr(10); $themsg .= "Will Show: " . $willshow . chr(10); $themsg .= "Guest Count: " . $guestct . chr(10); $themsg .= "IP: " . $_SERVER["REMOTE_ADDR"]; mail("kpechin@gmail.com", "RSVP", $themsg); } echo ""; } else if (isset($_POST['fname']) && isset($_POST['lname'])) { $thefname = strtoupper($_POST['fname']); // GUESTS CAN'T LOG IN - SHORT CIRCUIT HERE if ($thefname == "GUEST") { $thefname = "-----------"; } $thelname = strtoupper($_POST['lname']); $theresid = $_POST['rid']; $db = mysql_connect("mysql1201.hostexcellence.com", "kpechin_rsvp", "rsvp_90210") or die('Could not connect to db' . mysql_error()); mysql_select_db('php', $db); $result = mysql_query("SELECT * FROM kpechin_rsvp.guests WHERE (UCASE(fname) = '$thefname' OR UCASE(nick) = '$thefname') AND UCASE(lname)='$thelname' AND responseid = $theresid", $db) or die("Query 1 failed: " . mysql_error()); if (mysql_num_rows($result) > 0 ) { // IF FIRST NAME AND LAST NAME MATCH THEN CHECK TO SEE IF THEY HAVE ALREADY REGISTERED while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $myGuestID = $row["responseid"]; // $result2 = mysql_query("SELECT * FROM kpechin_rsvp.rsvp WHERE responseid = $myGuestID", $db) or die("Query 2 failed: " . mysql_error()); $result2 = mysql_query("SELECT * FROM kpechin_rsvp.guests a, kpechin_rsvp.rsvp b where a.responseid = b.responseid and b.responseid = $myGuestID", $db) or die("Query 2 failed: " . mysql_error()); if (mysql_num_rows($result2) > 0) { echo "You have already filled in this form with the following data:

"; if ($iWillAttend == 1) { echo " "; } echo "
Guests "; $tmpCnt = 1; while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) { $dateTimeReg = date('m/d/Y h:i A', strtotime($row["regdatetime"])); $iWillAttend = $row["willshow"]; $iTotalAttend = $row["guestct"]; if ($iWillAttend == 1) { $sWillAttend = "Yes"; } else { $sWillAttend = "No"; } $iGuestAttending = $row["guestct"]; $guest = $row["fname"] . " " . $row["lname"]; if (mysql_num_rows($result2) > 1 && $tmpCnt == 1) { $guest = $guest . " & "; } $tmpCnt = $tmpCnt + 1; echo "$guest"; } echo "
Date/Time Registered (EST): $dateTimeReg
Will you be attending: $sWillAttend
Number of People Attending $iTotalAttend

If this information is incorrect, please e-mail me at: kpechin@gmail.com or give either of our parents a call.

For directions and other other information please click here "; } else { echo "
"; $result3 = mysql_query("SELECT fname FROM kpechin_rsvp.guests WHERE responseid = $myGuestID", $db) or die("Query 1 failed: " . mysql_error()); if (mysql_num_rows($result3) > 0) { echo "Welcome "; $tmpct = 1; while ($row = mysql_fetch_array($result3, MYSQL_ASSOC)) { echo $row["fname"]; if (mysql_num_rows($result3) > 1 && $tmpct == 1) { echo " & "; } $tmpct = $tmpct + 1; } } echo "
Accept with pleasure
Decline with regret
Total Number of Persons Attending
"; } } } else { // REDIRECT THE USER IF LOGIN FAILED $theerrmsg = urlencode("Guest Not Found, or Reservation Number is incorrect.
Please try again, or e-mail me at: kpechin@gmail.com"); echo ""; } } else { // QUERY FOR CURRENT TALLY /* $db = mysql_connect("mysql1201.hostexcellence.com", "kpechin_rsvp", "rsvp_90210") or die('Could not connect to db' . mysql_error()); mysql_select_db('php', $db); // SEE IF THEY ALREADY FILLED THIS IN $resultYes = mysql_query("SELECT sum(guestct) AS 'theCount' FROM kpechin_rsvp.rsvp WHERE willshow = 1", $db) or die("Query 5 failed: " . mysql_error()); $resultNo = mysql_query("SELECT sum(guestct) AS 'theCount' FROM kpechin_rsvp.rsvp WHERE willshow = 0", $db) or die("Query 5 failed: " . mysql_error()); echo ("
Current Tally
\"Woof
Yes'
\"Bow
No's
"); while ($row = mysql_fetch_array($resultYes, MYSQL_ASSOC)) { echo $row["theCount"]; } echo (" "); while ($row = mysql_fetch_array($resultNo, MYSQL_ASSOC)) { if ($row["theCount"] == "") { echo ("0"); } else { echo $row["theCount"]; } } echo ("


"); */ echo("Thank you everyone who attended.
We all had a great time and we hope to see everyone soon!"); /* echo("
Feel free to either fill out the RSVP online or return your card in the mail.
If you would like to continue online, please enter the first name and last name
of one person on the invitation:


First Name
Last Name
Reservation Number Where is this?

$themsg
"); */ } ?>