APO-Epsilon/apo-website

View on GitHub
enter_excuse.php

Summary

Maintainability
A
1 hr
Test Coverage

show_active accesses the super-global variable $_POST.
Open

function show_active() {
    include('mysql_access.php');
    include('retrieve_user.php');
    $user_id = $_SESSION['sessionID'];    
Severity: Minor
Found in enter_excuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

show_active accesses the super-global variable $_POST.
Open

function show_active() {
    include('mysql_access.php');
    include('retrieve_user.php');
    $user_id = $_SESSION['sessionID'];    
Severity: Minor
Found in enter_excuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

show_active accesses the super-global variable $_POST.
Open

function show_active() {
    include('mysql_access.php');
    include('retrieve_user.php');
    $user_id = $_SESSION['sessionID'];    
Severity: Minor
Found in enter_excuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

show_active accesses the super-global variable $_POST.
Open

function show_active() {
    include('mysql_access.php');
    include('retrieve_user.php');
    $user_id = $_SESSION['sessionID'];    
Severity: Minor
Found in enter_excuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

show_active accesses the super-global variable $_SESSION.
Open

function show_active() {
    include('mysql_access.php');
    include('retrieve_user.php');
    $user_id = $_SESSION['sessionID'];    
Severity: Minor
Found in enter_excuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Method show_active has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function show_active() {
    include('mysql_access.php');
    include('retrieve_user.php');
    $user_id = $_SESSION['sessionID'];    
Severity: Minor
Found in enter_excuse.php - About 1 hr to fix

    Function show_active has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function show_active() {
        include('mysql_access.php');
        include('retrieve_user.php');
        $user_id = $_SESSION['sessionID'];    
    
    Severity: Minor
    Found in enter_excuse.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid using undefined variables such as '$db' which will lead to PHP notices.
    Open

                    $xresponse=$db->query("SELECT * FROM events_listing WHERE event_type='Attendance' ORDER BY event_name");
    Severity: Minor
    Found in enter_excuse.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

    Avoid unused local variables such as '$db'.
    Open

                    $xresponse=$db->query("SELECT * FROM events_listing WHERE event_type='Attendance' ORDER BY event_name");
    Severity: Minor
    Found in enter_excuse.php by phpmd

    UnusedLocalVariable

    Since: 0.2

    Detects when a local variable is declared and/or assigned, but not used.

    Example

    class Foo {
        public function doSomething()
        {
            $i = 5; // Unused
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 27 and the first side effect is on line 2.
    Open

    <?php
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        $user_id = $_SESSION['sessionID'];    
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        $position = id_to_position($user_id);
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    {
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        <form method='post' action=''>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                        echo "<option value='" . $result['event_id'] . "'>" . $result['event_name'] . "</option>";
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "True"
    Open

    $active_page = True;
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            global $current_semester;
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            echo 'done';
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            <p>event:</p>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    <?php
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        if (isset($_POST['excuse']))
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            include('retrieve_event.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            add_excuse($_POST['user_id'],$_POST['instance'],$_POST['excuse'],$current_semester);
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            <input type='text' name='excuse'>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            <input type='submit' name='submit'>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            <p>excuse:</p>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    ?>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Blank line found at start of control structure
    Open

        if ($position == "Webmaster" || $position == "Recording Secretary") {
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "False"
    Open

    $public_page = False;
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            <p>user id:</p>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                <select name='instance' onchange="this.form.submit()">
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        <?php
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            <input type='text' name='user_id'>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    while($result=mysqli_fetch_array($xresponse)) 
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                <br>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        if ($position == "Webmaster" || $position == "Recording Secretary") {
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        ?>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    <option value='null' selected>-- select one --</option>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "False"
    Open

    $exec_page = False;
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    include('mysql_access.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    $xresponse=$db->query("SELECT * FROM events_listing WHERE event_type='Attendance' ORDER BY event_name");
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                </select>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        </form>
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        include('retrieve_user.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        $user_id = $_SESSION['sessionID'];    
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        include('mysql_access.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    End of line character is invalid; expected "\n" but found "\r\n"
    Open

    <?php
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Whitespace found at end of line
    Open

        $user_id = $_SESSION['sessionID'];    
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    No space found after comma in function call
    Open

            add_excuse($_POST['user_id'],$_POST['instance'],$_POST['excuse'],$current_semester);
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    No space found after comma in function call
    Open

            add_excuse($_POST['user_id'],$_POST['instance'],$_POST['excuse'],$current_semester);
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 4
    Open

        if (isset($_POST['excuse']))
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Opening brace should be on a new line
    Open

    function show_active() {
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Whitespace found at end of line
    Open

                    while($result=mysqli_fetch_array($xresponse)) 
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 8
    Open

            echo 'done';
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        {
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Space before opening parenthesis of function call prohibited
    Open

    require_once ('session.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 8
    Open

            add_excuse($_POST['user_id'],$_POST['instance'],$_POST['excuse'],$current_semester);
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 4
    Open

        }
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Space before opening parenthesis of function call prohibited
    Open

    require_once ('mysql_access.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 6
    Open

        if (isset($_POST['excuse']))
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 8
    Open

            global $current_semester;
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Expected 1 space after WHILE keyword; 0 found
    Open

                    while($result=mysqli_fetch_array($xresponse)) 
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 8
    Open

            include('retrieve_event.php');
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    No space found after comma in function call
    Open

            add_excuse($_POST['user_id'],$_POST['instance'],$_POST['excuse'],$current_semester);
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 19
    Open

                    while($result=mysqli_fetch_array($xresponse)) 
    Severity: Minor
    Found in enter_excuse.php by phpcodesniffer

    The variable $current_semester is not named in camelCase.
    Open

    function show_active() {
        include('mysql_access.php');
        include('retrieve_user.php');
        $user_id = $_SESSION['sessionID'];    
    
    Severity: Minor
    Found in enter_excuse.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $user_id is not named in camelCase.
    Open

    function show_active() {
        include('mysql_access.php');
        include('retrieve_user.php');
        $user_id = $_SESSION['sessionID'];    
    
    Severity: Minor
    Found in enter_excuse.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $current_semester is not named in camelCase.
    Open

    function show_active() {
        include('mysql_access.php');
        include('retrieve_user.php');
        $user_id = $_SESSION['sessionID'];    
    
    Severity: Minor
    Found in enter_excuse.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $user_id is not named in camelCase.
    Open

    function show_active() {
        include('mysql_access.php');
        include('retrieve_user.php');
        $user_id = $_SESSION['sessionID'];    
    
    Severity: Minor
    Found in enter_excuse.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status