Issues (267)

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.

ratevideo.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Module: XoopsTube
5
 *
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 *
10
 * PHP version 5
11
 *
12
 * @category        Module
13
 * @package         Xoopstube
14
 * @author          XOOPS Development Team
15
 * @copyright       2001-2016 XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
17
 * @link            https://xoops.org/
18
 * @since           1.0.6
19
 */
20
21
use Xmf\Request;
22
use XoopsModules\Xoopstube\{Utility
23
};
24
$GLOBALS['xoopsOption']['template_main'] = 'xoopstube_ratevideo.tpl';
25
require_once __DIR__ . '/header.php';
26
27
global $myts, $xoTheme;
28
29
// Check if videoload POSTER is voting (UNLESS Anonymous users allowed to post)
30
$lid = Request::getInt('lid', Request::getInt('lid', '', 'POST'), 'GET');
0 ignored issues
show
'' of type string is incompatible with the type integer expected by parameter $default of Xmf\Request::getInt(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
$lid = Request::getInt('lid', Request::getInt('lid', /** @scrutinizer ignore-type */ '', 'POST'), 'GET');
Loading history...
31
32
$ip         = getenv('REMOTE_ADDR');
33
$ratinguser = (!is_object($GLOBALS['xoopsUser'])) ? 0 : $GLOBALS['xoopsUser']->getVar('uid');
34
35
if (0 == $GLOBALS['xoopsModuleConfig']['showrating'] || '' == $lid) {
36
    $ratemessage = _MD_XOOPSTUBE_CANTVOTEOWN;
37
    redirect_header('index.php', 4, $ratemessage);
38
}
39
40
if (0 !== $ratinguser) {
41
    $sql    = 'SELECT cid, submitter FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
42
    $result = $GLOBALS['xoopsDB']->query($sql);
43
    while (list($cid, $ratinguserDB) = $GLOBALS['xoopsDB']->fetchRow($result)) {
44
        if ($ratinguserDB === $ratinguser) {
45
            $ratemessage = _MD_XOOPSTUBE_CANTVOTEOWN;
46
            redirect_header('singlevideo.php?cid=' . (int)$cid . '&amp;lid=' . $lid, 4, $ratemessage);
47
        }
48
    }
49
    // Check if REG user is trying to vote twice.
50
    $sql    = 'SELECT cid, ratinguser FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE lid=' . $lid;
51
    $result = $GLOBALS['xoopsDB']->query($sql);
52
    if ($result) {
53
        while (list($cid, $ratinguserDB) = $GLOBALS['xoopsDB']->fetchRow($result)) {
54
            if ($ratinguserDB === $ratinguser) {
55
                $ratemessage = _MD_XOOPSTUBE_VOTEONCE;
56
                redirect_header('singlevideo.php?cid=' . (int)$cid . '&amp;lid=' . $lid, 4, $ratemessage);
57
            }
58
        }
59
    }
60
61
} else {
62
    // Check if ANONYMOUS user is trying to vote more than once per day.
63
    $yesterday = (time() - (86400 * $anonwaitdays));
64
    $sql       = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE lid=' . $lid . ' AND ratinguser=0 AND ratinghostname=' . $ip . '  AND ratingtimestamp > ' . $yesterday;
65
    $result    = $GLOBALS['xoopsDB']->query($sql);
66
    [$anonvotecount] = $GLOBALS['xoopsDB']->fetchRow($result);
67
    if ($anonvotecount >= 1) {
68
        $ratemessage = _MD_XOOPSTUBE_VOTEONCE;
69
        redirect_header('singlevideo.php?cid=' . (int)$cid . '&amp;lid=' . $lid, 4, $ratemessage);
70
    }
71
}
72
73
if (!empty(Request::getString('submit', ''))) {
74
    $ratinguser = (!is_object($GLOBALS['xoopsUser'])) ? 0 : $GLOBALS['xoopsUser']->getVar('uid');
75
    // Make sure only 1 anonymous from an IP in a single day.
76
    $anonwaitdays = 1;
77
    $ip           = getenv('REMOTE_ADDR');
78
    $lid          = Request::getInt('lid', 0, 'POST');
79
    $cid          = Request::getInt('cid', 0, 'POST');
80
    $rating       = Request::getInt('rating', 0, 'POST');
81
    //    $title        = $myts->addslashes(trim(Request::getString('title', '', 'POST')));
82
    $title = Request::getString('title', '', 'POST');
83
    // Check if Rating is Null
84
    if (0 == $rating) {
85
        $ratemessage = _MD_XOOPSTUBE_NORATING;
86
        redirect_header('ratevideo.php?cid=' . $cid . '&amp;lid=' . $lid, 4, $ratemessage);
87
    }
88
    // All is well.  Add to Line Item Rate to DB.
89
    $newid    = $GLOBALS['xoopsDB']->genId($GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . '_ratingid_seq');
90
    $datetime = time();
91
    $sql      = sprintf(
92
        'INSERT INTO `%s` (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp, title) VALUES (%u, %u, %u, %u, %s, %u, %s)',
93
        $GLOBALS['xoopsDB']->prefix('xoopstube_votedata'),
94
        $newid,
95
        $lid,
96
        $ratinguser,
97
        $rating,
98
        $GLOBALS['xoopsDB']->quoteString($ip),
99
        $datetime,
100
        $GLOBALS['xoopsDB']->quoteString($title)
101
    );
102
    if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
103
        $ratemessage = _MD_XOOPSTUBE_ERROR;
104
    } else {
105
        // All is well.  Calculate Score & Add to Summary (for quick retrieval & sorting) to DB.
106
        Utility::updateRating($lid);
107
        $ratemessage = _MD_XOOPSTUBE_VOTEAPPRE . '<br>' . sprintf(_MD_XOOPSTUBE_THANKYOU, $GLOBALS['xoopsConfig']['sitename']);
108
    }
109
    redirect_header('singlevideo.php?cid=' . $cid . '&amp;lid=' . $lid, 4, $ratemessage);
110
} else {
111
    //TODO add
112
    require_once XOOPS_ROOT_PATH . '/header.php';
113
114
    $catarray['imageheader'] = Utility::renderImageHeader();
115
    $cid                     = Request::getInt('cid', Request::getInt('cid', '', 'POST'), 'GET');
116
117
    $catarray['imageheader'] = Utility::renderImageHeader();
118
    $xoopsTpl->assign('catarray', $catarray);
119
    $xoopsTpl->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName);
120
121
    $result = $GLOBALS['xoopsDB']->query('SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid);
122
    [$title] = $GLOBALS['xoopsDB']->fetchRow($result);
123
    $xoopsTpl->assign(
124
        'video',
125
        [
126
            'id'    => $lid,
127
            'cid'   => $cid,
128
            'title' => htmlspecialchars($title, ENT_QUOTES | ENT_HTML5),
129
        ]
130
    );
131
132
    Utility::setNoIndexNoFollow();
133
134
    $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname'));
135
    require_once XOOPS_ROOT_PATH . '/footer.php';
136
}
137
138
Utility::setNoIndexNoFollow();
139
140
$xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname'));
141
require_once XOOPS_ROOT_PATH . '/footer.php';
142