| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/eventtables.php.bak |
<?php
include("inc_db.php");
if (!isset($_POST["action"])) {
?>
<p>Please login with the email address you used and the password provided to you when you registered for the event:</p>
<form method="post" action="/node/524">
<input type="hidden" name="action" value="login">
<table border="0" cellpadding="2">
<tbody>
<tr>
<td>Email address:</td>
<td><input type="text" name="email" size="40"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" size="40"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Login"></td>
</tr>
</tbody>
</table>
</form>
<?php
} else {
if ($_POST["action"]=="login") {
$sql="SELECT * FROM MarketingAttendees WHERE EmailAddress='".$_POST["email"]."' AND Password='".$_POST["password"]."'";
$rec=mysql_query($sql);
if ($row=mysql_fetch_assoc($rec)) {
?>
<p>Welcome, <?php echo $row["ContactFirstName"]." ".$row["ContactLastName"]." (".$row["CompanyName"].")"; ?></p>
<p><b>Please select an available table number below and enter the names of the attendees. A table layout is shown at the bottom of this page for your reference.</b></p>
<form method="post" action="/node/524">
<input type="hidden" name="action" value="choosetable">
<input type="hidden" name="AttendeeID" value="<?php echo $row["AttendeeID"]; ?>">
<input type="hidden" name="AttendeeEmail" value="<?php echo $row["EmailAddress"]; ?>">
<input type="hidden" name="AttendeeName" value="<?php echo $row["ContactFirstName"]." ".$row["ContactLastName"]." (".$row["CompanyName"].")"; ?>">
<table border="0" cellpadding="2">
<tr><td><b>Table:</b></td><td><select name="table">
<?php
$sql="SELECT * FROM MarketingTables WHERE EventID=7 AND EventTableID NOT IN (SELECT EventTableID FROM MarketingTableBookings) ORDER BY TableName";
$recT=mysql_query($sql);
while ($rowT=mysql_fetch_assoc($recT)) {
?><option value="<?php echo $rowT["EventTableID"]; ?>"><?php echo $rowT["TableName"]; ?></option>
<?php
}
?>
</select></td></tr>
<?php
for ($i=1; $i<=10; $i++) {
?>
<tr><td>Attendee name:</td><td><input type="text" name="attendee<?php echo $i; ?>" size="40"<?php if ($i==1) echo " value=\"".$row["ContactFirstName"]." ".$row["ContactLastName"]."\""; ?>></td></tr>
<?php
}
?>
<tr><td colspan="2" align="center"><input type="submit"></td></tr>
</table>
</form>
<img src="/images/awardstables2017.jpg">
<?php
} else {
echo "<div style='border:5px solid red; padding:5px'><b>Email address or password not recognised. <a href='/node/524'>Please login again.</a></b></div>";
}
}
if ($_POST["action"]=="choosetable") {
$sAttendees="";
for ($i=1; $i<=10; $i++) {
$sAttendees.=$_POST["attendee".$i]."\r\n";
}
$sql="INSERT INTO MarketingTableBookings (AttendeeID, DateBooked, NamesBooked, EventTableID) VALUES (".$_POST["AttendeeID"].", '".date("Y-m-d H:i:s")."', '".addslashes(stripslashes($sAttendees))."', ".$_POST["table"].")";
mysql_query($sql);
$sql="SELECT TableName FROM MarketingTables WHERE EventTableID=".$_POST["table"];
$recT=mysql_query($sql);
$rowT=mysql_fetch_assoc($recT);
$sMsg=$_POST["AttendeeName"]." has booked the following table: ".$rowT["TableName"]."\r\n"."\r\n"."Attendees:"."\r\n"."\r\n".$sAttendees;
mail($_POST["AttendeeEmail"], "CESA Aon Awards Table Booking", $sMsg, "CC: patriciaf@cesa.co.za");
?>
<p>Thank you, your table booking has been saved as follows:</p>
<p><?php echo nl2br($sMsg); ?></p>
<?php
}
}
?>