Exemplo n.º 1
0
<?php

$manager = new \Zend\Session\SessionManager();
$manager->setName('abbrevia');
\Zend\Session\Container::setDefaultManager($manager);
$auth = new Zend\Authentication\AuthenticationService();
$db->session = $manager->getStorage();
$facebookSession = new \Zend\Session\Container('facebook_id');
if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'login' && array_key_exists('xhrValidate', $_REQUEST) && array_key_exists('username', $_REQUEST) && array_key_exists('password', $_REQUEST)) {
    if (is_numeric(session_id())) {
        session_destroy();
    }
    $authAdapter = new \login\Auth($db, $_REQUEST['username'], $_REQUEST['password']);
    $authResult = $auth->authenticate($authAdapter);
    if ($authResult->getCode() != \Zend\Authentication\Result::SUCCESS) {
        $control->addValidationMessage('username_login', 'Credenziali errate');
    }
    $db->session->plain_pwd = $_REQUEST['password'];
} else {
    if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'register' && array_key_exists('username', $_REQUEST) && array_key_exists('password', $_REQUEST)) {
        $_REQUEST['task'] = 'register';
        if (array_key_exists('xhrValidate', $_REQUEST)) {
            if (!filter_var($_REQUEST['username'], FILTER_VALIDATE_EMAIL)) {
                $control->addValidationMessage('username_register', 'Inserisci una mail valida');
            }
            if (strlen($_REQUEST['password']) < 3) {
                $control->addValidationMessage('password_register', 'La password deve avere almeno tre caratteri');
            }
            if ($_REQUEST['password'] !== $_REQUEST['passwordr']) {
                $control->addValidationMessage('password_register', 'Le due password non coincidono');
            }
Exemplo n.º 2
0
<?php

ini_set('date.timezone', 'America/New_York');
/**
 * This makes our life easier when dealing with paths. Everything is relative
 * to the application root now.
 */
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
    return false;
}
// Setup autoloading
require 'init_autoloader.php';
$sessionManager = new Zend\Session\SessionManager();
$sessionManager->setName('vfadmin');
$sessionManager->start();
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();