Issues (68)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

blocks/memberslastlogin_block.php (4 issues)

1
<?php
2
// Author: Lio MJ
3
// Website: https://www.github.com/liomj/
4
5
if (!defined('XOOPS_ROOT_PATH')) {
6
    exit;
7
}
8
9
/**
10
 * @param $options
11
 * @return array
12
 */
13
function show_memberslastlogin_block($options)
14
{
15
    $x      = 0;
16
    $now    = time();
17
    $hours  = 24;
18
    $time   = ((int)$hours > 0) ? time() - ((int)$hours * 3600) : (time() - 24 * 3600);
19
    $block  = [];
20
    $sql    = 'SELECT distinct uid, name, uname, user_avatar, last_login FROM ' . $GLOBALS['xoopsDB']->prefix('users') . " WHERE level > 0 AND last_login >= '" . $time . "' ORDER BY last_login DESC LIMIT " . $options[3] . '';
21
    $result = $GLOBALS['xoopsDB']->query($sql);
22
    while (list($uid, $name, $uname, $user_avatar, $last_login) = $GLOBALS['xoopsDB']->fetchRow($result)) {
23
        $sincelastlogin = ' ' . timeDifference($last_login, $now, _MB_XOOPSMEMBERS_HOURS) . ' ' . _MB_XOOPSMEMBERS_AGO;
24
        $x++;
25
26
        $recentlogin = [];
27
        $recentlogin['uid']     = $uid;
28
        if ('' != $name && '1' == $options[2]) {
29
            $recentlogin['name'] = htmlspecialchars($name, ENT_QUOTES);
30
        } else {
31
            $recentlogin['name'] = $uname;
32
        }
33
        $recentlogin['user_avatar']    = $user_avatar;
34
        $recentlogin['last_login']     = $last_login;
35
        $recentlogin['sincelastlogin'] = $sincelastlogin;
36
37
        $block['recentlogin'][] = $recentlogin;
38
        unset($recentlogin);
39
    }
40
41
    $block['showrecentloginname']   = $options[0];
42
    $block['showrecentloginavatar'] = $options[1];
43
    $block['userealname']           = $options[2];
44
    $block['memberdisplay']         = $options[3];
45
    return $block;
46
}
47
48
/**
49
 * @param        $start
50
 * @param        $end
51
 * @param string $return
52
 * @return string
53
 */
54
function timeDifference($start, $end, $return = 'days')
55
{
56
    //change times to Unix timestamp.
57
    //$start = strtotime($start);
58
    //$end = strtotime($end);
59
    //subtract dates
60
    $difference = max($end, $start) - min($end,$start);
61
    $time       = null;
62
    //24 hours equal to 86400
63
    //calculate time difference.
64
    switch($return) {
65
        case 'days':
66
            $days = floor($difference/86400);
67
            $difference = $difference % 86400;
68
            $time['days'] = $days;
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment if this fall-through is intended.
Loading history...
69
        case 'hours':
70
            $hours = floor($difference/3600);
71
            $difference = $difference % 3600;
72
            $time['hours'] = $hours;
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment if this fall-through is intended.
Loading history...
73
        case 'minutes':
74
            $minutes = floor($difference/60);
75
            $difference = $difference % 60;
76
            $time['minutes'] = $minutes;
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment if this fall-through is intended.
Loading history...
77
        case 'seconds':
78
            $seconds = $difference;
79
            $time['seconds'] = $seconds;
80
    }
81
82
    $output = [];
83
    if(is_array($time)) {
0 ignored issues
show
The condition is_array($time) is always false.
Loading history...
84
        $showSec = true;
85
        if(isset($time['hours']) && $time['hours'] > 0) {
86
            $output[] = $time['hours']. ' ' . _MB_XOOPSMEMBERS_HOUR;
87
            $showSec = false;
88
        }
89
90
        if(isset($time['minutes']) && $time['minutes'] > 0) {
91
            $output[] = $time['minutes']. ' ' . _MB_XOOPSMEMBERS_MINUTES;
92
            $showSec = false;
93
        }
94
95
        if (isset($time['seconds']) && true === $showSec) {
96
            return $time['seconds']. ' ' . _MB_XOOPSMEMBERS_SECONDS;
97
        }
98
        return implode(', ',$output);
99
    }
100
}
101
102
/**
103
 * @param $options
104
 * @return string
105
 */
106
function memberslastlogin_edit($options)
107
{
108
    $form = _MB_XOOPSMEMBERS_SHOWRECENTLOGINNAME . '&nbsp;';
109
    $chk = '';
110
    if (1 == $options[0]) {
111
        $chk = " checked";
112
    }
113
    $form .= "<input type='radio' name='options[0]' value='1'" . $chk . ' >&nbsp;' . _YES . '';
114
    $chk  = '';
115
    if (0 == $options[0]) {
116
        $chk = " checked";
117
    }
118
    $form .= "&nbsp;<input type='radio' name='options[0]' value='0'" . $chk . ' >' . _NO . '<br>';
119
120
    $form .= _MB_XOOPSMEMBERS_SHOWRECENTLOGINAVATAR . '&nbsp;';
121
    if (1 == $options[1]) {
122
        $chk = " checked";
123
    }
124
    $form .= "<input type='radio' name='options[1]' value='1'" . $chk . ' >&nbsp;' . _YES . '';
125
    $chk  = '';
126
    if (0 == $options[1]) {
127
        $chk = " checked";
128
    }
129
    $form .= "&nbsp;<input type='radio' name='options[1]' value='0'" . $chk . ' >' . _NO . '<br>';
130
131
    $form .= _MB_XOOPSMEMBERS_USEREALNAME . '&nbsp;';
132
    if (1 == $options[2]) {
133
        $chk = " checked";
134
    }
135
    $form .= "<input type='radio' name='options[2]' value='1'" . $chk . ' >&nbsp;' . _YES . '';
136
    $chk  = '';
137
    if (0 == $options[2]) {
138
        $chk = " checked";
139
    }
140
    $form .= "&nbsp;<input type='radio' name='options[2]' value='0'" . $chk . ' >' . _NO . '<br>';
141
142
    $form .= _MB_XOOPSMEMBERS_MEMBERDISPLAY . '&nbsp;';
143
    $form .= "<input type='text' name='options[3]' value='" . $options[3] . "'>";
144
    return $form;
145
}
146
147
148