Issues (93)

Security Analysis    no request data  

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.

ClashAPI/Player.class.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
	class CoC_Player
3
	{
4
		protected $api;
5
		protected $tag; 
6
		protected $player = NULL;
7
8
		/**
9
		 * Constructor of CoC_Clan
10
		 * Either pass the clan tag or a stdClass containing all clan information.
11
		 */
12
		public function __construct($tag)
13
		{
14
			$this->api = new ClashOfClans();
15
			$this->tag = $tag;
16
			$this->getPlayer();
17
	   	}
18
		
19
		/**
20
		 * Sending requests over through API.class.php;
21
		 */
22
	   	protected function getPlayer()
23
	   	{
24
	   		if($this->player == NULL)
25
			{
26
				$this->player = $this->api->getPlayer($this->tag);
27
			}
28
			return $this->player;
29
	   	}
30
31
	   	/**
32
	   	 * Getting current player tag.
33
	   	 *
34
	   	 * @return string, tag
35
	   	 */
36
	   	public function getTag()
37
	   	{
38
	   		return $this->player->tag;
39
	   	}
40
41
	   	/**
42
	   	 * Getting current player name.
43
	   	 *
44
	   	 * @return string, name 
45
	   	 */
46
	   	public function getName()
47
	   	{
48
	   		return $this->player->name;
49
	   	}
50
51
	   	/**
52
	   	 * Getting current player townhall level.
53
	   	 *
54
	   	 * @return int, townhallLevel
55
	   	 */
56
	   	public function getTownhallLevel()
57
	   	{
58
	   		return $this->player->townhallLevel;
59
	   	}
60
61
	   	/**
62
	   	 * Getting current player's experience level.
63
	   	 *
64
	   	 * @return int, expLevel
65
	   	 */
66
	   	public function getExp()
67
	   	{
68
	   		return $this->player->expLevel;
69
	   	}
70
71
	   	/**
72
	   	 * Getting current player's trophy.
73
	   	 *
74
	   	 * @return int, trophy
75
	   	 */
76
	   	public function getTrophies()
77
	   	{
78
	   		return $this->player->trophies;
79
	   	}
80
81
	   	/**
82
	   	 * Getting current player's highest trophy count.
83
	   	 *
84
	   	 * @return int, highestTrophy
85
	   	 */
86
	   	public function getBestTrophies()
87
	   	{
88
	   		return $this->player->bestTrophies;
89
	   	}
90
91
	   	/**
92
	   	 * Getting current player's war stars.
93
	   	 *
94
	   	 * @return int, warStars
95
	   	 */
96
	   	public function getWarStars()
97
	   	{
98
	   		return $this->player->warStars;
99
	   	}
100
101
	   	/**
102
	   	 * Getting current player's defense/attack wins.
103
	   	 *
104
	   	 * @return int, attackWins/defenseWins
105
	   	 */
106
	   	public function getWins($attack = true)
107
	   	{
108
	   		if ($attack == true)
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...
109
	   		{
110
	   			return $this->player->attackWins;
111
	   		}
112
	   		else
113
	   		{
114
	   			return $this->player->defenseWins;
115
	   		}
116
	   	}
117
118
	   	/**
119
	   	 * Getting current player's role.
120
	   	 *
121
	   	 * @return string, role
122
	   	 */
123
	   	public function getRole()
124
	   	{
125
	   		return $this->player->role;
126
	   	}
127
128
	   	/**
129
	   	 * Getting current player's donations.
130
	   	 *
131
	   	 * @return int, donations
132
	   	 */
133
	   	public function getDonations()
134
	   	{
135
	   		return $this->player->donations;
136
	   	}
137
138
	   	/**
139
	   	 * Getting current player's donations received.
140
	   	 *
141
	   	 * @return int, donationsReceived
142
	   	 */
143
	   	public function getDonationsReceived()
144
	   	{
145
	   		return $this->player->donationsReceived;
146
	   	}
147
148
	   	/**
149
	   	 * Getting player's clan details.
150
	   	 *
151
	   	 * @param string, detail (tag, badgeUrls, name, clanLevel)
152
	   	 */
153
	   	public function getPlayerClan($detail = "tag")
154
	   	{
155
	   		return $this->player->clan->$detail;
156
	   	}
157
158
	   	/**
159
	   	 * Getting player's league details.
160
	   	 *
161
	   	 * @param string, detail (id, name, iconUrls[small, tiny, medium])
162
	   	 */
163
	   	public function getLeague($detail = "name")
164
	   	{
165
	   		return $this->player->league->$detail;
166
	   	}
167
168
	   	/**
169
	   	 * Getting player's achievements by index.
170
	   	 *
171
	   	 * @param int, achievements
172
	   	 */
173
	   	public function getAchievements($achievement = 0)
174
	   	{
175
	   		return $this->player->achievements[$achievement];
176
	   	}
177
178
	   	/**
179
	   	 * Getting player's troops detail by index.
180
	   	 *
181
	   	 * @param int, troop (index)
182
	   	 */
183
	   	public function getTroops($troop = 0)
184
	   	{
185
	   		return $this->player->troops[$troop];
186
	   	}
187
188
	   	/**
189
	   	 * Getting player's spells detail by index.
190
	   	 *
191
	   	 * @param int, spell (index)
192
	   	 */
193
	   	public function getSpells($spell = 0)
194
	   	{
195
	   		return $this->player->spells[$spell];
196
	   	}
197
	}
198
?>
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...