Execute($sql); if( !$result ) echo "Check Admin Login Error: ".$conn->ErrorMsg()." "; else if( $result->RecordCount() > 0 ) return array( 'loginID'=>$result->fields['ID'], 'type'=>$result->fields['type'], 'userID'=>$result->fields['userID'], 'affiliateID'=>$result->fields['affiliateID'] ); return false; } //meant to check student login, will return true or false function checkUserLogin( $username, $password ) { global $conn; $sql = "SELECT userID, password, ID FROM ".TABLE_LOGIN." WHERE username='$username' AND type='Student'"; $result = $conn->Execute($sql); if( !$result ) echo "Check User Login Error: ".$conn->ErrorMsg().""; else if( $result->RecordCount() > 0 ) { $loginID = $result->fields['ID']; //check to make sure they are active $sql = "SELECT 1 FROM ".TABLE_LOGIN." WHERE ID = $loginID AND active = '1'"; $activeResult = $conn->Execute($sql); //if no rows found, return error code 1, indicating account is cancelled if( $activeResult->RecordCount() == 0 ) return 1; //replacing some guys password cause they were transferred over to us if( $result->fields['password'] == "REPLACEMEX01T" ) { $result->fields['password'] = encryptPassword($password); $sql = "UPDATE ".TABLE_LOGIN." SET password = '" . $result->fields['password'] . "' WHERE ID = $loginID"; $conn->Execute($sql); } //check password if( encryptPassword($password) == $result->fields['password'] ) { //check to see if they are disqualified $sql = "SELECT 1 FROM status WHERE userID='{$result->fields['userID']}' AND Disqualified = '1'"; $result = $conn->Execute($sql); if( $result->RowCount() == 0 ) return true; //error code indicating they have been disqualified return 2; } } return false; } //meant to check student email function checkUserEmail( $username ) { global $conn; $sql = "SELECT u.Email FROM ".TABLE_USER." u LEFT JOIN ".TABLE_LOGIN." l ON l.userID = u.ID WHERE l.username='$username' AND type='Student'"; $result = $conn->Execute($sql); if( $result->RecordCount() > 0 ) return $result->fields['Email']; else return false; } function getLicenseByLogin( $username, $password ) { global $conn; $sql = "SELECT License FROM ".TABLE_LOGIN." login, ".TABLE_USER." user WHERE login.userID = user.ID AND login.username = '$username'"; $result = $conn->Execute( $sql ); if( !$result ) echo "Retrieval Of License By Login Error: ".$conn->ErrorMsg().""; else if( $result->RecordCount() > 0 ) return $result->fields['License']; return false; } function getUserIdByLogin( $username, $type = 'Student' ) { global $conn; $sql = "SELECT userID FROM ".TABLE_LOGIN." WHERE username='$username' AND type='$type'"; $result = $conn->Execute($sql); if( !$result ) echo "Retrieval Of User ID By Login Error: ".$conn->ErrorMsg().""; else if( $result->RecordCount() > 0 ) return $result->fields['userID']; return false; } function isAdmin() { global $session; if( $session->get_user() ) if( $loginInfo = $session->get('loginInfo') ) if( $loginInfo['type'] == TYPE_ADMIN) return true; return false; } function isEmployee() { global $session; if( $session->get_user() ) if( $loginInfo = $session->get('loginInfo') ) if( $loginInfo['type'] == TYPE_EMPLOYEE) return true; return false; } function isStudent() { global $session; if( $session->get_user() ) if( $loginInfo = $session->get('loginInfo') ) if( $loginInfo['type'] == TYPE_STUDENT) return true; return false; } function isAffiliate() { global $session; if( $session->get_user() ) if( $loginInfo = $session->get('loginInfo') ) if( $loginInfo['type'] == TYPE_AFFILIATE_ADMIN || $loginInfo['type'] == TYPE_AFFILIATE_EMPLOYEE) return true; return false; } function isAffiliateAdmin() { global $session; if( $session->get_user() ) if( $loginInfo = $session->get('loginInfo') ) if( $loginInfo['type'] == TYPE_AFFILIATE_ADMIN) return true; return false; } function isAffiliateEmployee() { global $session; if( $session->get_user() ) if( $loginInfo = $session->get('loginInfo') ) if( $loginInfo['type'] == TYPE_AFFILIATE_EMPLOYEE) return true; return false; } ?>Execute($sql); //if we don't have a user logged in yet, maybe an id is passed in if( $result->RowCount() == 0 ) { if( empty($affiliateID) ) $affiliateID = 1; $sql = "SELECT title, logoPath, header, footer FROM affiliate WHERE ID = '$affiliateID'"; $result = $conn->Execute($sql); } if( $result->RowCount() > 0 ) { $school_name = $result->fields['title']; $logoPath = $result->fields['logoPath']; $header = $result->fields['header']; $footer = $result->fields['footer']; //I wrote the following conditional to keep the user on the affiliate site. The "$affiliateID" result string was kicking out the affiliateID variable. ~JM if (empty($affiliateID) && !empty($errMsg) ) { $affiliateID = $result->fields['ID']; }; } $defaultHeader = " <? echo\"$school_name\";?> "; $defaultFooter = ""; if( empty($header) ) $header = $defaultHeader; if( empty($footer) ) $footer = $defaultFooter; eval('?>' . $header . '

Course Login


Username and Password are both required fields


You must answer the following YES / NO questions the same way you did when you registered.

If this is your first time answering, they will be saved and it might be beneficial to write down your answers.

"; //opens security table include("includes/functions/login/getsecurityquestions.inc"); if( empty($questionCount) ) { include("includes/functions/registration/getsecurityquestions.inc"); } echo ""; //closes security table ?>
close(); ?>