File: /home/awaldron/public_html/archive/demo/admin/employee_confirm.php
<?php
session_start();
include("../_functions.php");
dbconnect();
if (!is_logged()) auto_login();
echo "<html>\n";
echo "<head>\n";
echo "<title>".COMPANY_NAME." : Confirm Employee Registrations</title>\n";
echo "<script language=\"JavaScript\" type=\"text/javascript\">\n";
echo "<!--\n";
echo "function openWindow(theURL,winName,features) { //v2.0\n";
echo " window.open(theURL,winName,features);\n";
echo "}\n";
echo "function reject_acct(id) {\n";
echo " input_box=confirm(\"Are you sure you want to reject this user's registration?\");\n";
echo " if (input_box==true) {\n";
echo " self.location=\"employee_confirm.php?reject=\"+id;\n";
echo " }\n";
echo "}\n";
echo "function confirm_acct(id) {\n";
echo " input_box=confirm(\"Are you sure you want to confirm this user's registration?\");\n";
echo " if (input_box==true) {\n";
echo " self.location=\"employee_confirm.php?confirm=\"+id;\n";
echo " }\n";
echo "}\n";
echo "-->\n";
echo "</script>\n";
echo "</head>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../default.css\">\n";
echo "<body style=\"margin:15px;\">\n";
if (!admin_panel($_SESSION["auth_user"])) {
echo "<br><br><br><br>".error("You must be logged in to access the administration panel!");
} else {
if (isset($_GET["confirm"])) {
quickUPDATE("UPDATE tbl_employees SET acct_confirmed=1 WHERE eid=".$_GET["confirm"]);
// Send Confirmation Email
$message = "The ".CMP_NAME_INF." Intranet Administrators have approved your account. ";
$message .= "You may now use your username and password to login to the ".CMP_NAME_INF." Intranet.\n\n";
$message .= "http://".DOMAIN."/content.php?p=1\n\n";
$message .= "Thank you for registering.\n\n";
$to = quickSQL("SELECT email FROM tbl_employees WHERE eid=".$_GET["confirm"]);
$subject = CMP_NAME_INF." Intranet Registraton Approved";
$additional_headers = "From: ".CMP_NAME_INF." Intranet <".admin("email").">\n" . "Reply-To: ".admin("email");
mail($to, $subject, $message, $additional_headers);
}
if (isset($_GET["reject"])) {
quickUPDATE("UPDATE tbl_employees SET is_employee=0 WHERE eid=".$_GET["reject"]);
// Send Rejection Email
$message = "We're sorry, but the ".CMP_NAME_INF." Intranet Administrators have rejected your account registration. ";
$message .= "If you have any questions regarding this decision, please reply this message.\n\n";
$message .= "Thank you.\n\n";
$to = quickSQL("SELECT email FROM tbl_employees WHERE eid=".$_GET["reject"]);
$subject = CMP_NAME_INF." Intranet Registraton Denied";
$additional_headers = "From: ".CMP_NAME_INF." Intranet <".admin("email").">\n" . "Reply-To: ".admin("email");
mail($to, $subject, $message, $additional_headers);
}
echo "<P><img src=\"/gui/icons/cog.gif\" align=\"left\">\n";
echo "<div class=\"headline\">Confirm Employee Registrations</div>\n";
echo "<br><br><br><table class=\"textdn\" border=0 cellspacing=1 cellpadding=3 width=100% bgcolor=\"#".COLOR_TBAR."\">\n";
echo "<tr class=\"header\"><td>Name</td><td>Title</td><td>Group</td><td>Manager</td><td>Actions</td></tr>\n";
$sql = "SELECT * FROM tbl_employees,tbl_group_user,tbl_groups WHERE tbl_employees.email_confirmed=1 AND tbl_employees.acct_confirmed=0 AND ";
$sql .= "tbl_employees.is_employee=1 AND ";
$sql .= "tbl_group_user.username=tbl_employees.username AND tbl_group_user.group_id=tbl_groups.group_id ";
$sql .= "ORDER BY tbl_employees.lname ASC";
$res = mysql_query($sql);
for ($i=0; $i < mysql_num_rows($res); $i++) {
$row = mysql_fetch_array($res);
$photo = "../gui/photos/th_".$row["username"].".jpg";
if (!file_exists($photo)) $photo = "../gui/photos/th_nophoto.jpg";
echo "<tr".($i%2==0?" bgcolor=#FFFFFF":" bgcolor=#EEEEEE").">\n";
echo " <td><a href=\"/profile.php?u=".$row["username"]."\" target=\"new\">".$row["lname"].", ".$row["fname"]."</a></td>\n";
echo " <td>".$row["title"]."</td>\n";
echo " <td>".$row["group_name"]."</td>\n";
echo " <td>".get_user($row["manager"],"fullname")."</td>\n";
if ($_GET["id"] == "x") echo " <td><a href=\"/profile.php?u=".$row["username"]."\" target=\"new\">View</a> | <a href=\"employee_edit.php?u=".$row["username"]."\">Edit</a> | <a href=\"employee_list.php?id=".$_GET["id"]."&tab=".$_GET["tab"]."&res=".$row["username"]."\">Restore</a>\n";
else echo " <td><a href=\"/profile.php?u=".$row["username"]."\" target=\"new\">View</a> | <a href=\"employee_edit.php?u=".$row["username"]."\">Edit</a> | <a href=\"JavaScript:reject_acct(".$row["eid"].")\">Reject</a> | <a href=\"JavaScript:confirm_acct(".$row["eid"].")\">Confirm</a>\n";
echo "</tr>\n"; $j=$i;
}
if (mysql_num_rows($res) == 0) echo "<tr bgcolor=#FFFFFF><td colspan=5><b>There are currenlty no pending users.</b></td></tr>\n";
echo "</table>\n";
echo "<br><br><br><br>\n";
echo "<center>Powered by <a href=\"http://www.intrabreeze.com\">IntraBreeze</a> © 2005 IntraBreeze, LLC</center>\n";
}
echo "</body>\n</html>\n";
?>