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/payments.php

<br/><?php
  if (isset($_GET['act'])) {
    if ($_GET['act']=='susp') {//suspend
      $susquery="UPDATE saace_team SET paid='0' WHERE id='".$_GET['id']."'";
      mysql_query($susquery);
    } elseif ($_GET['act']=='acti') {//restore
      $susquery="UPDATE saace_team SET paid='1' WHERE id='".$_GET['id']."'";
      mysql_query($susquery);
      
      $tquery="SELECT * FROM saace_team WHERE id='".$_GET['id']."'";
      $tres=mysql_query($tquery);
      if ($tres) {
        $trow=mysql_fetch_assoc($tres);
        $selquery="SELECT * FROM saace_company WHERE id='".$trow['comp_id']."'";
        $selres=mysql_query($selquery);
        if ($selres) {
          $selrow=mysql_fetch_assoc($selres);
          $mstr="<html><body><p>
Dear ".$selrow['contact']." <br/><br/>Your payment for the following team(s) have been approved.<br/><br/>".$trow['name']."<br/><br/>Should you have any questions 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 Admin <br/><br/><a href='mailto:events@cesa.co.za'>events@cesa.co.za</a><br/><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($selrow['email'],'CESA Team Payment acknowledged',$mstr,$headers);
          }
      } else {
        echo "Mail could not be sent\n";
      }
    } elseif ($_GET['act']=='asusp') {//suspend
      $susquery="UPDATE saace_areas SET paid='0' WHERE id='".$_GET['id']."'";
      mysql_query($susquery);
    } elseif ($_GET['act']=='aacti') {//restore
      $susquery="UPDATE saace_areas SET paid='1' 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']." <br/><br/>Your payment for the follow area(s) have been approved.<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 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($selrow['email'],'CESA Social Area Payment acknowledged',$mstr,$headers);
          }
      } else {
        echo "Mail could not be sent\n";
      }
    }
  }
    ?>
      <br/>
      <h1>Payment Approval</h1>
      <table border='0' cellpadding='0' cellspacing='0' width='100%'>
        <tr>
          <th align='left'>Company</th>
          <th align='left'>Team</th>
          <th align='left'>Social Area</th>
          <th align='left'>Approved</th>
        </tr>
        <?php
          $bgcnt=1;
          $query="SELECT * FROM saace_company WHERE status='1' ORDER BY name ASC";
          $result=mysql_query($query);
          if ($result) {
            while ($row=mysql_fetch_assoc($result)) {
              $selquery="SELECT * FROM saace_team WHERE comp_id='".$row['id']."'";
              $selres=mysql_query($selquery);
              if ($selres && mysql_num_rows($selres)>0) {
                while ($selrow=mysql_fetch_assoc($selres)) {
                  echo "<tr";
                  if ($bgcnt%2==0) {
                    echo " class='odd'";
                  } else {
                    echo " class='even'";
                  }
                  echo ">\n";
                  echo "<td>".$row['name']."</td>\n";
                  echo "<td>".$selrow['name'];
                  $typquery="SELECT * FROM saace_teamtype WHERE id='".$selrow['type']."'";
                  $typres=mysql_query($typquery);
                  if ($typres) {
                    $typrow=mysql_fetch_assoc($typres);
                    echo " - ".$typrow['name']."</td>\n";
                  }
                  echo "<td></td>\n";
                  echo "<td align='center'>\n";
                  if ($selrow['paid']=='0') {
                    echo "  <a href='".$pagename."?sec=pay&act=acti&id=".$selrow['id']."'><img border='0' src='img/restore.gif' alt='Activate'/></a>\n";
                  } else {
                    echo "  <a href='".$pagename."?sec=pay&act=susp&id=".$selrow['id']."'><img border='0' src='img/suspend.gif' alt='Suspend'/></a>\n";
                  }
                  echo "</td>\n";
                  echo "</tr>\n";
                  $bgcnt++;
                }
              }
              //social areas//
              $selquery="SELECT * FROM saace_areas WHERE comp_id='".$row['id']."'";
              $selres=mysql_query($selquery);
              if ($selres && mysql_num_rows($selres)>0) {
                while ($selrow=mysql_fetch_assoc($selres)) {
                  echo "<tr";
                  if ($bgcnt%2==0) {
                    echo " class='odd'";
                  } else {
                    echo " class='even'";
                  }
                  echo ">\n";
                  echo "<td>".$row['name']."</td>\n";
                  echo "<td></td>\n";
                  echo "<td>Stand ".$selrow['name']."</td>\n";
                  echo "<td align='center'>\n";
                  if ($selrow['paid']=='0') {
                    echo "  <a href='".$pagename."?sec=pay&act=aacti&id=".$selrow['id']."'><img border='0' src='img/restore.gif' alt='Activate'/></a>\n";
                  } else {
                    echo "  <a href='".$pagename."?sec=pay&act=asusp&id=".$selrow['id']."'><img border='0' src='img/suspend.gif' alt='Suspend'/></a>\n";
                  }
                  echo "</td>\n";
                  echo "</tr>\n";
                  $bgcnt++;
                }
              }
            } //end while
          }
        ?>
</table>