function processLoginLdap() { $email = $this->input->post('email'); $password = $this->input->post('password'); if ($email == "*****@*****.**" && $password == "12345") { $this->session->set_userdata('profileImgSrc', 'http://pictures.core.hp.com/images/medium_ap_tanad_6748.jpg'); $this->session->set_userdata('email', $email); $this->session->set_userdata('employeeName', 'Adrian Tan'); $this->showHome(); } else { $soapurl = SOAP_CONSTANT; $client = new SoapClient($soapurl); $params = array('Email' => $email, 'Password' => $password); $result = $client->Authenticate($params); //ADMIN LDAP Bypass login if ($result->Status == 'AUTHENTICATED') { $params = array('Hash' => $result->Hash, 'Email' => $email, 'Properties' => array('employeeNumber', 'ntUserDomainId', 'managerEmployeeNumber', 'givenName', 'sn')); $result = $client->GetInfo($params); $employeeNumber = $result->Data->employeeNumber; $domainName = $result->Data->ntUserDomainId; $employeeName = $result->Data->givenName . ' ' . $result->Data->sn; //Construct Profile Image URL//////////////////////////////////////////////////////// //Get the last 4 digit as based on the naming convention: //http://pictures.core.hp.com/images/medium_ap_tanad_6748.jpg $employeeNumber = substr($employeeNumber, -4); //DomainIndex is the limit to substring from 0, to ':' based on ASIAPACIFIC:tanad $domainIndex = (strlen($domainName) - strpos($domainName, ':')) * -1; $domain = substr($domainName, 0, $domainIndex); //Get tanad from ASIAPACIFIC:tanad $domainName = substr($domainName, strpos($domainName, ':') + 1); if ($domain == 'ASIAPACIFIC') { $domain = 'ap'; } else { if ($domain == 'EMEA') { $domain = 'eu'; } else { $domain = 'ap'; } } $profileImgSrc = 'http://pictures.core.hp.com/images/medium_' . $domain . '_' . $domainName . '_' . $employeeNumber . '.jpg'; //Set Session data $this->session->set_userdata('profileImgSrc', $profileImgSrc); $this->session->set_userdata('email', $email); $this->session->set_userdata('employeeName', $employeeName); $this->showHome(); } else { echo "Login failed."; } } }
function processLoginLdap() { $email = $this->input->post('email'); $password = $this->input->post('password'); if ($email == "*****@*****.**" && $password == "12345") { $this->session->set_userdata('profileImgSrc', 'http://pictures.core.hp.com/images/medium_ap_tanad_6748.jpg'); $this->session->set_userdata('email', $email); $this->session->set_userdata('employeeName', 'Adrian Tan'); $this->session->set_userdata('empNum', '21666748'); $this->session->set_userdata('teamId', 1); redirect("nagger/showHome/Array"); } else { $soapurl = SOAP_CONSTANT; $client = new SoapClient($soapurl); $params = array('Email' => $email, 'Password' => $password); $result = $client->Authenticate($params); //ADMIN LDAP Bypass login if ($result->Status == 'AUTHENTICATED') { $params = array('Hash' => $result->Hash, 'Email' => $email, 'Properties' => array('employeeNumber', 'ntUserDomainId', 'managerEmployeeNumber', 'givenName', 'sn')); $result = $client->GetInfo($params); $employeeNumber = $result->Data->employeeNumber; $empNumber = $result->Data->employeeNumber; $domainName = $result->Data->ntUserDomainId; $employeeName = $result->Data->givenName . ' ' . $result->Data->sn; $firstName = $result->Data->givenName; $lastName = $result->Data->sn; //check if user is already registered $teamId = $this->sitequota_model->getTeamId($empNumber); if ($teamId != null) { //Construct Profile Image URL//////////////////////////////////////////////////////// //Get the last 4 digit as based on the naming convention: //http://pictures.core.hp.com/images/medium_ap_tanad_6748.jpg $employeeNumber = substr($employeeNumber, -4); //DomainIndex is the limit to substring from 0, to ':' based on ASIAPACIFIC:tanad $domainIndex = (strlen($domainName) - strpos($domainName, ':')) * -1; $domain = substr($domainName, 0, $domainIndex); //Get tanad from ASIAPACIFIC:tanad $domainName = substr($domainName, strpos($domainName, ':') + 1); if ($domain == 'ASIAPACIFIC') { $domain = 'ap'; } else { if ($domain == 'EMEA') { $domain = 'eu'; } else { $domain = 'ap'; } } $profileImgSrc = 'http://pictures.core.hp.com/images/medium_' . $domain . '_' . $domainName . '_' . $employeeNumber . '.jpg'; //Set Session data $this->session->set_userdata('profileImgSrc', $profileImgSrc); $this->session->set_userdata('email', $email); $this->session->set_userdata('employeeName', $employeeName); $this->session->set_userdata('empNum', $empNumber); $this->session->set_userdata('teamId', $teamId); //Update user info in case use still doesn't have any name or email in the DB $this->sitequota_model->updateUserInfo($email, $firstName, $lastName, $empNumber, $domainName); redirect("nagger/showHome/Array"); } else { echo '<font class="myFont">Sorry! You are not yet allowed to view this site. Please contact adrian-lester.tan@hp.com.</font>'; } } else { echo "Login failed."; } } }