• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My new work - An anti-scriping library.

#1
I just have completed the document, can't wait for share with you. Any feedback, feature request are welcome. 


Git: https://github.com/terrylinooo/shieldon



Document: https://shield-on-php.github.io/


Demo: https://terryl.in (Just refresh many times at a short period time to see how it work.)


Implement this in your Codeigniter 3:

in MY_Controller


Code:
public function protection()
{
    $db = [
        'host'    => $this->db->hostname,
        'dbname'  => $this->db->database,
        'user'    => $this->db->username,
        'pass'    => $this->db->password,
        'charset' => 'utf8',
    ];

    $pdoInstance = new \PDO(
        'mysql:host=' . $db['host'] . ';dbname=' . $db['dbname'] . ';charset=' . $db['charset'],
        $db['user'],
        $db['pass']
    );

    $shieldon = new \Shieldon\Shieldon();
    $shieldon->setDriver(new \Shieldon\Driver\MysqlDriver($pdoInstance));
    $shieldon->setComponent(new \Shieldon\Component\Ip());
    $shieldon->setComponent(new \Shieldon\Component\Robot());

 
    $shieldon->setCaptcha(new \Shieldon\Captcha\ImageCaptcha(['word_length' => 4]));
    

    // Start protecting your website!
    $result = $shieldon->run();
    
    if ($result !== $shieldon::RESPONSE_ALLOW) {
        if ($shieldon->captchaResponse()) {
            // Unban current session.
            $shieldon->unban();
        }
        // Output the result page with HTTP status code 200.
        $shieldon->output(200);
    }
}

Then


PHP Code:
$this->protection(); 

In any Controller, you want to protect the page.
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome.
Reply


Messages In This Thread
My new work - An anti-scriping library. - by allenlee - 05-28-2019, 02:49 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.