示例#1
0
文件: auth.php 项目: plaihonen/tasker
$user->db['pass'] = $dbPass;
$user->db['name'] = $database;
//Database name
debugLog("Page: " . $_SERVER['PHP_SELF']);
//Starts the object and Resume the users current session
$user->start();
debugLog("POST mode: " . $_POST['mode']);
$mode = $_POST['mode'];
unset($_POST['mode']);
switch ($mode) {
    case "login":
        $username = $_POST['username'];
        $password = $_POST['password'];
        $auto = $_POST['auto'];
        //To remember user with a cookie for autologin
        $user = new uFlex();
        //Login with credentials
        $user->login($username, $password, $auto);
        //not required, just an example usage of the built-in error reporting system
        if ($user->signed) {
            $retvar = "User Successfully Logged in";
            debugLog("Return: " . $retvar);
            // echo $retvar;
        } else {
            //Display Errors
            foreach ($user->error() as $err) {
                $retvar = "Error: {$err}";
                debugLog("Return: " . $retvar);
                // echo $retvar;
            }
        }
示例#2
0
<?php

include "inc/common.php";
$user = new uFlex();
//Logouts user and clears any auto login cookie
$user->logout();
// printr($user->report());
// exit;
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = LOGINPAGE;
header("Location: http://{$host}{$uri}/{$extra}");
exit;
示例#3
0
<?php

#########################################################################################################################
#                                                                                                                       #
#   Copyright (c) 2012 by Oscar Buijten; http://myichimoku.eu  and  http://oscar.buijten.fr                             #
#                                                                                                                       #
#   This work is made available under the terms of the Creative Commons Attribution-NonCommercial 3.0 Unported,         #
#                                                                                                                       #
#   http://creativecommons.org/licenses/by-nc/3.0/legalcode                                                             #
#                                                                                                                       #
#   This work is WITHOUT ANY WARRANTY; without even the implied warranty of FITNESS FOR A PARTICULAR PURPOSE.           #
#                                                                                                                       #
#########################################################################################################################
include "../webconfig.php";
//Proccess Login
if (count($_POST)) {
    @($username = $_POST['username']);
    @($password = $_POST['password']);
    @($auto = $_POST['auto']);
    @($user = new uFlex($username, $password, $auto));
    if ($user->has_error()) {
        $_SESSION['NoteMsgs'] = $user->error();
    }
}
redirect();
示例#4
0
             $registercomplete[] = "Something went wrong :-(";
         }
         if (!$notnew) {
             // new user, register with uFlex
             if (isset($_POST['code'])) {
                 unset($_POST['code']);
             }
             if (isset($_POST['token'])) {
                 unset($_POST['token']);
             }
             if (isset($_POST['group_id'])) {
                 unset($_POST['group_id']);
             }
             $registered = $user->register($_POST, false);
             if ($registered) {
                 $user = new uFlex($_POST['username'], $_POST['password'], $_POST['auto']);
                 $registercomplete[] = "You have succesfully registered.";
                 $registercomplete[] .= "Click <a href=\"http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "\">here</a> to continue";
             } else {
                 //Display Errors
                 foreach ($user->error() as $err) {
                     echo "<b>Error:</b> {$err} <br />";
                 }
             }
         }
     }
     break;
 case "logout":
     //Code Here
     echo "logout";
     break;