Issues (1098)

Security Analysis    not enabled

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

src/records/subscribe.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
//------------------------------------------------------------------------------
4
//
5
//  eTraxis - Records tracking web-based system
6
//  Copyright (C) 2006-2011  Artem Rodygin
7
//
8
//  This program is free software: you can redistribute it and/or modify
9
//  it under the terms of the GNU General Public License as published by
10
//  the Free Software Foundation, either version 3 of the License, or
11
//  (at your option) any later version.
12
//
13
//  This program is distributed in the hope that it will be useful,
14
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
//  GNU General Public License for more details.
17
//
18
//  You should have received a copy of the GNU General Public License
19
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//------------------------------------------------------------------------------
22
23
/**
24
 * @package eTraxis
25
 * @ignore
26
 */
27
28
/**#@+
29
 * Dependency.
30
 */
31
require_once('../engine/engine.php');
32
require_once('../dbo/accounts.php');
33
require_once('../dbo/records.php');
34
/**#@-*/
35
36
init_page(LOAD_INLINE);
37
38
$id = ustr2int(try_request('id'));
39
40
if (!EMAIL_NOTIFICATIONS_ENABLED)
41
{
42
    debug_write_log(DEBUG_NOTICE, 'Email Notifications functionality is disabled.');
43
    header('HTTP/1.1 307 view.php?id=' . $id);
44
    exit;
45
}
46
47
// check that requested record exists
48
49
$record = record_find($id);
50
51
if (!$record)
52
{
53
    debug_write_log(DEBUG_NOTICE, 'Record cannot be found.');
54
    header('HTTP/1.1 307 index.php');
55
    exit;
56
}
57
58
// subscribe selected accounts
59
60
if (try_request('submitted') == 'subscribeform')
61
{
62
    debug_write_log(DEBUG_NOTICE, 'Data are submitted (subscribe selected).');
63
64
    if (isset($_REQUEST['nsubscribed']))
65
    {
66
        foreach ($_REQUEST['nsubscribed'] as $item)
67
        {
68
            record_subscribe($id, $item, $_SESSION[VAR_USERID]);
69
        }
70
    }
71
    else
72
    {
73
        debug_write_log(DEBUG_NOTICE, 'No accounts are selected.');
74
    }
75
}
76
77
// unsubscribe selected accounts
78
79
elseif (try_request('submitted') == 'unsubscribeform')
80
{
81
    debug_write_log(DEBUG_NOTICE, 'Data are submitted (unsubscribe selected).');
82
83
    if (isset($_REQUEST['subscribed']))
84
    {
85
        foreach ($_REQUEST['subscribed'] as $item)
86
        {
87
            record_unsubscribe($id, $item, $_SESSION[VAR_USERID]);
88
        }
89
    }
90
    else
91
    {
92
        debug_write_log(DEBUG_NOTICE, 'No accounts are selected.');
93
    }
94
}
95
else
96
{
97
    debug_write_log(DEBUG_NOTICE, 'Data are being requested.');
98
}
99
100
// local JS functions
101
102
$xml = <<<JQUERY
103
<script>
104
105
function subscribeSuccess (data)
106
{
107
    $("#modaldlg").load("subscribe.php?id={$id}", function() {
108
        $("input.button").button();
109
    });
110
}
111
112
</script>
113
JQUERY;
114
115
// generate left side
116
117
$xml .= '<dual>'
118
      . '<dualleft>'
119
      . '<form name="subscribeform" action="subscribe.php?id=' . $id . '" success="subscribeSuccess">'
120
      . '<group title="' . get_html_resource(RES_MEMBERS_ID) . '">'
121
      . '<control name="nsubscribed[]">'
122
      . '<listbox size="10">';
123
124
$rs = dal_query('records/nsubscribed.sql', $id, $_SESSION[VAR_USERID]);
125
126 View Code Duplication
while (($row = $rs->fetch()))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
127
{
128
    if ($row['account_id'] != $_SESSION[VAR_USERID])
129
    {
130
        $xml .= '<listitem value="' . $row['account_id'] . '">'
131
              . ustr2html(sprintf('%s (%s)', $row['fullname'], account_get_username($row['username'])))
132
              . '</listitem>';
133
    }
134
}
135
136
$xml .= '</listbox>'
137
      . '</control>'
138
      . '</group>'
139
      . '</form>'
140
      . '</dualleft>';
141
142
// generate right side
143
144
$xml .= '<dualright>'
145
      . '<form name="unsubscribeform" action="subscribe.php?id=' . $id . '" success="subscribeSuccess">'
146
      . '<group title="' . get_html_resource(RES_SUBSCRIBED_ID) . '">'
147
      . '<control name="subscribed[]">'
148
      . '<listbox size="10">';
149
150
$rs = dal_query('records/subscribed.sql', $id, $_SESSION[VAR_USERID]);
151
152 View Code Duplication
while (($row = $rs->fetch()))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
153
{
154
    if ($row['account_id'] != $_SESSION[VAR_USERID])
155
    {
156
        $xml .= '<listitem value="' . $row['account_id'] . '">'
157
              . ustr2html(sprintf('%s (%s)', $row['fullname'], account_get_username($row['username'])))
158
              . '</listitem>';
159
    }
160
}
161
162
$xml .= '</listbox>'
163
      . '</control>'
164
      . '</group>'
165
      . '</form>'
166
      . '</dualright>';
167
168
// generate buttons
169
170
$xml .= '<button action="$(\'#subscribeform\').submit()">%gt;%gt;</button>'
171
      . '<button action="$(\'#unsubscribeform\').submit()">%lt;%lt;</button>'
172
      . '</dual>';
173
174
echo(xml2html($xml));
175
176
?>
177