General::logged_in()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 2
eloc 1
c 2
b 1
f 0
nc 2
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
class General
4
{
5
    public function logged_in()
6
    {
7
        return(isset($_SESSION['loginid'])) ? true : false;
8
    }
9
10
    public function logged_in_protect()
11
    {
12
        if ($this->logged_in() === true) {
13
            header('Location: home.php');
14
            exit();
15
        }
16
    }
17
18
    public function logged_out_protect()
19
    {
20
        if ($this->logged_in() === false) {
21
            header('Location: index.php');
22
            exit();
23
        }
24
    }
25
}
26