Coder Social home page Coder Social logo

easyphp's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

veramis

easyphp's Issues

isEmpty logic change

I think your logic is flawed on isEmpty method.

isEmpty suggests if the variable is empty return TRUE, otherwise FALSE.
Your logic suggests if the variable is empty return FALSE, otherwise NOT FALSE.

Because, really, you're asking if it's empty. If it is, return TRUE.

Also, methods prefixed with is should return boolean.

    public static function isEmpty($variable) {
        //Do we need to check the variable is set?
        return empty($variable);
    }

Write to log

The logger() method should write to a log too (if a parameter is given) depending on the type of $message. For example;

    public static function logger($message, $type = "") {
        $timeStamp = date("h:i:s d/m/Y");
        mail($this->loggerSendTo, "PHP Logger", $message . PHP_EOL . PHP_EOL . "Sent On - " . $timeStamp, "From: $sendTo");
         if($type != "") {
           if(file_exists('/path/to/logs'. strtolower($type) .'.log') AND is_writable('/path/to/logs'. strtolower($type) .'.log') {
                file_put_contents('/path/to/logs'. strtolower($type) .'.log', PHP_EOL . $timeStamp .' -'. $message . PHP_EOL, FILE_APPEND);
           }
       }
    }

Possible insecurity (IP)

There's a possible insecurity here, allowing users to spoof their IP address.

X-Forwarded-For is an HTTP header field considered as a de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer.

Source

encode method change

Your method encode() should be changed to;

  • Either have the encoding type in the method name or parameter
  • Why are you replacing the base64 padding (=) with another character?

Notify method

The notify method is pretty ineffective, as you'd be sending n e-mails every time it's called, rather than just 1.

For the to field (the first parameter), you can comma separate the addresses.

This will be more effective.

 mail( implode(",", self::$mailTo), "New Major Error Logged" . $message . PHP_EOL . PHP_EOL . "This log was generated on " . $logGeneratedOn . PHP_EOL . PHP_EOL . "The time above is set using the server time.", "From: Logs@EasyPHPClass\n");

Modify redirect()

The current redirect method has a pretty redundant parameter; $type. If you want an instant redirect, you need to supply the word instant, which really isn't needed, because the only thing that separates an instant redirect and a timed redirect is the $time parameter.

I think an approach like this would be much better;

public static function redirect($page, $time = 0) {
       header("Refresh: $time; URL=$page");    
}

That way, you only have 1 parameter for an instant redirect, and 2 for a timed redirect; not three (one being useless).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.