isLoggedIn(true); require_once('Savant2_Common.php'); // Config stuff $aFirstCountries = array('United States'); $aRequiredFields = array( 'group_name' => 'Group/organization name', 'country_id' => 'Country', 'contact_telephone' => 'Telephone', 'contact_name_first' => 'First name', 'contact_name_last' => 'Last name', 'contact_email' => 'Contact email', 'group_type_id' => 'Group type' ); // Get the country list $sSql = 'SELECT country_id, country_name FROM gm_lkp_country ORDER BY country_name IN @ DESC, country_name'; $aCountryList = DBConn::getArray($sSql, 'country_id', 'country_name', array($aFirstCountries)); // Get the group type list $sSql = 'SELECT group_type_id, group_type_name FROM gm_lkp_group_type'; $aGroupTypeList = DBConn::getArray($sSql, 'group_type_id', 'group_type_name'); $oErr = new ErrorCollector(); $oTpl = new Savant2_Common(); if (!empty($_POST['submit'])) { // Scrub input foreach ($_POST as $sKey => $sVal) { $_POST[$sKey] = getPost($sKey); } // Validate input // Check for missing inputs foreach ($aRequiredFields as $sRequiredField => $sRequiredFieldDescription) { if (empty($_POST[$sRequiredField])) { $oErr->add('"' . $sRequiredFieldDescription . '" must be provided.', true); } } if (!$oErr->hasError()) { // Look up the user ID for this person $sSql = 'SELECT user_id FROM gm_user WHERE user_username = ?'; $iUserId = DBConn::getValue($sSql, 'user_id', array($oLogin->getLoginUsername())); // Create the group account $sSql = 'INSERT INTO gm_group_contact (contact_name_first, contact_name_last, contact_telephone, contact_email, contact_address, contact_city, contact_state, contact_zip, country_id, user_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, !, !)'; DBConn::executeNonQuery($sSql, array($_POST['contact_name_first'], $_POST['contact_name_last'], $_POST['contact_telephone'], $_POST['contact_email'], $_POST['contact_address'], $_POST['contact_city'], $_POST['contact_state'], $_POST['contact_zip'], $_POST['country_id'], $iUserId)); $iContactId = DBConn::getLastInsertId(); // Generate the group code -- first three letters of the group's name and a 4-digit number $sGroupCode = preg_replace('/\W/', '', $_POST['group_name']); $sGroupCode = strtolower(substr($sGroupCode, 0, 3)) . '-'; do { $sDigitPart = str_pad(rand(0, 9999), 4, '0', STR_PAD_LEFT); $sSql = 'SELECT group_id FROM gm_group WHERE group_code = ?'; $iGroupId = DBConn::getValue($sSql, 'group_id', array($sGroupCode . $sDigitPart)); } while (!empty($iGroupId)); $sGroupCode .= $sDigitPart; // Save the group $sSql = 'INSERT INTO gm_group (group_type_id, contact_id, group_name, group_code, is_isafe, is_active) VALUES (!, !, ?, ?, !, !)'; if (DBConn::executeNonQuery($sSql, array($_POST['group_type_id'], $iContactId, $_POST['group_name'], $sGroupCode, 0, 1))) { // Generate the email $oTpl->assign('aGroupInfo', $_POST); $oTpl->assign('sGroupCode', $sGroupCode); $sEmail = $oTpl->fetchEmail('registerGroupEmail.txt.php'); mail($_POST['contact_name_first'] . ' ' . $_POST['contact_name_last'] . ' <' . $_POST['contact_email'] . '>', 'Carnegie Cadets group registration', $sEmail, 'From: Carnegie Cadets ', '-fwww-bounces@ece.cmu.edu'); doRedirect('registerGroupComplete.html?gc=' . $sGroupCode); } else { $oErr->add('We were unable to save your information. Please try again, or email us for help.', true); } } } $sErr = $oErr->toString(); ?> Register Your Group
Go To the Academy Web site

Logged In:.

Quick Help:.

Want to know more about the Game?
Click here for more about The MySecureCyberspace Game.

Want to see what the Game is like?
Click here to view a demo video of the Game.

Want to download the Game?
Click here to download The MySecureCyberspace Game.

Want to know more about our Policies?
Click here for more about our Privacy Policy and Terms of Use.

Register Your Group

Please correct the following:

_($sErr)?>

plugin('input', 'text', 'group_name', $_POST['group_name'], array('size' => 30, 'maxlength' => 255, 'class' => 'formField', 'id' => 'group_name')); ?> plugin('label', 'group_name', 'Group/organization
name'); ?>

plugin('textarea', 'contact_address', $_POST['contact_address'], 3, 28, array('class' => 'formField', 'id' => 'contact_address')); ?> plugin('label', 'cpntact_address', 'Address'); ?>




plugin('input', 'text', 'contact_city', $_POST['contact_city'], array('size' => 30, 'maxlength' => 255, 'class' => 'formField', 'id' => 'contact_city')); ?> plugin('label', 'contact_city', 'City'); ?>

plugin('input', 'text', 'contact_state', $_POST['contact_state'], array('size' => 30, 'maxlength' => 255, 'class' => 'formField', 'id' => 'contact_state')); ?> plugin('label', 'contact_state', 'State/province'); ?>
If applicable

plugin('input', 'text', 'contact_zip', $_POST['contact_zip'], array('size' => 10, 'maxlength' => 20, 'class' => 'formField', 'id' => 'contact_zip')); ?> plugin('label', 'contact_zip', 'ZIP/Postal code'); ?>
If applicable

plugin('label', 'country_id', 'Country'); ?>

plugin('input', 'text', 'contact_telephone', $_POST['contact_telephone'], array('size' => 30, 'maxlength' => 255, 'class' => 'formField', 'id' => 'contact_telephone')); ?> plugin('label', 'contact_telephone', 'Telephone'); ?>

plugin('input', 'text', 'contact_name_first', $_POST['contact_name_first'], array('size' => 16, 'maxlength' => 255, 'id' => 'contact_name_first', 'title' => 'First name')); ?> plugin('input', 'text', 'contact_name_last', $_POST['contact_name_last'], array('size' => 16, 'maxlength' => 255, 'id' => 'contact_name_last', 'title' => 'Last name')); ?> plugin('label', 'contact_name_first', 'First'); ?>/plugin('label', 'contact_name_last', 'last'); ?> name

plugin('input', 'text', 'contact_email', $_POST['contact_email'], array('size' => 30, 'maxlength' => 255, 'class' => 'formField', 'id' => 'contact_email')); ?> plugin('label', 'contact_email', 'Contact email'); ?>

plugin('label', 'group_type_id', 'Select one that best
describes your group'); ?>