Your IP : 216.73.217.117


Current Path : /var/www/cesa.co.za/relay/include/
Upload File :
Current File : /var/www/cesa.co.za/relay/include/areas.php

<?php
  if (isset($_GET['act'])) {
    if ($_GET['act']=='res') {//suspend
	
	$areaquery="SELECT comp_id FROM saace_areas WHERE id='".$_POST['area']."'";
	$areares=mysql_query($areaquery);
	$arearow=mysql_fetch_assoc($areares);
	
	if($arearow['comp_id'] != '0'){
				
		//$zErrorMsg = "Sorry, but stand ".$_POST['area']." is already been reserved. Please choose another stand.";
		echo "<h1>Error</h1>Sorry, stand ".$_POST['area']." has already been reserved. Please <a href='".$pagename."?sec=area'>Go back to areas</a> and choose another stand.\n";
		
	} else {
		
      $uquery="SELECT comp_id FROM saace_user WHERE id='".$_POST['uid']."'";
          $ures=mysql_query($uquery);
          if ($ures) {
            $urow=mysql_fetch_assoc($ures);
			
            if ($_POST['braai']=='') {
              $resquery="UPDATE saace_areas SET reserved='1',comp_id='".$urow['comp_id']."',chairs='".$_POST['chairs']."',tent='".$_POST['tent']."',braai='0',tbles='".$_POST['table']."',rubbish='".$_POST['bin']."',bath='".$_POST['bath']."' WHERE id='".$_POST['area']."'";
            } else {
              $resquery="UPDATE saace_areas SET reserved='1',comp_id='".$urow['comp_id']."',chairs='".$_POST['chairs']."',tent='".$_POST['tent']."',braai='1',tbles='".$_POST['table']."',rubbish='".$_POST['bin']."',bath='".$_POST['bath']."' WHERE id='".$_POST['area']."'";
            }
            mysql_query($resquery);
          }
          $total=4000;
                   
          $costs="Stand ".$_POST['area']."<br/>";
          $selquery="SELECT * FROM saace_company WHERE id='".$urow['comp_id']."'";
          $selres=mysql_query($selquery);
          if ($selres) {
            $selrow=mysql_fetch_assoc($selres);
            $mstr="<html><body><p>".$selrow['contact']." from ".$selrow['name']." has reserved the following stand(s)in the social area for the CESA Relay race. <br/><br/>".$costs."Total cost : R ".$total.".00<br/><br/>Please login to <a href='http://www.cesa.co.za/relay'>http://www.cesa.co.za/relay</a> to approve the reservations.<br/><br/>CESA Relay Website</p></body></html>";
            $cmstr="<html><body><p>Dear ".$selrow['contact']."<br/><br/>Thank you for reserving an area, for the CESA Relay race.  <br/><br/>You will be issued with an invoice on which you will find the banking details.<br/><br/>
Hospitality Site Bookings: Please order marquees and furniture from the hospitality coordinator.<br>
Contact Person: Zandi<br>
Tel: 067 334 1198<br>
Email: <a href='mailto:info@trxn.co.za'>info@trxn.co.za</a><br><br>
Regards,<br>
CESA RELAY Admin. <br/><br/><a href='mailto:events@cesa.co.za'>events@cesa.co.za</a><br/><img src='http://www.cesa.co.za/relay/img/eMailLogo.gif' alt='Logo'></p></body></html>";
    //mail client
        $headers = "From: ".$admin_email."\r\n"."Reply-To: ".$admin_email."\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nBcc: events@cesa.co.za\r\n";
        mail($admin_email."",'CESA Social Area reserved',$mstr,$headers);
        mail($selrow['email'],'CESA Social Area reserved',$cmstr,$headers);
          }
          echo "<h1>Area reserved</h1><a href='".$pagename."?sec=area'>Go to areas</a>\n";
    }
	}
  } else {//list
    ?>
<h1>Social Area Reservations now open.
</h1>
            <p>Please select your desired location from the map below.</p>
            <p><center><img border='0' src='img/relaylayout2019.jpg'/></center></p>
            <table cellspacing="0" cellpadding="0">
              <tr>
                <td><strong>Notes:</strong></td>
              </tr>
              <tr>
                <td><p><span id="Label1">A supplier has been appointed to supply all marquees, chairs etc. </span><span id="Label2">Supplier details are as follows:<br>
Please email: <a href="mailto:info@trxn.co.za">info@trxn.co.za</a><br />
Or call
Zandi on
067 334 1198<br></span>&nbsp;<span id="Label4">Please  select your site(s) and confirm  your booking by making your payment. You will be issued with an invoice on which you will find the banking details.</span></p></td>
              </tr>
              <tr>
                <td></td>
              </tr>
              <tr>
                <td></td>
              </tr>
            </table>
            <p>&nbsp;</p>
            
            
            <?php
              $query="SELECT * FROM saace_areas WHERE reserved='0' AND booked='0' ORDER BY id ASC";
              $result=mysql_query($query);
              if (mysql_num_rows($result)) {
               ?>
               <form method='POST' action='<?php echo $pagename; ?>?sec=area&act=res'>
               <input type="hidden" name="uid" value="<?php echo $_SESSION["uid"]; ?>">
                  <table width='100%' border='0' cellpadding='0' cellspacing='0'>
                 
                  <tr>
                    <td>Area (cost R4000)</td>
                    <td>
                      <select name='area'>
                        <?php
                          while ($row=mysql_fetch_assoc($result)) {
                            echo "<option value='".$row['id']."'>Stand ".$row['name']."</option>\n";
                          }
                        ?>
                      </select>                    </td>
                  </tr>
                  <!--<tr>
                    <td>Tent Required</td>
                    <td>
                      <select name='tent'>
                        <option value='0'>No Tent</option>
                        <option value='1'>White 2 Section Tent 6 x 6.8 (R950)</option>
                        <option value='2'>White 3 Section Tent 6 x 10.2 (R1100)</option>
                      </select>                    </td>
                  </tr>
                  <tr>
                    <td>Chairs (cost R4.50 each)</td>
                    <td>
                      <input type='text' name='chairs' value='0'/>                    </td>
                  </tr>
                  <tr>
                    <td>Table 1.8m x 75cm (cost R15)</td>
                    <td>
                      <input type='text' name='table' value='0'/>                    </td>
                  </tr>
                  <tr>
                    <td>Rubbish Bin with Lid (Min 1) (cost R17.50)</td>
                    <td>
                      <input type='text' name='bin' value='1'/>                    </td>
                  </tr>
                  <tr>
                    <td>Galvanised Bath (cost R24 each)</td>
                    <td>
                      <input type='text' name='bath' value='0'/>                    </td>
                  </tr>
                  <tr>-->
                    <td colspan='2'><input type='checkbox' name='braai' value='1'/>Would you like to make use of the communal braai area?</td>
                  </tr>
                  <tr>
                    <td colspan='2' align='center'>
                      <input type='submit' name='boo_sub' value='Book'/>                   </td>
                  </tr>
                  </table>
                  </form>
                <?php
              }else{
            ?><table><tr><td><h2>All Social Areas have been booked / reserved</h2></td></tr></table><?php };?>
            
      <table width='100%' border='0' cellpadding='0' cellspacing='0'>
        <tr>
          <th align='left'>Area</th>
          <th align='left'>Company</th>
          <th align='left'>Status</th>
        </tr>
        <?php
             $query="SELECT * FROM saace_areas WHERE reserved='1' OR booked='1' ORDER BY id ASC";
          $result=mysql_query($query);
          if ($result) {
            $bgcnt=1;
            while ($row=mysql_fetch_assoc($result)) {
              echo "<tr";
              if ($bgcnt%2==0) {
                echo " class='odd'";
              } else {
                echo " class='even'";
              }
              echo ">\n";
                echo "<td>".$row['name']."</td>\n";
                $cquery="SELECT name FROM saace_company WHERE id='".$row['comp_id']."'";
                $cres=mysql_query($cquery);
                if ($cres) {
                  $crow=mysql_fetch_assoc($cres);
                  echo "<td>".$crow['name']."</td>\n";
                } else {
                  echo "<td></td>\n";
                }
                if ($row['booked']=='1') {
                  echo "<td>Booked</td>\n";
                } elseif ($row['reserved']=='1') {
                  echo "<td>Reserved</td>\n";
                }
                
              echo "</tr>\n";
              $bgcnt++;
            } //end while
          } else {
          }
        ?>
      </table>
      <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    <?php
  }
?>