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

<?php
  if (isset($_POST['reg_sub'])) {
    $query="INSERT INTO saace_company (name,contact,tele,cell,fax,email,size,status) VALUES ('".$_POST['company']."','".$_POST['contact']."','".$_POST['telephone']."','".$_POST['cell']."','".$_POST['fax']."','".$_POST['email']."','".$_POST['size']."','0')";
    $insres=mysql_query($query);
    $comp_id=mysql_insert_id();
    $pwd=substr($_POST['company'],0,1).substr($_POST['contact'],0,1).date("His");
    $query="INSERT INTO saace_user (name,pass,rank,comp_id,status,title) VALUES ('".$_POST['email']."','".$pwd."','1','".$comp_id."','0','".$_POST['contact']."')";
    mysql_query($query);
    echo "<h1>Registration application sent</h1>You will be notified when it is approved\n";
    $details="<table border='0' cellpadding='0' cellspacing='0'>\n";
    $details.="<tr><td>Company : </td><td>".$_POST['company']."</td></tr>\n";
    $details.="<tr><td>Contact : </td><td>".$_POST['contact']."</td></tr>\n";
    $details.="<tr><td>Telephone : </td><td>".$_POST['telephone']."</td></tr>\n";
	 $details.="<tr><td>Cellphone : </td><td>".$_POST['cell']."</td></tr>\n";
    $details.="<tr><td>Fax : </td><td>".$_POST['fax']."</td></tr>\n";
    $details.="<tr><td>Email/Username : </td><td>".$_POST['email']."</td></tr>\n";
    $details.="<tr><td>Password : </td><td>".$pwd."</td>\n";
    $details.="<tr><td>Size : </td><td>\n";
    $squery="SELECT text FROM saace_compsize WHERE id='".$_POST['size']."'";
    $sres=mysql_query($squery);
    if ($sres) {
      $srow=mysql_fetch_assoc($sres);
      $details.=$srow['text'];
    }
    $details.="</td></tr>\n";
    $details.="</table>\n";
    
    $cmstr="<html><body><p>Dear ".$_POST['contact']."<br/><br/>Thank you for registering for the CESA Relay race. <br/><br/>You registration has been sent for approval.<br/><br/>Once approved you can login to setup your teams and to book social areas on http://www.cesa.co.za/relay.<br/>".$details."<br/>Should you have entered the incorrect registration details 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>";
	if(!$_POST['unisponsor']){
    $amstr="<html><body><p>".$_POST['contact']." from ".$_POST['company']." has registered for the CESA Relay race. 

Please login to <a href='http://www.cesa.co.za/relay'>http://www.cesa.co.za/relay</a> to approve the registration.<br/>".$details."</p></body></html>";
	} else {
	$amstr="<html><body><p>".$_POST['contact']." from ".$_POST['company']." has registered for the CESA Relay race. 

Please login to <a href='http://www.cesa.co.za/relay'>http://www.cesa.co.za/relay</a> to approve the registration.<br/>".$details."</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($_POST['email'],'CESA Relay registration confirmation',$cmstr,$headers);
    //mail admin
    mail($admin_email."",'CESA Application record',$amstr,$headers);
  } else {
    ?>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>

      <!--<h1>Please note that registrations for this event has closed. <br/>
      </h1> -->
      <center>
<form method='POST' action='<?php echo $pagename;?>?sec=reg'>
     <table border='0' cellpadding='0' cellspacing='0'>
        <tr>
          <th colspan='2'>Register Company</th>
        </tr>
        <tr>
          <td>Company Name</td>
          <td><input type='text' name='company' size='26'></td>
        </tr>
        <tr>
          <td>Contact Person</td>
          <td><input type='text' name='contact' size='26'></td>
        </tr>
        <tr>
          <td>Contact Landline</td>
          <td><input type='text' name='telephone' size='26'></td>
        </tr>
        <tr>
          <td>Contact Cellphone</td>
          <td><input type='text' name='cell' size='26'></td>
        </tr>
        <tr>
          <td>Contact Fax</td>
          <td><input type='text' name='fax' size='26'></td>
        </tr>
        <tr>
          <td>Email</td>
          <td><input type='text' name='email' size='26'></td>
        </tr>
        <tr>
          <td>Company Size</td>
          <td>
            <select name='size'>
              <?php
                $query="SELECT * FROM saace_compsize ORDER BY id ASC";
                $res=mysql_query($query);
                if ($res) {
                  while ($row=mysql_fetch_assoc($res)) {
                    echo "<option value='".$row['id']."'>".$row['text']."</option>\n";
                  }
                }
              ?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Are you interested in sponsoring a university with either Running, Walking, Cycling or Volleyball</td>
          <td>
            <input type="checkbox" name="unisponsor" id="unisponsor" />
          </td>
        </tr>
        <tr>
          <td></td>
          <td><input name='reg_sub' type='submit' onclick="MM_validateForm('company','','R','contact','','R','telephone','','R','cell','','R','fax','','R','email','','R');return document.MM_returnValue" value='Register'/></td>
        </tr>
      </table> 
      </form>
   <?php /*   <h2>Registration for the CESA Relay race in 2014 is now closed</h2> */?>
      </center>
    <?php
  }
?>