Michael IrigoyenEmail: contact@michaelirigoyen.com
Online: www.michaelirigoyen.com
These are the highlights of my work while employed with Illinois State University. I invite you to follow the links to each one and evaluate my work firsthand.
I also invite you to take a deeper look at this very site. Many facets of my talents, including responsive design, print stylesheets, and accessible design, are employed here.
-Michael Irigoyen
ICI HomesDaytona Beach, FLApril 2013 - Present
Illinois State UniversityNormal, ILDecember 2007 - April 2013
Illinois State UniversityNormal, ILOctober 2005 - December 2007
Illinois State UniversityNormal, ILMay 2005 - October 2005
Bachelor of Science (2007)
Major: Technology
Language: PHP
The sample of code provided is one of the many functions I wrote to be used in our process for ULID changes at Illinois State University. Each University member is given a ULID, based upon their legal name, to uniquely identify them in electronic systems, such as email. In the case of a legal name change, we allow an individual to have a new ULID generated based on their new name.
This function handles checking if a newly generated ULID is available for use. During this check, the ULID is verified against the campus LDAP system, as well as the campus SMTP server. It also verifies the newly generated ULID is not identical to their current ULID.
<?php
// Validate if a newly generated ULID is available for use. This function
// will check LDAP and the mail server to verify this ULID is available
// and this ULID does not match a email alias or nickname.
// Return: array(error value, message/action)
function validate_newulid($newulid, $currentulid, $legalname) {
$connect = ldap_connect("url.obscured.edu");
if($connect) {
// Log in to LDAP with our admin account
$bind = @ldap_bind($connect, "uid=obscured_admin_account", "obscuredpassword");
if($bind) {
// Search for the ULID
$search = ldap_search($connect, "ou=People", "uid=".$newulid);
$results = ldap_get_entries($connect, $search);
if($results['count'] == 0) {
// The new ULID was not found in LDAP. Open a socket to the
// email system to verify the ULID is not already being used
// as an email alias or nickname.
$fp = fsockopen("url.obscured.edu", 25, $errno, $errstr);
if($fp) {
// Check connection to the SMTP server
$connection = fgets($fp, 512);
if(substr($connection, 0, 3) == "220") {
// Give the server our HELO command
fwrite($fp, "HELO ilstu.edu\r\n");
$helo_return = fgets($fp, 512);
if(substr($helo_return, 0, 3) == "250") {
// Give the server our MAIL FROM address
fwrite($fp, "MAIL FROM:helpdesk_noreply@ilstu.edu\r\n");
$mf_return = fgets($fp, 512);
if(substr($mf_return, 0, 3) == "250") {
// Test our new ULID's email address to make sure
// it comes back as an "unknown or illegal alias"
fwrite($fp, "RCPT TO:".$newulid."@ilstu.edu\r\n");
$alias_test = fgets($fp, 512);
if(substr($alias_test, 0, 3) == "550") {
// No email alias or nicknames exists with this ULID
// Return that it is safe to use this new ULID.
$valid_request = array(TRUE, "USE");
} elseif(substr($alias_test, 0, 3) == "250") {
// An alias or nickname exists, generate new ULID
$valid_request = array(TRUE, "REGENERATE");
} else {
// Error - Unknown error
$valid_request = array(FALSE, "ERROR", "There was an unknown error while processing your request.");
}
} else {
// Error - Denied MAIL FROM
$valid_request = array(FALSE, "ERROR", "There was an error validating an alias check.");
}
} else {
// Error - HELO command denied
$valid_request = array(FALSE, "ERROR", "There was a problem connecting to SMTP.");
}
// Close the connection
fwrite($fp, "quit\r\n");
fclose($fp);
} else {
// Error - SMTP server not connected
$valid_request = array(FALSE, "ERROR", "There was a problem opening a socket to SMTP.");
}
} else {
// Error - Could not open the socket to the mail server
$valid_request = array(FALSE, "ERROR", "There was a problem opening a socket to SMTP.");
}
} elseif($results['count'] == 1) {
// The ULID supplied returned a record in LDAP
// Grab the record's legal name from the result array
$result_ln = explode(" ", $results[0]['legalname'][0]);
// Check the newly generated ULID against the user's
// current ULID. If they match, this person is not eligiable
// for a ULID change request.
if($newulid != $currentulid) {
// Check the result's legal name against the legal name
// of the person currently logged in. If the names match,
// the logged in user's name has not changed and we cannot
// process a ULID change request.
if(count($result_ln) == count($legalname)) {
if(($result_ln[0] == $legalname[0]) && ($result_ln[1] == $legalname[1]) && (count($result_ln) == 3 && ($result_ln[2] == $legalname[2]))) {
// Names match, this request is not valid
$valid_request = array(FALSE, "INFO", "Your ULID already matches your legal name.<br/>You do not qualify for a ULID change.");
} else {
// Names are different, request is valid
// Regenerate a new new ULID
$valid_request = array(TRUE, "REGENERATE");
}
} else {
// Counts are different, request is valid
// Regenerate a new new ULID
$valid_request = array(TRUE, "REGENERATE");
}
} else {
$valid_request = array(FALSE, "INFO", "Your ULID already matches your legal name.<br/>You do not qualify for a ULID change.");
}
} else {
// Error - Problem when searching LDAP
$valid_request = array(FALSE, "ERROR", "There was a problem searching LDAP.");
}
} else {
// Error - Can't log in as the LDAP admin
$valid_request = array(FALSE, "ERROR", "There was a problem binding to LDAP.");
}
} else {
// Error - Can't connect to LDAP
$valid_request = array(FALSE, "ERROR", "There was a problem connecting to LDAP.");
}
return $valid_request;
}
?>
http://stackoverflow.com/users/542517/michael-irigoyen
Stack Overflow (www.stackoverflow.com)
Top 10% for PHP, HTML, CSS, and .htaccess
Top 20% for JavaScript, jQuery, and MySQL
http://coding.smashingmagazine.com/2009/06/18/10-ways-to-make-your-site-accessible-using-web-standards/
Smashing Magazine (www.smashingmagazine.com)
Published June 18th, 2009
References available upon request
Social
Michael Irigoyen on LinkedIn Michael Irigoyen on Stack Overflow Michael Irigoyen on GitHub @mririgo