Your IP : 216.73.217.79


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

<br/><?php
  if (isset($_GET['act'])) {
    if ($_GET['act']=='susp') {//suspend
      $susquery="UPDATE saace_areas SET booked='0', reserved='1' WHERE id='".$_GET['id']."'";
      mysql_query($susquery);
    } elseif ($_GET['act']=='del') {//delete
      $susquery="UPDATE saace_areas SET booked='0', reserved='0', comp_id='0' WHERE id='".$_GET['id']."'";
      mysql_query($susquery);
    } elseif ($_GET['act']=='acti') {//restore
      $susquery="UPDATE saace_areas SET booked='1', reserved='0' WHERE id='".$_GET['id']."'";
      mysql_query($susquery);
      
      $staquery="SELECT * FROM saace_areas WHERE id='".$_GET['id']."'";
      $stares=mysql_query($staquery);
      if ($stares) {
        $starow=mysql_fetch_assoc($stares);
        $selquery="SELECT * FROM saace_company WHERE id='".$starow['comp_id']."'";
        $selres=mysql_query($selquery);
        if ($selres) {
          $selrow=mysql_fetch_assoc($selres);
          $mstr="<html><body><p>
Dear ".$selrow['contact']." (".$selrow['name'].") <br/><br/>Your reservations for the follow stand(s) have been approved. <b>Please note</b> that costs for social areas are R4000.<br/><br/>Stand ".$starow['name']."<br/><br/>Should you have selected the incorrect area and wish to cancel your registration please contact <a href='mailto:events@cesa.co.za'>events@cesa.co.za</a> or Bonolo at +27 (0)11 463 2022 with all your details.<br/><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\nBcc: athromethm@cesa.co.za\r\n";
          mail($selrow['email'],'CESA Social Area booking approved',$mstr,$headers);
          }
      } else {
        echo "Mail could not be sent\n";
      }
    } 
    echo "<script type='text/javascript'>window.location = 'http://www.cesa.co.za/relay/index.php?sec=soci'</script>";
  }
    ?>
      <h1>Confirm Social Area Reservations</h1>
      <table border='0' cellpadding='0' cellspacing='0' width='100%'>
        <tr>
          <th width="10%" align='left'>Stand #</th>
          <th width="71%" align='left'>Company Name (Contact Details)</th>
          <th width="10%" align='left'>Cost</th>
          <th width="9%" align='left'>Approved</th>
        </tr>
        <?php
          $query="SELECT * FROM saace_areas WHERE (reserved=1 OR booked=1) ORDER BY comp_id ASC";
          $result=mysql_query($query);
          if ($result) {
            while ($row=mysql_fetch_assoc($result)) {
              echo "<tr>\n";
                echo "<td>".$row['name']."</td>\n";
                $selquery="SELECT * FROM saace_company WHERE id='".$row['comp_id']."'";
                $selres=mysql_query($selquery);
                if ($selres) {
                  $selrow=mysql_fetch_assoc($selres);
                  echo "<td><strong>".$selrow['name']."</strong>"."  (".$selrow['contact']." - ".$selrow['tele'].")</td>\n";
                } else {
                  echo "<td></td>\n";
                }
                
                $costs=4000;
                if ($row['tent']==1) {
                  $costs+=950;
                } elseif ($row['tent']==2) {
                  $costs+=1100;
                }
                $costs+=($row['chairs']*4.5);
                $costs+=($row['tbles']*15);
                $costs+=($row['rubbish']*17.50);
                $costs+=($row['bath']*24);
                echo "<td>".$costs."</td>\n";
                echo "<td align='center' width='5%'>\n";
                if ($row['booked']=='0') {
                  echo "  <a href='".$pagename."?sec=soci&act=acti&id=".$row['id']."'><img border='0' src='img/restore.gif' alt='Activate'/></a>\n";
                } else {
                  echo "  <a href='".$pagename."?sec=soci&act=susp&id=".$row['id']."'><img border='0' src='img/suspend.gif' alt='Suspend'/></a>\n";
                }
                echo "  <a href='".$pagename."?sec=soci&act=del&id=".$row['id']."' onclick='javascript: return confirm(\"Are you sure you want to delete this reservation for stand ".$row['name']."?\");'><img border='0' src='img/delete.gif' alt='Delete'/></a>\n";
                echo "</td>\n";
              echo "</tr>\n";
            } //end while
          } else {
            echo "<tr><td colspan='4'>No companies have applied yet</td></tr>\n";
          }
        ?>
</table>