APO-Epsilon/apo-website

View on GitHub
r8conf2016/login_sendpw.php

Summary

Maintainability
B
6 hrs
Test Coverage

Avoid using undefined variables such as '$seedings' which will lead to PHP notices.
Open

    $seedings['numeric'] = '0123456789';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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 '$seedings' which will lead to PHP notices.
Open

        $seeds = $seedings[$seeds];
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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 '$seedings' which will lead to PHP notices.
Open

    $seedings['alpha'] = 'abcdefghijklmnopqrstuvwqyz';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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 '$seedings' which will lead to PHP notices.
Open

    if (isset($seedings[$seeds]))
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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 '$seedings' which will lead to PHP notices.
Open

    $seedings['alphanum'] = 'abcdefghijklmnopqrstuvwqyz0123456789';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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 '$seedings' which will lead to PHP notices.
Open

    $seedings['hexidec'] = '0123456789abcdef';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function str_rand($length = 8, $seeds = 'alphanum')
{
    include ('mysql_access.php');
    // Possible seeds
    $seedings['alpha'] = 'abcdefghijklmnopqrstuvwqyz';
Severity: Major
Found in r8conf2016/login_sendpw.php and 1 other location - About 6 hrs to fix
login_sendpw.php on lines 6..36

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 211.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 6 and the first side effect is on line 2.
Open

<?php
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line exceeds 120 characters; contains 298 characters
Open

          "To ensure the privacy of your password, it has been stored in an encrypted form and cannot be decrypted.  Therefore, your password has been set to a random value, displayed below.  When you login, please update your password.  This new password only becomes active if you use it.\n \n" .
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line exceeds 120 characters; contains 190 characters
Open

          "We have received your forgotten password request.  If you did not submit this request, please let the webmaster know as soon as possible so security measures can be taken.\n \n" .
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

    include ('mysql_access.php');
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

require_once ('../mysql_access.php');
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  echo "<p>Name found.</p>";
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  $emailToSend = $firstname . " " . $lastname . ",\n\n" .
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  $mail->Subject = $subject;
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 2
Open

  if(!$mail->Send()) {
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 5
Open

    for ($i = 0; $length > $i; $i++)
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Expected 1 space after IF keyword; 0 found
Open

  if(!$mail->Send()) {
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  $new_password = str_rand(15, 'alphanum');
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

require_once ('session.php');
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  extract($r);
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    echo "Message could not be sent. <p>";
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  $mail->Body    = $emailToSend;
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

require_once ('../PasswordHash.php');
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  echo 'Error: Email does not exist in our database.';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  $subject = "APO Epsilon Region VIII Conference Password Request";
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    echo "Mailer Error: " . $mail->ErrorInfo;
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 2
Open

  } else {
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  $mail->AddAddress("$email", "$firstname $lastname");
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    exit;
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    $sql = "UPDATE `conf_contact_information` SET `password` = '$hash' WHERE id = '$id'";
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 5
Open

    if (isset($seedings[$seeds]))
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    echo "Message has been sent.";
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    $query = $db->query($sql) or die("If you encounter problems, please contact the webmaster.");
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

A closing tag is not permitted at the end of a PHP file
Open

?>
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 2
Open

  }
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpcodesniffer

The variable $seeds_count is not named in camelCase.
Open

function str_rand($length = 8, $seeds = 'alphanum')
{
    include ('mysql_access.php');
    // Possible seeds
    $seedings['alpha'] = 'abcdefghijklmnopqrstuvwqyz';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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 $seeds_count is not named in camelCase.
Open

function str_rand($length = 8, $seeds = 'alphanum')
{
    include ('mysql_access.php');
    // Possible seeds
    $seedings['alpha'] = 'abcdefghijklmnopqrstuvwqyz';
Severity: Minor
Found in r8conf2016/login_sendpw.php by phpmd

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

There are no issues that match your filters.

Category
Status