<?php $home = implode(DIRECTORY_SEPARATOR, array_slice(explode(DIRECTORY_SEPARATOR, __FILE__), 0, -3)) . '/'; require_once $home . 'components/system/Preload.php'; $acc = new \model\Access(); $auth = new \business\Authentication($acc->getEntityManager()); $password = isset($_POST['password']) ? $_POST['password'] : null; $identity = isset($_POST['email']) ? $_POST['email'] : null; if ($password != null && $identity != null) { $tmp = $auth->validateCredentials($identity, $password); if ($tmp) { $_SESSION['active'] = true; $_SESSION['roleid'] = $tmp->getAuthentication()->getRole()->getId(); $_SESSION['userid'] = $tmp->getId(); throw new \backbone\RedirectBrowserException(APPLICATION_ROOT_URL . 'home.php?code=0'); } else { throw new \backbone\RedirectBrowserException(APPLICATION_ROOT_URL . 'index.php?code=1&email=' . $identity); } } else { throw new \backbone\RedirectBrowserException(APPLICATION_ROOT_URL . 'index.php?code=0&email=' . $identity); }
<?php $home = implode(DIRECTORY_SEPARATOR, array_slice(explode(DIRECTORY_SEPARATOR, $_SERVER["SCRIPT_FILENAME"]), 0, -3)) . '/'; require_once $home . 'components/system/Preload.php'; $acc = new \model\Access(); $em = $acc->getEntityManager(); $businessAuth = new \business\Authentication($em); $businessQl = new \business\QuickLogin($em); $userRepo = $em->getRepository('model\\entities\\User'); $roleRepo = $em->getRepository('model\\entities\\Role'); $authRepo = $em->getRepository('model\\entities\\Authentication'); $qlRepo = $em->getRepository('model\\entities\\QuickLogin'); $mail = new \utilities\SwiftMailLoader(); $password = isset($_POST['password']) ? $_POST['password'] : null; $vp = isset($_POST['vpass']) ? $_POST['vpass'] : null; $data['email'] = isset($_POST['email']) ? $_POST['email'] : null; $data['vemail'] = isset($_POST['vemail']) ? $_POST['vemail'] : null; $data['fname'] = isset($_POST['fname']) ? $_POST['fname'] : null; $data['lname'] = isset($_POST['lname']) ? $_POST['lname'] : null; if ($password == $vp && $data['email'] == $data['vemail'] && $password != null && $data['email'] != null) { if ($businessAuth->isIdentityFree($data['email'])) { //create user $user = new \model\entities\User(); $user->setFname($data['fname'])->setLname($data['lname']); $em->persist($user); $contact = new \model\entities\Contact(); $contact->setEmail($data['email'])->setUser($user); $em->persist($contact); $role = $roleRepo->find(2); $salt = $businessAuth->generateSalt(); $auth = new \model\entities\Authentication();