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/env.php (4 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
 * Functions about runtime environment and server env variant
4
 *
5
 * Original is_cli.php and nixos.php merged in this.
6
 * @package		fwolflib
7
 * @copyright	Copyright 2006-2010, Fwolf
8
 * @author		Fwolf <[email protected]>
9
 * @since		2006-07-08
10
 */
11
12
13
require_once(dirname(__FILE__) . '/../fwolflib.php');
14
15
16
/**
17
 * Force page visit through https only
18
 *
19
 * @deprecated      Use Fwlib\Util\Env::forceHttps()
20
 */
21
function ForceHttps() {
22
	if (!isset($_SERVER['HTTPS']) || 'on' != $_SERVER['HTTPS']) {
23
		$s = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
24
		header("Location: $s");
25
	}
26
} // end of function ForceHttps
27
28
29
/**
30
 * Check if this program is running under cli mod, or is viewing in browser.
31
 *
32
 * Tested in nix os only
33
 *
34
 * @deprecated      Use Fwlib\Util\Env::isCli()
35
 * @return	boolean
36
 */
37
function IsCli() {
38
/*
39
	if (isset($_ENV['_']) && (('/usr/bin/php' == substr($_ENV['_'], 0, 12))
40
		|| ($_SERVER["SCRIPT_FILENAME"] == $_ENV['_'])))    //chmod +x xxx.php and run itself
41
*/
42
	if (!empty($_ENV['_']) || !empty($_SERVER['_']))
43
		$is_cli = true;
44
	else
45
		$is_cli = false;
46
	return($is_cli);
47
} // end of func IsCli
48
49
50
/**
51
 * 判断当前主机是否nix操作系统
52
 *
53
 * @deprecated      Use Fwlib\Util\Env::isNixOs()
54
 * @return boolean
55
 */
56
function NixOs()
57
{
58
	//采用判断执行文件全路径的第一个字符的方式
59
	if ('/' == $_SERVER['SCRIPT_FILENAME']{0})
60
		return true;
61
	else
62
		return false;
63
}
64
65
66
/**
67
 * Generate path from script to project root - P2R
68
 *
69
 * Can use in both cli mod and www mod.
70
 *
71
 * <code>
72
 * define('P2R', P2r('relate_path_to_proj_root'))
73
 * </code>
74
 * @param	string	$path	Relate path from root to here, start with no '/',
75
 * 							Better end with '/'.
76
 * @return	string
77
 */
78
function P2r($path)
79
{
80
	$s = '';
0 ignored issues
show
$s is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
81
	if (true == IsCli())
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...
Deprecated Code introduced by
The function IsCli() has been deprecated with message: Use Fwlib\Util\Env::isCli()

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...
82
		$s = dirname($_SERVER['SCRIPT_NAME']) . '/./' . $path;
83
	else
84
		$s = './' . $path;
85
86
	return $s;
87
} // end of func P2r
88
?>
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...
89