Exemplo n.º 1
0
Arquivo: index.php Projeto: nemcko/b2b
if (session_id()) {
    if (isset($_COOKIE['PHPSESSID']) && !empty($_COOKIE['PHPSESSID'])) {
        session_id($_COOKIE['PHPSESSID']);
    } elseif (isset($_GET['PHPSESSID']) && !empty($_GET['PHPSESSID'])) {
        session_id($_GET['PHPSESSID']);
    } else {
        header('Location: index.php');
        exit(0);
    }
}
session_start();
if ($_POST && $_POST["ac"] == "log") {
    require_once 'api/config.php';
    $cfgobj = new clsConfig();
    $config = $cfgobj->getData("cfgusers", "api/");
    foreach ($config as $usr) {
        if ($usr['UserName'] == $_POST["usr"] && $usr['UserPassword'] == $_POST["pwd"]) {
            $_SESSION["logged"] = $_POST["usr"];
            break;
        }
    }
    // $_SESSION["logged"]=$_POST["usr"];
    header("Location: ./");
} elseif ($_POST && $_POST["ac"] == "exit") {
    unset($_SESSION["logged"]);
    header("Location: ./");
}
?>

<!doctype html>