PHP User::find_by_loginname Examples

PHP User::find_by_loginname - 2 examples found. These are the top rated real world PHP examples of User::find_by_loginname extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
function checkUserLogin($loginname)
{
    $thisUser = User::find_by_loginname($loginname);
    //Check if user exits
    if ($thisUser != NULL) {
        //User exists
        return TRUE;
    } else {
        //User doesn't exist
        return FALSE;
    }
}
Example #2
0
<?php

/*LanOps Manager - User Management - Login*/
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/libs/std.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/userManagement/users.php";
//Form Actions
//User Login
if ($_POST['action'] == 'login') {
    $thisUser = User::find_by_loginname($_POST['loginname']);
    //Check if User exists
    if ($thisUser != NULL) {
        //User Exists
        //Check if password is valid
        $passResult = checkPassword($thisUser->userid, $_POST['password']);
        if ($passResult == TRUE) {
            //Password is valid
            echo '<pre>';
            var_dump($_POST);
            echo '</pre>';
            $_SESSION['userData']['username'] = $thisUser->username;
            $_SESSION['userData']['loginname'] = $thisUser->loginname;
            $_SESSION['userData']['userid'] = $thisUser->userid;
            $_SESSION['userData']['admin'] = $thisUser->admin;
            header('Location: /index.php');
        } else {
            //Password is invalid
            echo 'Password is invalid';
        }
    } else {
        echo 'user does not exist';
    }