Ejemplo n.º 1
0
<?php

require_once "functions.php";
$error = db_function::db_create();
if ($error !== "ok") {
    echo $error;
} else {
    $upgrade_result = db_upgrade::upgrade_db();
    if ($upgrade_result == "update_done") {
        various::send_alert_and_redirect("Database succesfully updated to version " . costant::app_version(), "index.php");
    }
}
$username = null;
$password = null;
$const_username = costant::login_username();
$const_password = costant::login_password();
$const_disable_authentication = costant::disable_authentication();
if ($const_disable_authentication == "True") {
    header("Location: landing.php");
}
if ($const_disable_authentication !== "True" && (!isset($const_username) or !isset($const_password))) {
    header("Location: settings.php");
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST["Username"]) && !empty($_POST["Password"])) {
        $username = $_POST["Username"];
        $password = hash("sha512", $_POST["Password"]);
        if ($username == $const_username && $password == $const_password) {
            session_start();
            $user_browser = $_SERVER['HTTP_USER_AGENT'];
            $_SESSION["username"] = $username;
Ejemplo n.º 2
0
 public static function to_0_9_9()
 {
     $parameterarray = array("disable_authentication" => costant::disable_authentication() ? "True" : "False", "user_username" => costant::login_username(), "user_password" => costant::login_password(), "disable_payee" => costant::disable_payee() ? "True" : "False", "disable_category" => "False", "defaultaccountname" => costant::transaction_default_account(), "desktop_guid" => costant::desktop_guid());
     various::update_configuration_file($parameterarray);
     $const_dbpath = costant::database_path();
     $db = new PDO("sqlite:{$const_dbpath}");
     $db->exec("ALTER TABLE Payee_List ADD DefCateg TEXT");
     $db->exec("ALTER TABLE Payee_List ADD DefSubCateg TEXT");
     $db->exec("UPDATE Payee_List SET DefCateg = 'None', DefSubCateg = 'None'");
     $db->exec("UPDATE New_Transaction SET Category = 'None', SubCategory = 'None'");
     $db->exec("UPDATE Parameters SET Value = '0.9.9' WHERE Parameter = 'Version';");
     $db = null;
 }