process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_SESSION. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_form accesses the super-global variable $_POST. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Consider simplifying this complex logical expression. Open
else if ($description == 'Ray Miller' ||$description == 'Twin Pines' ||$description == 'Humane Society' ||$description == 'Adair Co. Library' ||$description == 'Recycling Center' ||$description == 'Bought Hours' ||$description == 'Camp' ||$description == 'Bake sale' ||$description == 'Large Service Project' ||$description == 'Other Service Project' ||$description == 'Non-APO Hours') {
$result = "<div class='entry'>The description cannot be the same as the event. Please enter a valid description so that exec can verify that you did the service hours. <br/></div>";
}
else {
$insert = "insert into apo.recorded_hours (user_id, event, month, day, year, date, description, hours, servicetype, fundraising, semester) values('$id', '$event', '$month','$day', '$year', '$date', '$description', '$hours', '$servicetype', '$fundraising', '$semester');";
Method list_stats
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
Method process_form
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
Method list_hours
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
Function list_stats
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function process_form
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function list_hours
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The function list_stats() has an NPath complexity of 256. The configured NPath complexity threshold is 200. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The function process_form() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The function list_stats() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$query2 = $db->query($insert) or die("If you encounter problems, please contact the webmaster.");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error - Contact Webmaster");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The method process_form uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$insert = "insert into apo.recorded_hours (user_id, event, month, day, year, date, description, hours, servicetype, fundraising, semester) values('$id', '$event', '$month','$day', '$year', '$date', '$description', '$hours', '$servicetype', '$fundraising', '$semester');";
$query2 = $db->query($insert) or die("If you encounter problems, please contact the webmaster.");
$result = '1';
END;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method list_hours uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hours_line = "class='hours_row2'";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The function process_form() contains an exit expression. Open
$query2 = $db->query($insert) or die("If you encounter problems, please contact the webmaster.");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$query2'. Open
$query2 = $db->query($insert) or die("If you encounter problems, please contact the webmaster.");
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$db'. Open
$query2 = $db->query($insert) or die("If you encounter problems, please contact the webmaster.");
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$sql'. Open
$sql = "SELECT contact_information.firstname, contact_information.lastname, SUM( hours ) AS `sum_hours`
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function list_stats() contains an exit expression. Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$db'. Open
$results = $db->query($sql) or die("Error - Contact Webmaster");
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The function list_hours() contains an exit expression. Open
$results = $db->query($sql) or die("Error - Contact Webmaster");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 25 and the first side effect is on line 2. Open
<?php
- Exclude checks
The parameter $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $_SESSION['sessionID'];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $i. Configured minimum length is 3. Open
while ($i = mysqli_fetch_array($results)) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The parameter $user_id is not named in camelCase. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $i. Configured minimum length is 3. Open
while($i = mysqli_fetch_array($results)) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
if ($month == NULL || $day == NULL || $event == NULL || $hours == NULL || $servicetype == NULL) {
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
if ($month == NULL || $day == NULL || $event == NULL || $hours == NULL || $servicetype == NULL) {
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
if ($month == NULL || $day == NULL || $event == NULL || $hours == NULL || $servicetype == NULL) {
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
if ($month == NULL || $day == NULL || $event == NULL || $hours == NULL || $servicetype == NULL) {
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
if ($month == NULL || $day == NULL || $event == NULL || $hours == NULL || $servicetype == NULL) {
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `event` != 'Non-APO Hours' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Chapter' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Campus' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Country' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 275 characters Open
$insert = "insert into apo.recorded_hours (user_id, event, month, day, year, date, description, hours, servicetype, fundraising, semester) values('$id', '$event', '$month','$day', '$year', '$date', '$description', '$hours', '$servicetype', '$fundraising', '$semester');";
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Community' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `event` = 'Bought Hours' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `fundraising` = '1' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line exceeds 120 characters; contains 389 characters Open
else if ($description == 'Ray Miller' ||$description == 'Twin Pines' ||$description == 'Humane Society' ||$description == 'Adair Co. Library' ||$description == 'Recycling Center' ||$description == 'Bought Hours' ||$description == 'Camp' ||$description == 'Bake sale' ||$description == 'Large Service Project' ||$description == 'Other Service Project' ||$description == 'Non-APO Hours') {
- Exclude checks
Line exceeds 120 characters; contains 185 characters Open
$result = "<div class='entry'>The description cannot be the same as the event. Please enter a valid description so that exec can verify that you did the service hours. <br/></div>";
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
<tr class='hours_header'><td>Event</td><td>Date</td><td>Type</td><td>Hours</td><td>Description</td><td>Semester</td><td></td></tr>";
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$fund = "<img src='http://apo.truman.edu/layout_files/fundraising_coin.jpeg' style='vertical-align: middle;' title='Fundraising!' alt='Fundraising!'/>";
- Exclude checks
Line exceeds 120 characters; contains 278 characters Open
$sql2 = "SELECT firstname, lastname, SUM( recorded_hours.hours ) AS `sum_hours` FROM `contact_information`, `recorded_hours` WHERE recorded_hours.user_id = contact_information.id AND `status` = 'Associate' AND `semester` = '$current_semester' GROUP BY contact_information.id";
- Exclude checks
Line exceeds 120 characters; contains 299 characters Open
$sql = "SELECT firstname, lastname, SUM( recorded_hours.hours ) AS `sum_hours` FROM `contact_information`, `recorded_hours` WHERE recorded_hours.user_id = contact_information.id AND `fundraising` = 1 OR `fundraising` = 'NULL' AND `semester` = '$current_semester' GROUP BY contact_information.id";
- Exclude checks
Line exceeds 120 characters; contains 308 characters Open
$sql1 = "SELECT firstname, lastname, SUM( recorded_hours.hours ) AS `sum_hours` FROM `contact_information`, `recorded_hours` WHERE recorded_hours.user_id = contact_information.id AND `status` != 'Early Alum' AND `status` != 'Associate' AND `semester` = '$current_semester' GROUP BY contact_information.id";
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
//$sql = "SELECT `id`,`firstname`, `lastname` FROM `contact_information` WHERE `active_sem` = '$current_semester' ORDER BY `firstname`";
- Exclude checks
Line exceeds 120 characters; contains 277 characters Open
$sql3 = "SELECT firstname, lastname, COUNT(recorded_hours.fundraising) AS `no_hours` FROM `contact_information`, `recorded_hours` WHERE recorded_hours.user_id = contact_information.id AND `fundraising` != 1 AND `semester` = '$current_semester' GROUP BY contact_information.id";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$semester = $_POST['semester'];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$query2 = $db->query($insert) or die("If you encounter problems, please contact the webmaster.");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Community Hours:</span> $community_hours<br/>";
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Space before opening parenthesis of function call prohibited Open
include ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$hours = round($hours, 2);
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$result = "Your didn't fill out the form completely.<br/>";
- Exclude checks
Opening brace should be on a new line Open
function list_stats($hours_id, $semester) {
- Exclude checks
Space before opening parenthesis of function call prohibited Open
include ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Total Hours:</span> $total_hours<br/>";
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT contact_information.firstname, contact_information.lastname, SUM( hours ) AS `sum_hours`
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$description = $_POST['description'];
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$hours = $_POST['hours'];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$result = "<div class='entry'>The description cannot be the same as the event. Please enter a valid description so that exec can verify that you did the service hours. <br/></div>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
include ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Community' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
if ($month == NULL || $day == NULL || $event == NULL || $hours == NULL || $servicetype == NULL) {
- Exclude checks
Usage of ELSE IF is discouraged; use ELSEIF instead Open
else if ($description == 'Ray Miller' ||$description == 'Twin Pines' ||$description == 'Humane Society' ||$description == 'Adair Co. Library' ||$description == 'Recycling Center' ||$description == 'Bought Hours' ||$description == 'Camp' ||$description == 'Bake sale' ||$description == 'Large Service Project' ||$description == 'Other Service Project' ||$description == 'Non-APO Hours') {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Expected 1 space after closing brace; newline found Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
else {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 0 Open
END;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$servicetype = $_POST['servicetype'];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Bought Hours:</span> $i[sum_hours]<br/>";
- Exclude checks
Opening brace should be on a new line Open
function list_hours($user_id) {
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
include ('mysql_access.php');
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Space before opening parenthesis of function call prohibited Open
include ('mysql_access.php');
- Exclude checks
Space before opening parenthesis of function call prohibited Open
include ('mysql_access.php');
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Space before opening parenthesis of function call prohibited Open
require_once ('session.php');
- Exclude checks
Space before opening parenthesis of function call prohibited Open
require_once ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Chapter Hours:</span> $i[sum_hours]<br/>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$event = $_POST['event'];
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
include ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$insert = "insert into apo.recorded_hours (user_id, event, month, day, year, date, description, hours, servicetype, fundraising, semester) values('$id', '$event', '$month','$day', '$year', '$date', '$description', '$hours', '$servicetype', '$fundraising', '$semester');";
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Chapter' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Campus Hours:</span> $i[sum_hours]<br/>";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Fundraising Hours:</span> $i[sum_hours]<br/>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$month = $_POST['month'];
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$fundraising = $_POST['fundraising'];
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
else if ($description == 'Ray Miller' ||$description == 'Twin Pines' ||$description == 'Humane Society' ||$description == 'Adair Co. Library' ||$description == 'Recycling Center' ||$description == 'Bought Hours' ||$description == 'Camp' ||$description == 'Bake sale' ||$description == 'Large Service Project' ||$description == 'Other Service Project' ||$description == 'Non-APO Hours') {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `event` = 'Bought Hours' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Opening brace should be on a new line Open
function top_hours() {
- Exclude checks
Opening brace should be on a new line Open
function process_form() {
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
include ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$id = $_SESSION['sessionID'];
- Exclude checks
Expected 1 space after closing brace; newline found Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$result = '1';
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
return $result;
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `event` != 'Non-APO Hours' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error Calculating Hours");
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>Country Hours:</span> $i[sum_hours]<br/>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$description = htmlspecialchars($description, ENT_QUOTES);
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$apo_hours = round($i['sum_hours'], 2);
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<span>APO Hours:</span> $apo_hours<br/>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Country' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `fundraising` = '1' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `servicetype` = 'Campus' AND `semester` = '$semester' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$total_hours = round($i['sum_hours'], 2);
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$community_hours = round($i['sum_hours'], 2);
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$inc = 1;
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 6 Open
$hours_line = "class='hours_row1'";
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 2 Open
} elseif ($_SESSION['sessionexec'] == 1 or $_SESSION['sessionexec'] == 2) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
$result = $db->query($sql);
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$fund = "";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<option value='$row[id]'>$row[firstname] $row[lastname]</option>";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
$row = mysqli_fetch_array($result);
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
} else {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if ($i['fundraising'] == 1) {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
if (isset($_GET['user_id'])) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
echo "<div id='service_log2' style='margin: 30px; padding: 15px;'>";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
echo "</div>";
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<tr $hours_line><td width='20%'>$i[event]</td>
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
$result = $db->query($sql);
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo<<<END
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
echo "<p>Hours logged by <b>$row[firstname] $row[lastname]</b> (<i>$row[status]</i>).</p>";
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 6 Open
$fund = "<img src='http://apo.truman.edu/layout_files/fundraising_coin.jpeg' style='vertical-align: middle;' title='Fundraising!' alt='Fundraising!'/>";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
list_hours($user_id, $current_semester);
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysqli_fetch_array($result)) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo "<br clear='both'/>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
$results = $db->query($sql) or die("Error - Contact Webmaster");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$inc = $inc + 1;
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
echo "</table></div>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo<<<END
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 6 Open
$hours_line = "class='hours_row2'";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
$sql = "SELECT `id`,`firstname`, `lastname` FROM `contact_information` WHERE 1 ORDER BY `firstname`";
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
list_stats($user_id, $current_semester);
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while ($i = mysqli_fetch_array($results)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
$user_id = $_GET['user_id'];
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
while($row = mysqli_fetch_array($result)) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 2 Open
$sql = "SELECT `firstname`, `lastname`, `status` FROM `contact_information` WHERE `id`='$_GET[user_id]' LIMIT 1";
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if (($inc % 2) == 1) {
- Exclude checks
Closing brace indented incorrectly; expected 0 spaces, found 2 Open
} elseif ($_SESSION['sessionexec'] == 1 or $_SESSION['sessionexec'] == 2) {
- Exclude checks
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $total_hours is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $apo_hours is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $total_hours is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $apo_hours is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_line is not named in camelCase. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_line is not named in camelCase. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $community_hours is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_id is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $hours_line is not named in camelCase. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $community_hours is not named in camelCase. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
// Total Hours
$sql = "SELECT SUM(hours) AS sum_hours FROM `recorded_hours` WHERE `user_id` = $hours_id AND `semester` = '$semester' LIMIT 1";
$results = $db->query($sql) or die("Error Calculating Hours");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
function list_hours($user_id) {
include ('mysql_access.php');
$sql = "SELECT * FROM `recorded_hours` WHERE `user_id` = $user_id ORDER BY `year` DESC, `month` DESC, `day` DESC";
$results = $db->query($sql) or die("Error - Contact Webmaster");
echo "<div style='margin: 0px auto; width: 100%; text-align: center;'>
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}