Location: PHPKode > projects > Statiqz, website statistics > statiqz/ctrl/LoginCtrl.class.php
<?php

require_once 'ctrl/BaseCtrl.class.php';
require_once 'out/LoginOut.class.php';
require_once 'xdbx/UsersXdbx.class.php';

class LoginCtrl extends BaseCtrl {
    function LoginCtrl() {

    }

    function process() {
        if (isset($_POST['submit'])) {
            $username   = $_POST['username'];
            $password   = $_POST['password'];

            $usersXdbx = new UsersXdbx();

            if ($user = $usersXdbx->getUserByUsernameAndPassword($username, $password)) {

                if ($user[0]['active']) {
                    $_SESSION['ID'] = $user[0][ID];

                    redirect('index.php?ids=Statistics&id='.$user[0][ID]);
                } else {
                    $msg = 'your account has not been activated';
                }
            } else {
                $msg = 'invalid credentials';
            }
        } else {
            $msg = '&nbsp;';
        }

        $loginOut = new LoginOut($msg);
        return $loginOut->get();
    }
}

?>

Return current item: Statiqz, website statistics