File: /home/awaldron/www/archive/demo/reg_confirm.php
<?php
session_start();
include("_functions.php");
dbconnect();
$page_title = "Email Address Confirmation";
$GLOBALS["ext_page"] = $page_title; // SET FAUX PAGE NAME
$_GET["p"] = 1; // SET FAUX PARENT ID
$lnav_mods = array();
$rnav_mods = array();
include("_pagestart.php");
echo "<br><br><br><center>\n";
echo "<P><div style=\"width:500px;border:solid 2px #".COLOR_TBAR.";padding:25px;background:url('gui/disbg.gif');\">\n";
if (!isset($_GET["key"])) {
echo "<P><center>".error("The proper variables must be passed to access this page.")."</center><br><br><br>";
} else {
$reg_method = REG_METHOD;
$username = quickSQL("SELECT username FROM tbl_employees WHERE acct_key='".$_GET["key"]."' LIMIT 0,1");
if ($username === FALSE) {
echo "<center><P><b>ERROR Retrieving Validation Key.</b><P>This account may have already been confirmed.<P><a href=\"mailto:".admin("email")."\" class=\"text\">Please contact the Intranet Administrator for assistance.</a><br><br><br></center>\n";
} else {
if ($reg_method == "open") {
quickUPDATE("UPDATE tbl_employees SET acct_key='0', email_confirmed=1, acct_confirmed=1 WHERE username='".$username."'");
$out = "Your account has been activated. You may now login to the Intranet using your account username and password.\n";
} else if ($reg_method == "open/admin") {
quickUPDATE("UPDATE tbl_employees SET acct_key=0, email_confirmed=1 WHERE username='".$username."'");
$out = "An Intranet Administrator will now review your registration. You will receive an email confirmation upon the review from the Administrator.\n";
// Send Validation Email to Administrator
$from_name = admin("fullname");
$reply_to = admin("email");
$message = "Intranet Notification.\n\n";
$message .= "User ".$username." is ready for account validation. Please follow the link below to approve this user.\n\n";
$message .= "http://".DOMAIN."/admin/index.php?p=confirm\n\n";
$message .= "Thank you.\n\n";
$to = $reply_to;
$subject = "Intranet Account Validation: ".$username;
$additional_headers = "From: ".CMP_NAME_INF." Intranet\n" . "Reply-To: ".$reply_to;
mail($to, $subject, $message, $additional_headers);
}
echo "<center><br><br><br><br><b>Thank you for confirming your email address for the ".CMP_NAME_INF." Intranet</b>\n";
echo "<P>".$out."</center><br><br><br><br>\n";
}
}
echo "</div>\n";
include("_pageend.php");
?>