Beispiel #1
0
        var_dump($usersArray);
        $isRunInsertDB = false;
        if ($argumentsArray["h"] == "" || $argumentsArray["u"] == "") {
            echo "please input the [-u] and [-h] arguments\n";
            exitWithHelpInfo();
        } else {
            usersInsertIntoDB($usersArray, $argumentsArray, $isRunInsertDB);
            exit(1);
        }
    }
}
//the input arguments do not contain "--help","create_table", "dry_run" arguments
//and contain "--file" arguments, read all the users from file and insert into DB;
if ($argumentsArray["file"] != "") {
    $file = $argumentsArray["file"];
    $usersArray = getUsersFromFile($file);
    if ($argumentsArray["h"] == "" || $argumentsArray["u"] == "") {
        echo "please input the [-u] and [-h] arguments\n";
        exitWithHelpInfo();
    } else {
        usersInsertIntoDB($usersArray, $argumentsArray, $isRunInsertDB);
        exit(1);
    }
}
// command line parse function, parse the command line and store all the arguments
// in the $argumentsArray and return.
// input parameters:
// $argc: the number of input arguments from command line
// $argv: the array of input arguments from command line
// return value:
// $argumentsArray: the parsed arguments array
Beispiel #2
0
<?php

require_once 'const.php';
$login = $_POST['login'];
$password = $_POST['password'];
$users = getUsersFromFile();
foreach ($users as $user) {
    if ($user['login'] == $login) {
        if ($user['password'] == $password) {
            header('Location: ' . PATH . 'login-success.html');
            die;
        } else {
            header('Location: ' . PATH . 'password-fail.html');
            die;
        }
    }
}
header('Location: ' . PATH . 'no-user.html');