Issues (1752)

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.

func/request.php (9 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
 * @package		fwolflib
4
 * @subpackage	func
5
 * @copyright	Copyright 2007-2012, Fwolf
6
 * @author		Fwolf <[email protected]>
7
 * @since		2007-01-21
8
 */
9
10
11
require_once(dirname(__FILE__) . '/../fwolflib.php');
12
require_once(dirname(__FILE__) . '/string.php');
13
14
15
/**
16
 * Get variant from $_COOKIE
17
 *
18
 * @deprecated      Use Fwlib\Util\HttpUtil::getCookie()
19
 * @param	string	$var		Name of variant
20
 * @param	mixed	$default	If variant is not given, return this.
21
 * @return	mixed
22
 */
23
function GetCookie($var, $default='')
24
{
25
	return GetRequest($_COOKIE, $var, $default);
0 ignored issues
show
Deprecated Code introduced by
The function GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
26
} // end of func GetCookie
27
28
29
/**
30
 * Get variant from $_GET
31
 *
32
 * @deprecated      Use Fwlib\Util\HttpUtil::getGet()
33
 * @param	string	$var		Name of variant
34
 * @param	mixed	$default	If variant is not given, return this.
35
 * @return	mixed
36
 */
37
function GetGet ($var, $default='') {
38
	return GetRequest($_GET, $var, $default);
0 ignored issues
show
Deprecated Code introduced by
The function GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
39
	/*
40
	if (isset($_GET[$var]))
41
		$val = $_GET[$var];
42
	else
43
		$val = $default;
44
	return $val;
45
	*/
46
} // end of func GetGet
47
48
49
/**
50
 * Get and return modified url param
51
 *
52
 * If $k is string, then $v is string too and means add $k=$v.
53
 * if $k is array, then $v is array to,
54
 * and k-v/values in $k/$v is added/removed to/from url param.
55
 *
56
 * @deprecated      Use Fwlib\Util\HttpUtil::getUrlParam()
57
 * @param	mixed	$k
58
 * @param	mixed	$v
59
 * @param	boolean	$b_with_url	If true, return value include self url.
60
 * @return	string	'?' and '&' included.
61
 */
62
function GetParam ($k = '', $v = '', $b_with_url = false) {
63
	$ar_param = $_GET;
64
	if (!empty($ar_param) && !get_magic_quotes_gpc()) {
65
		foreach ($ar_param as &$p) {
66
			$p = addslashes($p);
67
		}
68
	}
69
70
	// $k $v is string
71 View Code Duplication
	if (!is_array($k) && !is_array($v) && '' != $k) {
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...
72
		$ar_param[addslashes($k)] = addslashes($v);
73
	}
74
75
	// $k $v is array
76
	if (is_array($k)) {
77
		foreach ($k as $key => $val)
78
			$ar_param[addslashes($key)] = addslashes($val);
79
		if (!is_array($v))
80
			$v = array($v);
81
		foreach ($v as $val)
82
			if (isset($ar_param[$val]))
83
				unset($ar_param[$val]);
84
	}
85
86
	// Combine param
87
	$s = '';
88
	if (!empty($ar_param))
89
		foreach ($ar_param as $k => $v)
90
			$s .= "&$k=$v";
91
	if (!empty($s))
92
		$s{0} = '?';
93
94
	// Add self url
95
	if (true == $b_with_url)
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
96
		$s = GetSelfUrl(false) . $s;
0 ignored issues
show
Deprecated Code introduced by
The function GetSelfUrl() has been deprecated with message: Use Fwlib\Util\HttpUtil::getSelfUrl()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
97
98
	return $s;
99
} // end of func GetParam
100
101
102
/**
103
 * Get variant from $_POST
104
 *
105
 * @deprecated      Use Fwlib\Util\HttpUtil::getPost()
106
 * @param	string	$var		Name of variant
107
 * @param	mixed	$default	If variant is not given, return this.
108
 * @return	mixed
109
 */
110
function GetPost ($var, $default='') {
111
	return GetRequest($_POST, $var, $default);
0 ignored issues
show
Deprecated Code introduced by
The function GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
112
	/*
113
	if (isset($_POST[$var]))
114
		$val = $_POST[$var];
115
	else
116
		$val = $default;
117
	return $val;
118
	*/
119
} // end of func GetPost
120
121
122
/**
123
 * Get variant from $_REQUEST
124
 *
125
 * @deprecated      Use Fwlib\Util\HttpUtil::getRequest()
126
 * @param	array	$r		Request, $_GET/$_POST etc...
127
 * @param	string	$var	Name of variant
128
 * @param	mixed	$default	If variant is not given, return this
129
 * @return	mixed
130
 */
131
function GetRequest (&$r, $var, $default = null)
132
{
133
	if (isset($r[$var])) {
134
		$val = $r[$var];
135
136
		$filter = FILTER_SANITIZE_SPECIAL_CHARS;
137
		if (is_array($val)) {
138
		    $val = filter_var_array($val, $filter);
139
        } else {
140
            $val = filter_var($val, $filter);
141
        }
142
143
		// Deal with special chars in parameters
144
		// magic_quotes_gpc is deprecated from php 5.4.0
145
//		if (version_compare(PHP_VERSION, '5.4.0', '>=')
146
//			|| !get_magic_quotes_gpc())
147
//			$val = AddslashesRecursive($val);
148
	}
149
	else {
150
        $val = $default;
151
    }
152
153
	return $val;
154
}
155
156
157
/**
158
 * Get self url which user visit
159
 *
160
 * @deprecated      Use Fwlib\Util\HttpUtil::getSelfUrl()
161
 * @param	boolean	$with_get_param	// Include get param in url, default yes.
162
 * @return	string
163
 */
164
function GetSelfUrl($with_get_param = true) {
165
	if (isset($_SERVER["HTTPS"]) && 'on' == $_SERVER["HTTPS"])
166
		$url = 'https://';
167
	else
168
		$url = 'http://';
169
170
	$s_t = ($with_get_param) ? $_SERVER['REQUEST_URI'] : $_SERVER["SCRIPT_NAME"];
171
172
	$url .= $_SERVER["HTTP_HOST"] . $s_t;
173
	return $url;
174
} // end of func GetSelfUrl
175
176
177
/**
178
 * Get variant from $_SESSION,will also rewrite SESSION to keep it
179
 *
180
 * @deprecated      Use Fwlib\Util\HttpUtil::getSession()
181
 * @param	string	$var		Name of variant
182
 * @param	mixed	$default	If variant is not given, return this.
183
 * @return	mixed
184
 */
185
function GetSession($var, $default='') {
186
	$_SESSION[$var] = GetRequest($_SESSION, $var, $default);
0 ignored issues
show
Deprecated Code introduced by
The function GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
187
	return $_SESSION[$var];
188
} // end of func GetSession
189
190
191
/**
192
 * Get url plan from url or self
193
 *
194
 * eg: http://www.google.com/, plan = http
195
 *
196
 * @deprecated      Use Fwlib\Util\HttpUtil::getUrlPlan()
197
 * @param	string	$url	Default: self url
198
 * @return	string
199
 */
200
function GetUrlPlan($url = '') {
201
	if (empty($url))
202
		$url = GetSelfUrl();
0 ignored issues
show
Deprecated Code introduced by
The function GetSelfUrl() has been deprecated with message: Use Fwlib\Util\HttpUtil::getSelfUrl()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
203
	$i = preg_match('/^(\w+):\/\//', $url, $ar);
204
	if (1 == $i)
205
		return $ar[1];
206
	else
207
		return '';
208
} // end of func GetUrlPlan
209
210
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
211