| Current Path : /var/www/cesa.co.za/relay/include/ |
| Current File : /var/www/cesa.co.za/relay/include/approvals.php |
<br/><?php
if (isset($_GET['act'])) {
if ($_GET['act']=='susp') {//suspend
$susquery="UPDATE saace_company SET status='0' WHERE id='".$_GET['id']."'";
mysql_query($susquery);
$susquery="UPDATE saace_user SET status='0' WHERE comp_id='".$_GET['id']."'";
mysql_query($susquery);
} elseif ($_GET['act']=='acti') {//restore
$susquery="UPDATE saace_company SET status='1' WHERE id='".$_GET['id']."'";
mysql_query($susquery);
$susquery="UPDATE saace_user SET status='1' WHERE comp_id='".$_GET['id']."'";
mysql_query($susquery);
$selquery="SELECT * FROM saace_company, saace_user WHERE saace_company.id='".$_GET['id']."' AND comp_id='".$_GET['id']."'";
$selres=mysql_query($selquery);
if ($selres) {
$selrow=mysql_fetch_assoc($selres);
if (strlen($selrow['email']) > 0) {
$mstr="<html><body><p>Dear ".$selrow['contact']."<br/><br/>Your registration has been approved.<br/><br/>Please login at <a href='http://www.cesa.co.za/relay/'>http://www.cesa.co.za/relay/</a> with the following username and password<br/><br/>Username : ".$selrow['email']."<br/><br/>Password : ".$selrow['pass']."<br/><br/>Should you have entered the incorrect registration details and wish to cancel you 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>".$_GET['id']."</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 Relay registration approved',$mstr,$headers);
}
}
}
echo "<script type='text/javascript'>window.location = 'http://www.cesa.co.za/relay/index.php?sec=appr'</script>";
}
?>
<h1>Confirm Registrations </h1>
<table border='0' cellpadding='0' cellspacing='0' width='98%'>
<tr>
<th align='left'> </th>
<th align='left'>Company Name</th>
<th align='left'>Approved</th>
<th align='left'>Username</th>
<th align='left'>Password</th>
</tr>
<?php
$query="SELECT saace_company.name as 'name', saace_company.id as 'id', saace_user.name as 'uname', saace_user.pass as 'upass', saace_user.status as 'status' FROM saace_company, saace_user WHERE saace_company.id=saace_user.comp_id";
#$query="SELECT * FROM saace_company ORDER BY name ASC";
$result=mysql_query($query);
if ($result) {
$cnt = 1;
while ($row=mysql_fetch_assoc($result)) {
echo "<tr>\n";
echo "<td>(".$cnt++.")</td>\n";
echo "<td>".$row['name']."</td>\n";
echo "<td align='center' width='5%'>\n";
if ($row['status']=='0') {
echo " <a href='".$pagename."?sec=appr&act=acti&id=".$row['id']."'><img border='0' src='img/restore.gif' alt='Activate'/></a>\n";
} else {
echo " <a href='".$pagename."?sec=appr&act=susp&id=".$row['id']."'><img border='0' src='img/suspend.gif' alt='Suspend'/></a>\n";
}
echo "</td>\n";
echo "<td>".$row['uname']."</td>\n";
echo "<td>".$row['upass']."</td>\n";
echo "</tr>\n";
} //end while
} else {
echo "<tr><td colspan='4'>No companies have applied yet</td></tr>\n";
}
?>
</table>