Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbutv3/word-app/util/

db_connect.php
dict.xml
practice.php
user.php
util.php

user.php

19 lines ASCII Windows (CRLF)
<?php

function user_id()
{
    return 
$_SESSION["userId"];
}

function 
logged_in()
{
    return isset(
$_SESSION["userId"]) && $_SESSION["userId"] != null;
}

function 
login_guard()
{
    if (!
logged_in()) {
        
header("Location: " path_to_url(BASE_PATH "/login.php"));
        die();
    }
}