Ejemplo n.º 1
0
 public static function attempt($username, $password)
 {
     $logger = new Log();
     if ($username == 'guest' && password_verify($password, self::$password)) {
         $_SESSION['LOGGED_IN_USER'] = $username;
         $logger->logInfo("Success.");
         return true;
     }
     $logger->logError("Failure.");
     return false;
 }
Ejemplo n.º 2
0
 public static function attempt($username, $password)
 {
     $log = new Log('../../php/log');
     if ($username === 'guest' && self::check($password)) {
         $log->logInfo("User {$username} logged in");
         unset($log);
         return true;
     }
     $log->logError("User {$username} failed to log in");
     unset($log);
     return false;
 }
Ejemplo n.º 3
0
 public static function attempt($username, $password)
 {
     if ($username == self::$username && password_verify($password, self::$password)) {
         $_SESSION['LOGGED_IN_USER'] = $username;
         $log = new Log();
         $log->logInfo("{$username}, YOU LOGGED IN!");
         // basically BREAKS once it hits return
         return TRUE;
     } else {
         return FALSE;
     }
 }
Ejemplo n.º 4
0
 public static function attempt($username, $password)
 {
     $correctCredentials = User::verifyLogin($username, $password);
     if (!$correctCredentials) {
         // log result to a log tracking file
         $logInFailure = new Log();
         $logInFailure->logError("User {$username} failed to log in!");
         return false;
     } else {
         // clear session array of any data from previous sessions
         $_SESSION = array();
         // store user's username to pass to next page
         $_SESSION['LOGGED_IN_USER'] = $username;
         // log result to a log tracking file
         $loggedIn = new Log();
         $loggedIn->logInfo("User {$username} logged in successfully.");
         return true;
     }
 }
Ejemplo n.º 5
0
function pageController()
{
    session_start();
    $sessionId = session_id();
    $name = Input::has('name') ? Input::get('name') : "";
    $password = Input::has('password') ? Input::get('password') : "";
    $javascript = '';
    $viewCount = isset($_SESSION['view_count']) ? $_SESSION['view_count'] : 0;
    $viewCount++;
    $_SESSION['view_count'] = $viewCount;
    if (Auth::attempt($name, $password)) {
        $logger = new Log();
        $logger->logInfo('hello');
        header('Location: authorized.php');
        die;
    } else {
        if ($name != "" || $password != "") {
            $javascript = 'alert("Incorrect input.")';
        }
    }
    return array('name' => $name, 'password' => $password, 'sessionId' => $sessionId, 'javascript' => $javascript, 'viewCount' => $viewCount);
}
Ejemplo n.º 6
0
<?php

require_once "../Log.php";
$logger = new Log("cli");
$logger->logInfo(" This is an info message.");
$logger->logError(" This is an error message.");
Ejemplo n.º 7
0
<?php

require_once 'Log.php';
$log = new Log('monkey');
$log->logInfo('This is an info message');
$log->logError('This is an error message');
$log->logMessage('error', '404 page not found');
Ejemplo n.º 8
0
<?php

require 'Log.php';
$testLog = new Log();
$testLog->logInfo("woot");
$testLog->logError("ynewer");
Ejemplo n.º 9
0
<?php

require_once "../lib/Log.php";
$myLog = new Log('cli');
$myLog->logInfo('message');
$myLog->logError('message');
Ejemplo n.º 10
0
<?php

require_once "../log.php";
$log = new Log(07734);
$log->logMessage("HELLO", "I hope this works!");
$log->logInfo();
Ejemplo n.º 11
0
<?php

require_once "log.php";
$log = new Log();
$log->logInfo('User logged in successfutlly');
$log->logError('You do not have permission to view this file');
$log->logMessage('ERROR', '404 page not found');