public function login() { /* $db = ECPFactory::getDbo(); * */ ecpimport("helpers.cryptology"); $db = ECPFactory::getPDO("Logins"); $pasw = 'c17a1a963e2b9ebb228030c0615fdb4bd91bd982'; //$pasw = ECPFactory::getForm("login")->pasw->value; $login = '******'; $loginpin = ECP_Cryptology::generateInteger(30); $pinhash = ECP_Cryptology::generateHash($loginpin); $log = new Logins(); $log->setLogin($login)->setPaswoord($pasw); $results = Logins::findByExample($db, $log); if (empty($results)) { //email en ww komt niet overeen return false; } else { foreach ($results as $result) { $id = $result->getId(); $result->setIpadres($_SERVER['REMOTE_ADDR'])->setLoginpin($pinhash); $count = $result->updateToDatabase($db); if ($count != l) { return 2; } else { return array("uid" => $id, "pin" => $loginpin); } } } }
public function sessionToken() { if ($this->_state !== "guest") { return false; } if ($this->_state !== "error") { return 0; } $this->_state = "postunvalidated"; if (array_key_exists("pin", $_POST)) { ecpimport("helpers.cryptology"); $pinhash = ECP_Cryptology::generateHash($_POST['pin']); if ($pinhash !== $this->session['loginpin']) { $this->user->setGuest(); return false; } else { //pin update? $this->_state = "active"; return true; //hier normaal nieuwe pin teruggeven.. } } else { $this->_state = "error"; return 0; } }
public function eid() { include "openid.php"; $openid = new LightOpenID('localhost'); if ($openid->mode) { $session = ECPFactory::getSession(); ecpimport("helpers.cryptology"); $loginpin = ECP_Cryptology::generateInteger(30); $pinhash = ECP_Cryptology::generateHash($loginpin); $user = $openid->getAttributes(); $achternaam = $user["namePerson/last"]; $postcode = $user["contact/postalCode/home"]; $adres = $user["contact/postalAddress/home"]; $db = ECPFactory::getPDO("Logins"); $log = new Logins(); $log->setAdres($adres)->setOverlegGemeente($postcode)->setNaam($achternaam); $results = Logins::findByExample($db, $log); if (empty($results)) { //email en ww komt niet overeen ecpexit("exit"); } else { foreach ($results as $result) { $id = $result->getId(); $result->setIpadres($_SERVER['REMOTE_ADDR'])->setLoginpin($pinhash); $count = $result->updateToDatabase($db); if ($count != l) { return 2; } else { ecpexit("uid=>{$id},pin=>{$loginpin}"); } } } } else { //Step 2: Authentication, with requirements $openid->identity = 'https://www.e-contract.be/eid-idp/endpoints/openid/auth-ident'; $openid->required = array('namePerson/first', 'namePerson/last', 'namePerson', 'person/gender', 'contact/postalCode/home', 'contact/postalAddress/home', 'contact/city/home', 'eid/nationality', 'eid/pob', 'birthDate', 'eid/card-number', 'eid/card-validity/begin', 'eid/card-validity/end'); //$openid->optional = array(''); header('Location: ' . $openid->authUrl()); } }